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");
180 dealiasing, m_graph);
183 else if (NumHomogeneousDir == 2)
187 int nylines, nzlines;
193 nylines = m_fielddef[0]->m_numModes[1];
194 nzlines = m_fielddef[0]->m_numModes[2];
195 ly = m_fielddef[0]->m_homogeneousLengths[0];
196 lz = m_fielddef[0]->m_homogeneousLengths[1];
197 btype1 = m_fielddef[0]->m_basis[1];
198 btype2 = m_fielddef[0]->m_basis[2];
202 m_session->LoadParameter(
"HomModesY", nylines);
203 m_session->LoadParameter(
"HomModesZ", nzlines);
204 m_session->LoadParameter(
"LY", ly);
205 m_session->LoadParameter(
"LZ", lz);
220 if (m_declareExpansionAsContField)
224 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
225 m_useFFT, dealiasing, m_graph,
226 m_session->GetVariable(0));
228 else if (m_declareExpansionAsDisContField)
232 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
233 m_useFFT, dealiasing, m_graph,
234 m_session->GetVariable(0));
240 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
241 m_useFFT, dealiasing, m_graph);
250 if (m_declareExpansionAsContField)
254 m_session->GetVariable(0));
256 else if (m_declareExpansionAsDisContField)
260 m_session->GetVariable(0));
275 "NumHomogeneousDir is only set up for 1");
277 if (NumHomogeneousDir == 1)
290 nplanes = m_fielddef[0]->m_numModes[2];
291 lz = m_fielddef[0]->m_homogeneousLengths[0];
292 btype = m_fielddef[0]->m_basis[2];
297 m_fielddef[0]->m_basis[2] =
312 m_session->LoadParameter(
"HomModesZ", nplanes);
313 m_session->LoadParameter(
"LZ", lz);
324 if (m_declareExpansionAsContField)
328 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
330 m_session->GetVariable(0));
332 else if (m_declareExpansionAsDisContField)
336 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
338 m_session->GetVariable(0));
344 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
345 dealiasing, m_graph);
353 if (m_declareExpansionAsContField)
357 m_session->GetVariable(0));
359 else if (m_declareExpansionAsDisContField)
363 m_session->GetVariable(0));
379 if (m_declareExpansionAsContField)
383 m_session->GetVariable(0));
385 else if (m_declareExpansionAsDisContField)
389 m_session->GetVariable(0));
402 ASSERTL0(
false,
"Expansion dimension not recognised");
425 string fmt = LibUtilities::FieldIO::GetFileType(filename, c);
429 if (it == m_fld.end())
443 int NumHomogeneousDir,
string var =
"DefaultVar",
bool NewField =
false)
445 if (var.compare(
"DefaultVar") == 0 && m_requireBoundaryExpansion)
447 if (m_session->GetVariables().size())
449 var = m_session->GetVariables()[0];
453 switch (m_graph->GetMeshDimension())
457 if (NumHomogeneousDir == 1)
459 ASSERTL0(!(m_declareExpansionAsContField ||
460 m_declareExpansionAsDisContField),
461 "ContField2DHomogeneous1D or "
462 "DisContField2DHomogenenous1D has not been "
466 boost::dynamic_pointer_cast<
472 else if (NumHomogeneousDir == 2)
474 if (m_declareExpansionAsContField)
477 boost::dynamic_pointer_cast<
483 AllocateSharedPtr(*tmp2);
485 else if (m_declareExpansionAsDisContField)
488 tmp2 = boost::dynamic_pointer_cast<
494 AllocateSharedPtr(*tmp2);
499 boost::dynamic_pointer_cast<
504 AllocateSharedPtr(*tmp2);
509 if (m_declareExpansionAsContField)
512 boost::dynamic_pointer_cast<
518 else if (m_declareExpansionAsDisContField)
521 boost::dynamic_pointer_cast<
530 boost::dynamic_pointer_cast<
541 if (NumHomogeneousDir == 1)
543 if (m_declareExpansionAsContField)
547 bool dealiasing =
false;
553 ->GetHomogeneousBasis()
555 m_exp[0]->GetHomoLen(), m_useFFT,
556 dealiasing, m_graph, var);
561 tmp2 = boost::dynamic_pointer_cast<
565 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
568 AllocateSharedPtr(*tmp2, m_graph, var);
571 else if (m_declareExpansionAsDisContField)
575 bool dealiasing =
false;
581 ->GetHomogeneousBasis()
583 m_exp[0]->GetHomoLen(), m_useFFT,
584 dealiasing, m_graph, var);
589 tmp2 = boost::dynamic_pointer_cast<
592 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
596 AllocateSharedPtr(*tmp2);
603 bool dealiasing =
false;
609 ->GetHomogeneousBasis()
611 m_exp[0]->GetHomoLen(), m_useFFT,
612 dealiasing, m_graph);
617 boost::dynamic_pointer_cast<
620 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
624 AllocateSharedPtr(*tmp2);
630 if (m_declareExpansionAsContField)
641 boost::dynamic_pointer_cast<
648 else if (m_declareExpansionAsDisContField)
658 boost::dynamic_pointer_cast<
668 boost::dynamic_pointer_cast<
679 if (m_declareExpansionAsContField)
689 boost::dynamic_pointer_cast<
695 m_locToGlobalMap = tmp2->GetLocalToGlobalMap();
698 else if (m_declareExpansionAsDisContField)
708 boost::dynamic_pointer_cast<
727 ASSERTL0(
false,
"Expansion dimension not recognised");
737 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()