36 #ifndef FIELDUTILS_FIELD
37 #define FIELDUTILS_FIELD
39 #include <boost/shared_ptr.hpp>
74 : m_verbose(false), m_declareExpansionAsContField(false),
75 m_declareExpansionAsDisContField(false),
76 m_requireBoundaryExpansion(false), m_writeBndFld(false),
77 m_fldToBnd(false), m_addNormals(false),
78 m_setUpEquiSpacedFields(false), m_fieldPts(LibUtilities::
NullPtsField)
90 vector<LibUtilities::FieldDefinitionsSharedPtr>
m_fielddef;
92 vector<MultiRegions::ExpListSharedPtr>
m_exp;
121 int NumHomogeneousDir,
bool fldfilegiven =
false)
127 int expdim = m_graph->GetMeshDimension();
128 bool dealiasing =
false;
130 m_session->MatchSolverInfo(
"USEFFT",
"FFTW", m_useFFT,
false);
137 "Quasi-3D approach is only set up for 1 or 2 "
138 "homogeneous directions");
140 if (NumHomogeneousDir == 1)
151 nplanes = m_fielddef[0]->m_numModes[1];
152 ly = m_fielddef[0]->m_homogeneousLengths[0];
153 btype = m_fielddef[0]->m_basis[1];
157 m_session->LoadParameter(
"HomModesZ", nplanes);
158 m_session->LoadParameter(
"LY", ly);
169 if (m_declareExpansionAsContField ||
170 m_declareExpansionAsDisContField)
172 ASSERTL0(
false,
"ContField2DHomogeneous1D or "
173 "DisContField2DHomogenenous1D has "
174 "not been implemented");
184 else if (NumHomogeneousDir == 2)
188 int nylines, nzlines;
194 nylines = m_fielddef[0]->m_numModes[1];
195 nzlines = m_fielddef[0]->m_numModes[2];
196 ly = m_fielddef[0]->m_homogeneousLengths[0];
197 lz = m_fielddef[0]->m_homogeneousLengths[1];
198 btype1 = m_fielddef[0]->m_basis[1];
199 btype2 = m_fielddef[0]->m_basis[2];
203 m_session->LoadParameter(
"HomModesY", nylines);
204 m_session->LoadParameter(
"HomModesZ", nzlines);
205 m_session->LoadParameter(
"LY", ly);
206 m_session->LoadParameter(
"LZ", lz);
221 if (m_declareExpansionAsContField)
225 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
226 m_useFFT, dealiasing, m_graph,
227 m_session->GetVariable(0),
230 else if (m_declareExpansionAsDisContField)
234 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
235 m_useFFT, dealiasing, m_graph,
236 m_session->GetVariable(0),
243 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
244 m_useFFT, dealiasing, m_graph,
254 if (m_declareExpansionAsContField)
258 m_session->GetVariable(0),
261 else if (m_declareExpansionAsDisContField)
265 m_session->GetVariable(0),
284 "NumHomogeneousDir is only set up for 1");
286 if (NumHomogeneousDir == 1)
299 nplanes = m_fielddef[0]->m_numModes[2];
300 lz = m_fielddef[0]->m_homogeneousLengths[0];
301 btype = m_fielddef[0]->m_basis[2];
306 m_fielddef[0]->m_basis[2] =
321 m_session->LoadParameter(
"HomModesZ", nplanes);
322 m_session->LoadParameter(
"LZ", lz);
333 if (m_declareExpansionAsContField)
337 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
339 m_session->GetVariable(0),
342 else if (m_declareExpansionAsDisContField)
346 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
348 m_session->GetVariable(0),
355 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
366 if (m_declareExpansionAsContField)
370 m_session->GetVariable(0),
374 else if (m_declareExpansionAsDisContField)
378 m_session->GetVariable(0),
399 if (m_declareExpansionAsContField)
403 m_session->GetVariable(0),
407 else if (m_declareExpansionAsDisContField)
411 m_session->GetVariable(0),
429 ASSERTL0(
false,
"Expansion dimension not recognised");
452 string fmt = LibUtilities::FieldIO::GetFileType(filename, c);
456 if (it == m_fld.end())
470 int NumHomogeneousDir,
string var =
"DefaultVar",
bool NewField =
false)
472 if (var.compare(
"DefaultVar") == 0 && m_requireBoundaryExpansion)
474 if (m_session->GetVariables().size())
476 var = m_session->GetVariables()[0];
480 switch (m_graph->GetMeshDimension())
484 if (NumHomogeneousDir == 1)
486 ASSERTL0(!(m_declareExpansionAsContField ||
487 m_declareExpansionAsDisContField),
488 "ContField2DHomogeneous1D or "
489 "DisContField2DHomogenenous1D has not been "
493 boost::dynamic_pointer_cast<
499 else if (NumHomogeneousDir == 2)
501 if (m_declareExpansionAsContField)
504 boost::dynamic_pointer_cast<
510 AllocateSharedPtr(*tmp2);
512 else if (m_declareExpansionAsDisContField)
515 tmp2 = boost::dynamic_pointer_cast<
521 AllocateSharedPtr(*tmp2);
526 boost::dynamic_pointer_cast<
531 AllocateSharedPtr(*tmp2);
536 if (m_declareExpansionAsContField)
539 boost::dynamic_pointer_cast<
545 else if (m_declareExpansionAsDisContField)
548 boost::dynamic_pointer_cast<
557 boost::dynamic_pointer_cast<
568 if (NumHomogeneousDir == 1)
570 if (m_declareExpansionAsContField)
574 bool dealiasing =
false;
580 ->GetHomogeneousBasis()
582 m_exp[0]->GetHomoLen(), m_useFFT,
583 dealiasing, m_graph, var);
588 tmp2 = boost::dynamic_pointer_cast<
592 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
595 AllocateSharedPtr(*tmp2, m_graph, var);
598 else if (m_declareExpansionAsDisContField)
602 bool dealiasing =
false;
608 ->GetHomogeneousBasis()
610 m_exp[0]->GetHomoLen(), m_useFFT,
611 dealiasing, m_graph, var);
616 tmp2 = boost::dynamic_pointer_cast<
619 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
623 AllocateSharedPtr(*tmp2);
630 bool dealiasing =
false;
636 ->GetHomogeneousBasis()
638 m_exp[0]->GetHomoLen(), m_useFFT,
639 dealiasing, m_graph);
644 boost::dynamic_pointer_cast<
647 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
651 AllocateSharedPtr(*tmp2);
657 if (m_declareExpansionAsContField)
668 boost::dynamic_pointer_cast<
675 else if (m_declareExpansionAsDisContField)
685 boost::dynamic_pointer_cast<
695 boost::dynamic_pointer_cast<
706 if (m_declareExpansionAsContField)
716 boost::dynamic_pointer_cast<
722 m_locToGlobalMap = tmp2->GetLocalToGlobalMap();
725 else if (m_declareExpansionAsDisContField)
735 boost::dynamic_pointer_cast<
754 ASSERTL0(
false,
"Expansion dimension not recognised");
764 map<string, LibUtilities::FieldIOSharedPtr>
m_fld;
LibUtilities::CommSharedPtr m_comm
vector< MultiRegions::ExpListSharedPtr > m_exp
bool m_requireBoundaryExpansion
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr SetUpFirstExpList(int NumHomogeneousDir, bool fldfilegiven=false)
#define ASSERTL0(condition, msg)
boost::shared_ptr< ContField1D > ContField1DSharedPtr
boost::shared_ptr< ContField3DHomogeneous1D > ContField3DHomogeneous1DSharedPtr
FIELD_UTILS_EXPORT ~Field()
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
bool m_declareExpansionAsDisContField
FIELD_UTILS_EXPORT LibUtilities::FieldIOSharedPtr FieldIOForFile(string filename)
Construct a FieldIO object for the file filename.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
boost::shared_ptr< DisContField3DHomogeneous1D > DisContField3DHomogeneous1DSharedPtr
LibUtilities::PtsIOSharedPtr m_ptsIO
LibUtilities::SessionReaderSharedPtr m_session
boost::shared_ptr< ContField2D > ContField2DSharedPtr
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
std::map< std::string, std::string > FieldMetaDataMap
CommFactory & GetCommFactory()
SpatialDomains::MeshGraphSharedPtr m_graph
boost::shared_ptr< PtsField > PtsFieldSharedPtr
boost::shared_ptr< ExpList3DHomogeneous2D > ExpList3DHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
bool m_declareExpansionAsContField
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr AppendExpList(int NumHomogeneousDir, string var="DefaultVar", bool NewField=false)
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
1D Evenly-spaced points using Lagrange polynomial
boost::shared_ptr< DisContField3DHomogeneous2D > DisContField3DHomogeneous2DSharedPtr
bool m_setUpEquiSpacedFields
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
1D Evenly-spaced points using Fourier Fit
Fourier Modified expansions with just the real part of the first mode .
This class is the abstraction of a global continuous two- dimensional spectral/hp element expansion w...
Abstraction of a global continuous one-dimensional spectral/hp element expansion which approximates t...
boost::shared_ptr< ContField3DHomogeneous2D > ContField3DHomogeneous2DSharedPtr
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
vector< unsigned int > m_bndRegionsToWrite
boost::shared_ptr< Field > FieldSharedPtr
vector< vector< double > > m_data
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
boost::shared_ptr< DisContField2D > DisContField2DSharedPtr
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
Defines a specification for a set of points.
boost::shared_ptr< FieldIO > FieldIOSharedPtr
boost::shared_ptr< DisContField1D > DisContField1DSharedPtr
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
boost::shared_ptr< DisContField3D > DisContField3DSharedPtr
map< string, LibUtilities::FieldIOSharedPtr > m_fld
Map to store FieldIO instances. Key is the reader type, value is the FieldIO object.
boost::shared_ptr< ExpList2DHomogeneous1D > ExpList2DHomogeneous1DSharedPtr
Shared pointer to an ExpList2DHomogeneous1D object.
boost::shared_ptr< PtsIO > PtsIOSharedPtr
boost::shared_ptr< ExpList3D > ExpList3DSharedPtr
Shared pointer to an ExpList3D object.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
static PtsFieldSharedPtr NullPtsField
#define FIELD_UTILS_EXPORT
Fourier ModifiedExpansion with just the first mode .
This class is the abstraction of a one-dimensional multi-elemental expansions which is merely a colle...
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
Abstraction of a three-dimensional multi-elemental expansion which is merely a collection of local ex...
MultiRegions::AssemblyMapCGSharedPtr m_locToGlobalMap
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
map< string, vector< string > > m_inputfiles
boost::shared_ptr< ContField3D > ContField3DSharedPtr
boost::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
vector< LibUtilities::FieldDefinitionsSharedPtr > m_fielddef
LibUtilities::PtsFieldSharedPtr m_fieldPts
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
Abstraction of a one-dimensional multi-elemental expansion which is merely a collection of local expa...
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
Describes the specification for a Basis.
FIELD_UTILS_EXPORT Field()