6 using namespace Nektar;
8 int main(
int argc,
char *argv[])
12 fprintf(stderr,
"Usage: ExtractmeanModeFromHomo1DFld fieldfile outfield\n");
21 string fieldfile(argv[argc-2]);
22 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
23 vector<vector<NekDouble> > fielddata;
28 vector<vector<NekDouble> > combineddata;
29 vector<LibUtilities::FieldDefinitionsSharedPtr> newfielddef;
33 for(
int i = 0; i < fielddata.size(); ++i)
35 ASSERTL0(fielddef[i]->m_numHomogeneousDir == 1,
"Expected fieldfile to have one homogeneous direction");
37 if(fielddef[i]->m_homogeneousZIDs[0] != 0)
43 int nz = fielddef[i]->m_homogeneousZIDs.size();
45 fielddef[i]->m_numHomogeneousDir = 0;
46 fielddef[i]->m_basis.resize(2);
47 newfielddef.push_back(fielddef[i]);
52 switch(fielddef[i]->m_shapeType)
58 ncoeffs = fielddef[i]->m_numModes[0]*fielddef[i]->m_numModes[1];
61 ASSERTL0(
false,
"Shape not recognised");
67 vector<NekDouble> newdata;
68 vec_iter = fielddata[i].begin();
70 for(
int k = 0; k < fielddef[i]->m_fields.size(); ++k)
73 for(
int n = 0; n < fielddef[i]->m_elementIDs.size(); ++n)
76 newdata.insert(newdata.end(),vec_iter, vec_iter+ncoeffs);
77 vec_iter += nz*ncoeffs;
80 combineddata.push_back(newdata);