35 #ifndef FIELDUTILS_FIELD 36 #define FIELDUTILS_FIELD 79 std::vector<LibUtilities::FieldDefinitionsSharedPtr>
m_fielddef;
80 std::vector<std::vector<double> >
m_data;
81 std::vector<MultiRegions::ExpListSharedPtr>
m_exp;
107 int NumHomogeneousDir,
bool fldfilegiven =
false)
113 int expdim = m_graph->GetMeshDimension();
114 bool dealiasing =
false;
116 m_session->MatchSolverInfo(
"USEFFT",
"FFTW", m_useFFT,
false);
123 "Quasi-3D approach is only set up for 1 or 2 " 124 "homogeneous directions");
126 if (NumHomogeneousDir == 1)
137 nplanes = m_fielddef[0]->m_numModes[1];
138 ly = m_fielddef[0]->m_homogeneousLengths[0];
139 btype = m_fielddef[0]->m_basis[1];
143 m_session->LoadParameter(
"HomModesZ", nplanes);
144 m_session->LoadParameter(
"LY", ly);
155 if (m_declareExpansionAsContField ||
156 m_declareExpansionAsDisContField)
158 ASSERTL0(
false,
"ContField2DHomogeneous1D or " 159 "DisContField2DHomogenenous1D has " 160 "not been implemented");
170 else if (NumHomogeneousDir == 2)
174 int nylines, nzlines;
180 nylines = m_fielddef[0]->m_numModes[1];
181 nzlines = m_fielddef[0]->m_numModes[2];
182 ly = m_fielddef[0]->m_homogeneousLengths[0];
183 lz = m_fielddef[0]->m_homogeneousLengths[1];
184 btype1 = m_fielddef[0]->m_basis[1];
185 btype2 = m_fielddef[0]->m_basis[2];
189 m_session->LoadParameter(
"HomModesY", nylines);
190 m_session->LoadParameter(
"HomModesZ", nzlines);
191 m_session->LoadParameter(
"LY", ly);
192 m_session->LoadParameter(
"LZ", lz);
207 if (m_declareExpansionAsContField)
211 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
212 m_useFFT, dealiasing, m_graph,
213 m_session->GetVariable(0),
216 else if (m_declareExpansionAsDisContField)
220 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
221 m_useFFT, dealiasing, m_graph,
222 m_session->GetVariable(0),
229 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
230 m_useFFT, dealiasing, m_graph,
240 if (m_declareExpansionAsContField)
244 m_session->GetVariable(0),
247 else if (m_declareExpansionAsDisContField)
251 m_session->GetVariable(0),
270 "NumHomogeneousDir is only set up for 1");
272 if (NumHomogeneousDir == 1)
285 nplanes = m_fielddef[0]->m_numModes[2];
286 lz = m_fielddef[0]->m_homogeneousLengths[0];
287 btype = m_fielddef[0]->m_basis[2];
292 m_fielddef[0]->m_basis[2] =
307 m_session->LoadParameter(
"HomModesZ", nplanes);
308 m_session->LoadParameter(
"LZ", lz);
319 if (m_declareExpansionAsContField)
323 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
325 m_session->GetVariable(0),
328 else if (m_declareExpansionAsDisContField)
332 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
334 m_session->GetVariable(0),
341 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
352 if (m_declareExpansionAsContField)
356 m_session->GetVariable(0),
360 else if (m_declareExpansionAsDisContField)
364 m_session->GetVariable(0),
385 if (m_declareExpansionAsContField)
389 m_session->GetVariable(0),
393 else if (m_declareExpansionAsDisContField)
397 m_session->GetVariable(0),
415 ASSERTL0(
false,
"Expansion dimension not recognised");
434 std::string filename)
438 auto it =
m_fld.find(fmt);
440 if (it ==
m_fld.end())
454 int NumHomogeneousDir,
455 std::string var =
"DefaultVar",
456 bool NewField =
false)
460 if (m_session->GetVariables().size())
462 var = m_session->GetVariables()[0];
466 switch (m_graph->GetMeshDimension())
470 if (NumHomogeneousDir == 1)
472 ASSERTL0(!(m_declareExpansionAsContField ||
473 m_declareExpansionAsDisContField),
474 "ContField2DHomogeneous1D or " 475 "DisContField2DHomogenenous1D has not been " 479 std::dynamic_pointer_cast<
485 else if (NumHomogeneousDir == 2)
487 if (m_declareExpansionAsContField)
490 std::dynamic_pointer_cast<
496 AllocateSharedPtr(*tmp2);
498 else if (m_declareExpansionAsDisContField)
501 tmp2 = std::dynamic_pointer_cast<
507 AllocateSharedPtr(*tmp2);
512 std::dynamic_pointer_cast<
517 AllocateSharedPtr(*tmp2);
522 if (m_declareExpansionAsContField)
525 std::dynamic_pointer_cast<
531 else if (m_declareExpansionAsDisContField)
534 std::dynamic_pointer_cast<
543 std::dynamic_pointer_cast<
554 if (NumHomogeneousDir == 1)
556 if (m_declareExpansionAsContField)
560 bool dealiasing =
false;
566 ->GetHomogeneousBasis()
568 m_exp[0]->GetHomoLen(), m_useFFT,
569 dealiasing, m_graph, var);
574 tmp2 = std::dynamic_pointer_cast<
578 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
581 AllocateSharedPtr(*tmp2, m_graph, var);
584 else if (m_declareExpansionAsDisContField)
588 bool dealiasing =
false;
594 ->GetHomogeneousBasis()
596 m_exp[0]->GetHomoLen(), m_useFFT,
597 dealiasing, m_graph, var);
602 tmp2 = std::dynamic_pointer_cast<
605 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
609 AllocateSharedPtr(*tmp2);
616 bool dealiasing =
false;
622 ->GetHomogeneousBasis()
624 m_exp[0]->GetHomoLen(), m_useFFT,
625 dealiasing, m_graph);
630 std::dynamic_pointer_cast<
633 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
637 AllocateSharedPtr(*tmp2);
643 if (m_declareExpansionAsContField)
654 std::dynamic_pointer_cast<
661 else if (m_declareExpansionAsDisContField)
671 std::dynamic_pointer_cast<
681 std::dynamic_pointer_cast<
692 if (m_declareExpansionAsContField)
702 std::dynamic_pointer_cast<
709 else if (m_declareExpansionAsDisContField)
719 std::dynamic_pointer_cast<
738 ASSERTL0(
false,
"Expansion dimension not recognised");
751 m_fielddef = std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
752 m_data = std::vector<std::vector<NekDouble> > ();
759 std::map<std::string, LibUtilities::FieldIOSharedPtr>
m_fld;
LibUtilities::CommSharedPtr m_comm
std::shared_ptr< DisContField2D > DisContField2DSharedPtr
bool m_requireBoundaryExpansion
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr SetUpFirstExpList(int NumHomogeneousDir, bool fldfilegiven=false)
#define ASSERTL0(condition, msg)
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::shared_ptr< DisContField3DHomogeneous1D > DisContField3DHomogeneous1DSharedPtr
std::vector< std::string > m_variables
std::shared_ptr< ContField1D > ContField1DSharedPtr
std::shared_ptr< DisContField3D > DisContField3DSharedPtr
FIELD_UTILS_EXPORT ~Field()
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
bool m_declareExpansionAsDisContField
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
std::shared_ptr< ContField3DHomogeneous2D > ContField3DHomogeneous2DSharedPtr
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr AppendExpList(int NumHomogeneousDir, std::string var="DefaultVar", bool NewField=false)
std::map< std::string, LibUtilities::FieldIOSharedPtr > m_fld
Map to store FieldIO instances. Key is the reader type, value is the FieldIO object.
std::shared_ptr< ContField2D > ContField2DSharedPtr
LibUtilities::SessionReaderSharedPtr m_session
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
std::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
std::shared_ptr< Field > FieldSharedPtr
std::vector< std::vector< double > > m_data
std::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
std::map< std::string, std::string > FieldMetaDataMap
SpatialDomains::MeshGraphSharedPtr m_graph
bool m_declareExpansionAsContField
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
1D Evenly-spaced points using Lagrange polynomial
std::vector< unsigned int > m_bndRegionsToWrite
std::shared_ptr< ContField3D > ContField3DSharedPtr
std::vector< LibUtilities::FieldDefinitionsSharedPtr > m_fielddef
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
1D Evenly-spaced points using Fourier Fit
std::shared_ptr< ExpList2DHomogeneous1D > ExpList2DHomogeneous1DSharedPtr
Shared pointer to an ExpList2DHomogeneous1D object.
std::shared_ptr< PtsField > PtsFieldSharedPtr
Fourier Modified expansions with just the real part of the first mode .
FIELD_UTILS_EXPORT void ClearField()
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...
static const std::string GetFileType(const std::string &filename, CommSharedPtr comm)
Determine file type of given input file.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
FIELD_UTILS_EXPORT LibUtilities::FieldIOSharedPtr FieldIOForFile(std::string filename)
Construct a FieldIO object for the file filename.
Defines a specification for a set of points.
std::shared_ptr< DisContField3DHomogeneous2D > DisContField3DHomogeneous2DSharedPtr
std::vector< MultiRegions::ExpListSharedPtr > m_exp
static PtsFieldSharedPtr NullPtsField
std::shared_ptr< DisContField1D > DisContField1DSharedPtr
#define FIELD_UTILS_EXPORT
Fourier ModifiedExpansion with just the first mode .
std::shared_ptr< ExpList3D > ExpList3DSharedPtr
Shared pointer to an ExpList3D object.
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...
std::map< std::string, std::vector< std::string > > m_inputfiles
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
std::shared_ptr< FieldIO > FieldIOSharedPtr
LibUtilities::PtsFieldSharedPtr m_fieldPts
std::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
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...
std::shared_ptr< ContField3DHomogeneous1D > ContField3DHomogeneous1DSharedPtr
Describes the specification for a Basis.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList3DHomogeneous2D > ExpList3DHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
FIELD_UTILS_EXPORT Field()