Skip to content

Commit

Permalink
replace VLAs
Browse files Browse the repository at this point in the history
when compiling with cgns enabled c++14 is enabled and these were being flagged as warnings which were promotted to errors
  • Loading branch information
cwsmith committed Aug 24, 2024
1 parent 4aa2326 commit 9f91f21
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/convert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <getopt.h>
#include <string.h>
#include <stdio.h>
#include <array> //std::array

using namespace std;

Expand Down Expand Up @@ -246,7 +247,7 @@ void addFathersTag(pGModel simModel, pParMesh sim_mesh, apf::Mesh* simApfMesh, c
int nvert=i;
PList_delete(listV);

double coordNewPt[nvert][3];
std::vector<std::array<double,3>> coordNewPt(nvert,{0,0,0});
for(i=0; i< nvert ; i++) {
int* markedData;
if(!EN_getDataPtr((pEntity)vrts[i],myFather,(void**)&markedData)){ // not sure about marked yet
Expand Down Expand Up @@ -347,13 +348,13 @@ void addFathersTag(pGModel simModel, pParMesh sim_mesh, apf::Mesh* simApfMesh, c
int* vtxData = new int[1];
vtxData[0] = count2D;
EN_attachDataPtr((pEntity)vrts[i],myFather,(void*)vtxData);
V_coord(vrts[i],coordNewPt[i]);
V_coord(vrts[i],coordNewPt[i].data());

fprintf ( fcr, "%.15E %.15E %d %d %d %d \n", coordNewPt[i][0],coordNewPt[i][1], vClassDim, foundESTag, foundETag, foundEETag );
}
}

double coordFather[nvert][3];
std::vector<std::array<double,3>> coordFather(nvert,{0,0,0});
int fatherIds[4]; //store the ids of the fathers (vertices) on the root face
for(i=0; i< nvert ; i++) {
int* fatherIdPtr;
Expand All @@ -365,7 +366,7 @@ void addFathersTag(pGModel simModel, pParMesh sim_mesh, apf::Mesh* simApfMesh, c
}
assert(exists);
fatherIds[i] = fatherIdPtr[0];
V_coord(vrts[i],coordFather[i]);
V_coord(vrts[i],coordFather[i].data());
fprintf ( fcn, "%d ", fatherIds[i]);
}
fprintf ( fcn, "\n");
Expand Down

0 comments on commit 9f91f21

Please sign in to comment.