9 int main(
int argc,
char *argv[])
13 fprintf(stderr,
"Usage: ExtractmeanModeFromHomo1DFld fieldfile outfield\n");
25 string fieldfile(argv[argc-2]);
26 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
27 vector<vector<NekDouble> > fielddata;
31 vector<vector<NekDouble> > combineddata;
32 vector<LibUtilities::FieldDefinitionsSharedPtr> newfielddef;
36 for(i = 0; i < fielddata.size(); ++i)
38 ASSERTL0(fielddef[i]->m_numHomogeneousDir == 1,
39 "Expected fieldfile to have one homogeneous direction");
41 if(fielddef[i]->m_homogeneousZIDs[0] != 0)
47 nz = fielddef[i]->m_homogeneousZIDs.size();
49 fielddef[i]->m_numHomogeneousDir = 0;
50 fielddef[i]->m_basis.resize(2);
51 newfielddef.push_back(fielddef[i]);
55 switch(fielddef[i]->m_shapeType)
59 fielddef[i]->m_numModes[0], fielddef[i]->m_numModes[1]);
62 ncoeffs = fielddef[i]->m_numModes[0]*fielddef[i]->m_numModes[1];
65 ASSERTL0(
false,
"Shape not recognised");
69 vector<NekDouble> newdata;
70 auto vec_iter = fielddata[i].begin();
72 for(k = 0; k < fielddef[i]->m_fields.size(); ++k)
75 for(n = 0; n < fielddef[i]->m_elementIDs.size(); ++n)
78 newdata.insert(newdata.end(),vec_iter, vec_iter+ncoeffs);
79 vec_iter += nz*ncoeffs;
82 combineddata.push_back(newdata);
#define ASSERTL0(condition, msg)
int getNumberOfCoefficients(int Na)
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > &ElementIDs)
This function allows for data to be imported from an FLD file when a session and/or communicator is n...
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap, const bool backup)
This function allows for data to be written to an FLD file when a session and/or communicator is not ...
The above copyright notice and this permission notice shall be included.