15 int main(
int argc,
char *argv[])
21 fprintf(stderr,
"Usage: L2 nfield meshfile fld \n");
25 int nfield = boost::lexical_cast<
int>(argv[argc-3]);
28 = LibUtilities::SessionReader::CreateInstance(argc-1, argv+1);
33 string meshfile(argv[argc-2]);
39 string fieldfile(argv[argc-1]);
40 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
41 vector<vector<NekDouble> > fielddata;
44 bool dealiasing =
false;
49 int expdim = graphShPt->GetMeshDimension();
50 int nfields = fielddef[0]->m_fields.size();
53 ASSERTL0((nfield >= 0)&&(nfield < nfields),
"Value of nfield must be between zero and less than the number of fields in the file");
59 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 2,
"Quasi-3D approach is only set up for 1 or 2 homogeneous directions");
61 if(fielddef[0]->m_numHomogeneousDir == 1)
66 int nplanes = fielddef[0]->m_numModes[1];
71 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
76 for(i = 1; i < nfields; ++i)
81 else if(fielddef[0]->m_numHomogeneousDir == 2)
86 int nylines = fielddef[0]->m_numModes[1];
87 int nzlines = fielddef[0]->m_numModes[2];
96 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
97 NekDouble lz = fielddef[0]->m_homogeneousLengths[1];
102 for(i = 1; i < nfields; ++i)
113 for(i = 1; i < nfields; ++i)
123 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 1,
"NumHomogeneousDir is only set up for 1");
125 if(fielddef[0]->m_numHomogeneousDir == 1)
130 int nplanes = fielddef[0]->m_numModes[2];
136 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
141 for(i = 1; i < nfields; ++i)
154 for(i = 1; i < nfields; ++i)
169 for(i = 1; i < nfields; ++i)
177 ASSERTL0(
false,
"Expansion dimension not recognised");
184 for(j = 0; j < nfields; ++j)
186 for(
int i = 0; i < fielddata.size(); ++i)
188 Exp[j]->ExtractDataToCoeffs(fielddef [i],
190 fielddef [i]->m_fields[j],
191 Exp[j]->UpdateCoeffs());
193 Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
197 cout <<
"L2 of field "<< nfield <<
" is : " << Exp[nfield]->L2(Exp[nfield]->GetPhys()) << endl;
#define ASSERTL0(condition, msg)
int main(int argc, char *argv[])
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
boost::shared_ptr< ExpList3DHomogeneous2D > ExpList3DHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > ElementiDs)
Imports an FLD file.
1D Evenly-spaced points using Lagrange polynomial
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
Defines a specification for a set of points.
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
boost::shared_ptr< ExpList2DHomogeneous1D > ExpList2DHomogeneous1DSharedPtr
Shared pointer to an ExpList2DHomogeneous1D object.
boost::shared_ptr< ExpList3D > ExpList3DSharedPtr
Shared pointer to an ExpList3D object.
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Describes the specification for a Basis.