20 fprintf(stderr,
"Usage: L2 nfield meshfile fld \n");
24 int nfield = boost::lexical_cast<
int>(argv[argc-3]);
27 = LibUtilities::SessionReader::CreateInstance(argc-1, argv+1);
32 string meshfile(argv[argc-2]);
38 string fieldfile(argv[argc-1]);
39 vector<LibUtilities::FieldDefinitionsSharedPtr> fielddef;
40 vector<vector<NekDouble> > fielddata;
43 bool dealiasing =
false;
48 int expdim = graphShPt->GetMeshDimension();
49 int nfields = fielddef[0]->m_fields.size();
52 ASSERTL0((nfield >= 0)&&(nfield < nfields),
"Value of nfield must be between zero and less than the number of fields in the file");
58 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 2,
"Quasi-3D approach is only set up for 1 or 2 homogeneous directions");
60 if(fielddef[0]->m_numHomogeneousDir == 1)
65 int nplanes = fielddef[0]->m_numModes[1];
70 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
75 for(i = 1; i < nfields; ++i)
80 else if(fielddef[0]->m_numHomogeneousDir == 2)
85 int nylines = fielddef[0]->m_numModes[1];
86 int nzlines = fielddef[0]->m_numModes[2];
95 NekDouble ly = fielddef[0]->m_homogeneousLengths[0];
96 NekDouble lz = fielddef[0]->m_homogeneousLengths[1];
101 for(i = 1; i < nfields; ++i)
112 for(i = 1; i < nfields; ++i)
122 ASSERTL0(fielddef[0]->m_numHomogeneousDir <= 1,
"NumHomogeneousDir is only set up for 1");
124 if(fielddef[0]->m_numHomogeneousDir == 1)
129 int nplanes = fielddef[0]->m_numModes[2];
135 NekDouble lz = fielddef[0]->m_homogeneousLengths[0];
140 for(i = 1; i < nfields; ++i)
153 for(i = 1; i < nfields; ++i)
168 for(i = 1; i < nfields; ++i)
176 ASSERTL0(
false,
"Expansion dimension not recognised");
183 for(j = 0; j < nfields; ++j)
185 for(
int i = 0; i < fielddata.size(); ++i)
187 Exp[j]->ExtractDataToCoeffs(fielddef [i],
189 fielddef [i]->m_fields[j],
190 Exp[j]->UpdateCoeffs());
192 Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
196 cout <<
"L2 of field "<< nfield <<
" is : " << Exp[nfield]->L2(Exp[nfield]->GetPhys()) << endl;
#define ASSERTL0(condition, msg)
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.