Nektar++
Public Member Functions | Public Attributes | Private Attributes | List of all members
Nektar::FieldUtils::Field Struct Reference

#include <Field.hpp>

Public Member Functions

FIELD_UTILS_EXPORT Field ()
 
FIELD_UTILS_EXPORT ~Field ()
 
FIELD_UTILS_EXPORT void SetUpExp (boost::program_options::variables_map &vm)
 
FIELD_UTILS_EXPORT void CreateExp (boost::program_options::variables_map &vm, bool newExp)
 
FIELD_UTILS_EXPORT void ReadFieldDefs ()
 
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr SetUpFirstExpList (int NumHomogeneousDir, bool fldfilegiven=false)
 
FIELD_UTILS_EXPORT LibUtilities::FieldIOSharedPtr FieldIOForFile (std::string filename)
 Construct a FieldIO object for the file filename. More...
 
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr AppendExpList (int NumHomogeneousDir, std::string var="DefaultVar", bool NewField=false)
 
FIELD_UTILS_EXPORT void ClearField ()
 
FIELD_UTILS_EXPORT void SetupFromExpList (Array< OneD, MultiRegions::ExpListSharedPtr > &exp)
 

Public Attributes

bool m_verbose
 
std::vector< LibUtilities::FieldDefinitionsSharedPtrm_fielddef
 
std::vector< std::vector< double > > m_data
 
std::vector< MultiRegions::ExpListSharedPtrm_exp
 
std::vector< std::string > m_variables
 
int m_numHomogeneousDir
 
bool m_declareExpansionAsContField
 
bool m_declareExpansionAsDisContField
 
bool m_requireBoundaryExpansion
 
bool m_useFFT
 
LibUtilities::CommSharedPtr m_comm
 
LibUtilities::CommSharedPtr m_defComm
 
LibUtilities::CommSharedPtr m_partComm
 
int m_nParts = 1
 
po::variables_map m_vm
 
LibUtilities::SessionReaderSharedPtr m_session
 
SpatialDomains::MeshGraphSharedPtr m_graph
 
std::map< std::string, std::vector< std::string > > m_inputfiles
 
bool m_writeBndFld
 
std::vector< unsigned int > m_bndRegionsToWrite
 
bool m_addNormals
 
LibUtilities::PtsFieldSharedPtr m_fieldPts
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 

Private Attributes

std::map< std::string, LibUtilities::FieldIOSharedPtrm_fld
 Map to store FieldIO instances. Key is the reader type, value is the FieldIO object. More...
 

Detailed Description

Definition at line 60 of file Field.hpp.

Constructor & Destructor Documentation

◆ Field()

FIELD_UTILS_EXPORT Nektar::FieldUtils::Field::Field ( )
inline

Definition at line 62 of file Field.hpp.

67 {
68 }
static PtsFieldSharedPtr NullPtsField
Definition: PtsField.h:185
bool m_declareExpansionAsDisContField
Definition: Field.hpp:87
bool m_declareExpansionAsContField
Definition: Field.hpp:86
LibUtilities::PtsFieldSharedPtr m_fieldPts
Definition: Field.hpp:107

◆ ~Field()

FIELD_UTILS_EXPORT Nektar::FieldUtils::Field::~Field ( )
inline

Definition at line 70 of file Field.hpp.

71 {
72 if (m_comm)
73 {
74 m_comm->Finalise();
75 }
76 }
LibUtilities::CommSharedPtr m_comm
Definition: Field.hpp:93

References m_comm.

Member Function Documentation

◆ AppendExpList()

FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr Nektar::FieldUtils::Field::AppendExpList ( int  NumHomogeneousDir,
std::string  var = "DefaultVar",
bool  NewField = false 
)
inline

Definition at line 675 of file Field.hpp.

678 {
679 if (var.compare("DefaultVar") == 0 && m_requireBoundaryExpansion)
680 {
681 if (m_session->GetVariables().size())
682 {
683 var = m_session->GetVariables()[0];
684 }
685 }
687 switch (m_graph->GetMeshDimension())
688 {
689 case 1:
690 {
691 if (NumHomogeneousDir == 1)
692 {
695 "ContFieldHomogeneous1D or "
696 "DisContFieldHomogenenous1D has not been "
697 "implemented");
698
700 std::dynamic_pointer_cast<
701 MultiRegions::ExpList2DHomogeneous1D>(m_exp[0]);
702
704 AllocateSharedPtr(*tmp2);
705 }
706 else if (NumHomogeneousDir == 2)
707 {
709 {
711 std::dynamic_pointer_cast<
712 MultiRegions::ContField3DHomogeneous2D>(
713 m_exp[0]);
714
715 tmp = MemoryManager<
716 MultiRegions::ContField3DHomogeneous2D>::
717 AllocateSharedPtr(*tmp2);
718 }
720 {
722 tmp2 = std::dynamic_pointer_cast<
723 MultiRegions::DisContField3DHomogeneous2D>(
724 m_exp[0]);
725
726 tmp = MemoryManager<
727 MultiRegions::DisContField3DHomogeneous2D>::
728 AllocateSharedPtr(*tmp2);
729 }
730 else
731 {
733 std::dynamic_pointer_cast<
734 MultiRegions::ExpList3DHomogeneous2D>(m_exp[0]);
735
736 tmp = MemoryManager<
737 MultiRegions::ExpList3DHomogeneous2D>::
738 AllocateSharedPtr(*tmp2);
739 }
740 }
741 else
742 {
744 {
746 std::dynamic_pointer_cast<MultiRegions::ContField>(
747 m_exp[0]);
748
751 false,
753 }
755 {
757 std::dynamic_pointer_cast<
758 MultiRegions::DisContField>(m_exp[0]);
759
763 }
764 else
765 {
767 std::dynamic_pointer_cast<MultiRegions::ExpList>(
768 m_exp[0]);
769
770 tmp = MemoryManager<
771 MultiRegions::ExpList>::AllocateSharedPtr(*tmp2);
772 }
773 }
774 }
775 break;
776 case 2:
777 {
778 if (NumHomogeneousDir == 1)
779 {
781 {
782 if (NewField)
783 {
784 bool dealiasing = false;
785
786 tmp = MemoryManager<
787 MultiRegions::ContField3DHomogeneous1D>::
788 AllocateSharedPtr(m_session,
789 m_exp[0]
790 ->GetHomogeneousBasis()
791 ->GetBasisKey(),
792 m_exp[0]->GetHomoLen(),
793 m_useFFT, dealiasing, m_graph,
794 var,
796 }
797 else
798 {
800 tmp2 = std::dynamic_pointer_cast<
801 MultiRegions::ContField3DHomogeneous1D>(
802 m_exp[0]);
803
804 ASSERTL0(tmp2, "Failed to type cast m_exp[0]");
805 tmp = MemoryManager<
806 MultiRegions::ContField3DHomogeneous1D>::
807 AllocateSharedPtr(*tmp2, m_graph, var);
808 }
809 }
811 {
812 if (NewField)
813 {
814 bool dealiasing = false;
815
816 tmp = MemoryManager<
817 MultiRegions::DisContField3DHomogeneous1D>::
818 AllocateSharedPtr(m_session,
819 m_exp[0]
820 ->GetHomogeneousBasis()
821 ->GetBasisKey(),
822 m_exp[0]->GetHomoLen(),
823 m_useFFT, dealiasing, m_graph,
824 var,
826 }
827 else
828 {
830 tmp2 = std::dynamic_pointer_cast<
831 MultiRegions::DisContField3DHomogeneous1D>(
832 m_exp[0]);
833 ASSERTL0(tmp2, "Failed to type cast m_exp[0]");
834
835 tmp = MemoryManager<
836 MultiRegions::DisContField3DHomogeneous1D>::
837 AllocateSharedPtr(*tmp2);
838 }
839 }
840 else
841 {
842 if (NewField)
843 {
844 bool dealiasing = false;
845
846 tmp = MemoryManager<
847 MultiRegions::ExpList3DHomogeneous1D>::
848 AllocateSharedPtr(m_session,
849 m_exp[0]
850 ->GetHomogeneousBasis()
851 ->GetBasisKey(),
852 m_exp[0]->GetHomoLen(),
853 m_useFFT, dealiasing, m_graph,
854 "DefaultVar",
856 }
857 else
858 {
860 std::dynamic_pointer_cast<
861 MultiRegions::ExpList3DHomogeneous1D>(
862 m_exp[0]);
863 ASSERTL0(tmp2, "Failed to type cast m_exp[0]");
864
865 tmp = MemoryManager<
866 MultiRegions::ExpList3DHomogeneous1D>::
867 AllocateSharedPtr(*tmp2);
868 }
869 }
870 }
871 else
872 {
874 {
875 if (NewField)
876 {
879 false,
881 }
882 else // call copy constructor
883 {
884
886 std::dynamic_pointer_cast<
887 MultiRegions::ContField>(m_exp[0]);
888
890 AllocateSharedPtr(*tmp2, m_graph, var);
891 }
892 }
894 {
895 if (NewField)
896 {
899 true,
901 }
902 else // call copy constructor
903 {
905 std::dynamic_pointer_cast<
906 MultiRegions::DisContField>(m_exp[0]);
907
909 AllocateSharedPtr(*tmp2, m_graph, var);
910 }
911 }
912 else
913 {
915 std::dynamic_pointer_cast<MultiRegions::ExpList>(
916 m_exp[0]);
917
918 tmp = MemoryManager<
919 MultiRegions::ExpList>::AllocateSharedPtr(*tmp2);
920 }
921 }
922 }
923 break;
924 case 3:
925 {
927 {
928 if (NewField)
929 {
932 false,
934 }
935 else
936 {
938 std::dynamic_pointer_cast<MultiRegions::ContField>(
939 m_exp[0]);
940
941 tmp = MemoryManager<
942 MultiRegions::ContField>::AllocateSharedPtr(*tmp2,
943 m_graph,
944 var);
945 }
946 }
948 {
949 if (NewField)
950 {
954 }
955 else
956 {
958 std::dynamic_pointer_cast<
959 MultiRegions::DisContField>(m_exp[0]);
960
962 AllocateSharedPtr(*tmp2, m_graph, var);
963 }
964 }
965 else
966 {
968 std::dynamic_pointer_cast<MultiRegions::ExpList>(
969 m_exp[0]);
970
971 tmp =
973 *tmp2);
974 }
975 }
976 break;
977 default:
978 ASSERTL0(false, "Expansion dimension not recognised");
979 break;
980 }
981
982 return tmp;
983 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< DisContField3DHomogeneous2D > DisContField3DHomogeneous2DSharedPtr
std::shared_ptr< DisContField3DHomogeneous1D > DisContField3DHomogeneous1DSharedPtr
std::shared_ptr< DisContField > DisContFieldSharedPtr
Definition: DisContField.h:346
std::shared_ptr< ContField3DHomogeneous2D > ContField3DHomogeneous2DSharedPtr
std::shared_ptr< ContField3DHomogeneous1D > ContField3DHomogeneous1DSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< ExpList2DHomogeneous1D > ExpList2DHomogeneous1DSharedPtr
Shared pointer to an ExpList2DHomogeneous1D object.
std::shared_ptr< ExpList3DHomogeneous2D > ExpList3DHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
std::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
std::shared_ptr< ContField > ContFieldSharedPtr
Definition: ContField.h:268
SpatialDomains::MeshGraphSharedPtr m_graph
Definition: Field.hpp:100
LibUtilities::SessionReaderSharedPtr m_session
Definition: Field.hpp:99
std::vector< MultiRegions::ExpListSharedPtr > m_exp
Definition: Field.hpp:80

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::Collections::eNoCollection, m_declareExpansionAsContField, m_declareExpansionAsDisContField, m_exp, m_graph, m_requireBoundaryExpansion, m_session, and m_useFFT.

Referenced by CreateExp().

◆ ClearField()

FIELD_UTILS_EXPORT void Nektar::FieldUtils::Field::ClearField ( )
inline

Definition at line 985 of file Field.hpp.

986 {
990 m_exp.clear();
991 m_fielddef = std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
992 m_data = std::vector<std::vector<NekDouble>>();
993 m_variables.clear();
994 }
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::vector< std::string > m_variables
Definition: Field.hpp:82
std::vector< LibUtilities::FieldDefinitionsSharedPtr > m_fielddef
Definition: Field.hpp:78
std::vector< std::vector< double > > m_data
Definition: Field.hpp:79

References m_data, m_exp, m_fielddef, m_fieldPts, m_graph, m_session, m_variables, and Nektar::LibUtilities::NullPtsField.

Referenced by SetupFromExpList().

◆ CreateExp()

FIELD_UTILS_EXPORT void Nektar::FieldUtils::Field::CreateExp ( boost::program_options::variables_map &  vm,
bool  newExp 
)
inline

Definition at line 123 of file Field.hpp.

125 {
126
127 bool fldfilegiven = (m_fielddef.size() != 0);
128 if (newExp)
129 {
130 LibUtilities::Timer timerpart;
131 if (m_verbose)
132 {
133 if (m_comm->TreatAsRankZero())
134 {
135 timerpart.Start();
136 }
137 }
138 // check to see if fld file defined so can use in
139 // expansion defintion if required
140
141 bool expFromFld =
142 fldfilegiven && !vm.count("use-session-expansion");
143
144 // load fielddef header if fld file is defined. This gives
145 // precedence to Homogeneous definition in fld file
147 if (expFromFld)
148 {
149 m_numHomogeneousDir = m_fielddef[0]->m_numHomogeneousDir;
150
151 // Set up Expansion information to use mode order from field
152 m_graph->SetExpansionInfo(m_fielddef);
153 }
154 else
155 {
156 if (m_session->DefinesSolverInfo("HOMOGENEOUS"))
157 {
158 std::string HomoStr =
159 m_session->GetSolverInfo("HOMOGENEOUS");
160
161 if ((HomoStr == "HOMOGENEOUS1D") ||
162 (HomoStr == "Homogeneous1D") || (HomoStr == "1D") ||
163 (HomoStr == "Homo1D"))
164 {
166 }
167 if ((HomoStr == "HOMOGENEOUS2D") ||
168 (HomoStr == "Homogeneous2D") || (HomoStr == "2D") ||
169 (HomoStr == "Homo2D"))
170 {
172 }
173 }
174 }
175
176 m_exp.resize(1);
177 // Check if there are any elements to process
178 std::vector<int> IDs;
179 auto domain = m_graph->GetDomain();
180 for (size_t d = 0; d < domain.size(); ++d)
181 {
182 for (auto &compIter : domain[d])
183 {
184 for (auto &x : compIter.second->m_geomVec)
185 {
186 IDs.push_back(x->GetGlobalID());
187 }
188 }
189 }
190 // if Range has been specified it is possible to have a
191 // partition which is empty so check this and return with empty
192 // expansion if no elements present.
193 if (!IDs.size())
194 {
195 m_exp[0] =
197
198 return;
199 }
200
201 // Adjust number of quadrature points
202 if (vm.count("output-points"))
203 {
204 int nPointsNew = vm["output-points"].as<int>();
205 m_graph->SetExpansionInfoToPointOrder(nPointsNew);
206 }
207
208 if (m_verbose)
209 {
210 if (m_comm->TreatAsRankZero())
211 {
212 timerpart.Stop();
213 NekDouble cpuTime = timerpart.TimePerTest(1);
214
215 std::stringstream ss;
216 ss << cpuTime << "s";
217 std::cout << "\t CreateExp setexpansion CPU Time: "
218 << std::setw(8) << std::left << ss.str()
219 << std::endl;
220 timerpart.Start();
221 }
222 }
223 // Override number of planes with value from cmd line
224 if (m_numHomogeneousDir == 1 && vm.count("output-points-hom-z"))
225 {
226 int expdim = m_graph->GetMeshDimension();
227 m_fielddef[0]->m_numModes[expdim] =
228 vm["output-points-hom-z"].as<int>();
229 }
231 if (m_verbose)
232 {
233 if (m_comm->TreatAsRankZero())
234 {
235 timerpart.Stop();
236 NekDouble cpuTime = timerpart.TimePerTest(1);
237
238 std::stringstream ss1;
239
240 ss1 << cpuTime << "s";
241 std::cout << "\t CreateExp set first exp CPU Time: "
242 << std::setw(8) << std::left << ss1.str()
243 << std::endl;
244 }
245 }
246 }
247
248 if (fldfilegiven)
249 {
250 size_t i, nfields, nstrips;
251 m_session->LoadParameter("Strip_Z", nstrips, 1);
252 std::vector<std::string> vars = m_session->GetVariables();
253
254 if (vm.count("use-session-variables"))
255 {
256 m_variables = vars;
257 }
258 nfields = m_variables.size();
259
260 m_exp.resize(nfields * nstrips);
261 // declare other fields;
262 for (size_t s = 0; s < nstrips; ++s) // homogeneous strip varient
263 {
264 for (i = 0; i < nfields; ++i)
265 {
266 if (i < vars.size())
267 {
268 // check to see if field already defined
269 if (!m_exp[s * nfields + i])
270 {
271 m_exp[s * nfields + i] =
273 }
274 }
275 else
276 {
277 if (vars.size())
278 {
279 m_exp[s * nfields + i] =
281 }
282 else
283 {
284 m_exp[s * nfields + i] =
286 }
287 }
288 }
289 }
290
292 }
293 }
std::vector< double > d(NPUPPER *NPUPPER)
double NekDouble
FIELD_UTILS_EXPORT void ReadFieldDefs()
Definition: Field.hpp:295
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr SetUpFirstExpList(int NumHomogeneousDir, bool fldfilegiven=false)
Definition: Field.hpp:335
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr AppendExpList(int NumHomogeneousDir, std::string var="DefaultVar", bool NewField=false)
Definition: Field.hpp:675

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), AppendExpList(), Nektar::UnitTests::d(), m_comm, m_exp, m_fielddef, m_graph, m_numHomogeneousDir, m_session, m_variables, m_verbose, ReadFieldDefs(), SetUpFirstExpList(), Nektar::LibUtilities::Timer::Start(), Nektar::LibUtilities::Timer::Stop(), and Nektar::LibUtilities::Timer::TimePerTest().

Referenced by SetUpExp().

◆ FieldIOForFile()

FIELD_UTILS_EXPORT LibUtilities::FieldIOSharedPtr Nektar::FieldUtils::Field::FieldIOForFile ( std::string  filename)
inline

Construct a FieldIO object for the file filename.

This routine constructs an appropriate FieldIO object for a filename through the LibUtilities::FieldIO::GetFileType function to detect the file format. The result is then cached in Field::m_fld to avoid needing to repeatedly construct the object.

Parameters
filenameFilename to open.
Returns
Reader for filename.

Definition at line 654 of file Field.hpp.

656 {
658 std::string fmt = LibUtilities::FieldIO::GetFileType(filename, c);
659
660 auto it = m_fld.find(fmt);
661
662 if (it == m_fld.end())
663 {
666 m_fld[fmt] = fld;
667 return fld;
668 }
669 else
670 {
671 return it->second;
672 }
673 }
static const std::string GetFileType(const std::string &filename, CommSharedPtr comm)
Determine file type of given input file.
Definition: FieldIO.cpp:95
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
std::shared_ptr< FieldIO > FieldIOSharedPtr
Definition: FieldIO.h:322
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
Definition: FieldIO.cpp:70
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
std::map< std::string, LibUtilities::FieldIOSharedPtr > m_fld
Map to store FieldIO instances. Key is the reader type, value is the FieldIO object.
Definition: Field.hpp:1023

References Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::LibUtilities::GetFieldIOFactory(), Nektar::LibUtilities::FieldIO::GetFileType(), m_comm, and m_fld.

◆ ReadFieldDefs()

FIELD_UTILS_EXPORT void Nektar::FieldUtils::Field::ReadFieldDefs ( )
inline

Definition at line 295 of file Field.hpp.

296 {
297 size_t i, j, nfields, nstrips;
298 m_session->LoadParameter("Strip_Z", nstrips, 1);
299 std::vector<std::string> vars = m_session->GetVariables();
300
301 nfields = m_variables.size();
302
303 // Extract data to coeffs and bwd transform
304 for (size_t s = 0; s < nstrips; ++s) // homogeneous strip varient
305 {
306 for (j = 0; j < nfields; ++j)
307 {
308 for (i = 0; i < m_data.size() / nstrips; ++i)
309 {
310 size_t n = i * nstrips + s;
311 // In case of multiple flds, we might not have a
312 // variable in this m_data[n] -> skip in this case
313 auto it =
314 find(m_fielddef[n]->m_fields.begin(),
315 m_fielddef[n]->m_fields.end(), m_variables[j]);
316 if (it != m_fielddef[n]->m_fields.end())
317 {
318 m_exp[s * nfields + j]->ExtractDataToCoeffs(
319 m_fielddef[n], m_data[n], m_variables[j],
320 m_exp[s * nfields + j]->UpdateCoeffs());
321 }
322 }
323 m_exp[s * nfields + j]->BwdTrans(
324 m_exp[s * nfields + j]->GetCoeffs(),
325 m_exp[s * nfields + j]->UpdatePhys());
326 }
327 }
328
329 // Clear fielddef and data
330 // (they should not be used after running this module)
331 m_fielddef = std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
332 m_data = std::vector<std::vector<NekDouble>>();
333 }
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:475

References Nektar::StdRegions::find(), m_data, m_exp, m_fielddef, m_session, and m_variables.

Referenced by CreateExp().

◆ SetUpExp()

FIELD_UTILS_EXPORT void Nektar::FieldUtils::Field::SetUpExp ( boost::program_options::variables_map &  vm)
inline

Definition at line 111 of file Field.hpp.

112 {
113 if (m_graph && !m_exp.size())
114 {
115 CreateExp(vm, true);
116 }
117 else if (m_graph && m_data.size())
118 {
119 CreateExp(vm, false);
120 }
121 }
FIELD_UTILS_EXPORT void CreateExp(boost::program_options::variables_map &vm, bool newExp)
Definition: Field.hpp:123

References CreateExp(), m_data, m_exp, and m_graph.

◆ SetUpFirstExpList()

FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr Nektar::FieldUtils::Field::SetUpFirstExpList ( int  NumHomogeneousDir,
bool  fldfilegiven = false 
)
inline

Definition at line 335 of file Field.hpp.

337 {
338
340
341 // Set up expansion list
342 int expdim = m_graph->GetMeshDimension();
343 bool dealiasing = false;
344
345 m_session->MatchSolverInfo("USEFFT", "FFTW", m_useFFT, false);
346
347 switch (expdim)
348 {
349 case 1:
350 {
351 ASSERTL0(NumHomogeneousDir <= 2,
352 "Quasi-3D approach is only set up for 1 or 2 "
353 "homogeneous directions");
354
355 if (NumHomogeneousDir == 1)
356 {
358
359 // Define Homogeneous expansion
360 int nplanes;
361 NekDouble ly;
363
364 if (fldfilegiven)
365 {
366 nplanes = m_fielddef[0]->m_numModes[1];
367 ly = m_fielddef[0]->m_homogeneousLengths[0];
368 btype = m_fielddef[0]->m_basis[1];
369 }
370 else
371 {
372 m_session->LoadParameter("HomModesZ", nplanes);
373 m_session->LoadParameter("LY", ly);
375 }
376
377 // Choose points to be at evenly spaced points at
378 // nplanes points
379 const LibUtilities::PointsKey Pkey(
381
382 const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
383
386 {
387 ASSERTL0(false, "ContFieldHomogeneous1D or "
388 "DisContFieldHomogenenous1D has "
389 "not been implemented");
390 }
391
392 Exp2DH1 =
395 dealiasing, m_graph,
397 exp = Exp2DH1;
398 }
399 else if (NumHomogeneousDir == 2)
400 {
402
403 int nylines, nzlines;
404 NekDouble ly, lz;
405 LibUtilities::BasisType btype1, btype2;
406
407 if (fldfilegiven)
408 {
409 nylines = m_fielddef[0]->m_numModes[1];
410 nzlines = m_fielddef[0]->m_numModes[2];
411 ly = m_fielddef[0]->m_homogeneousLengths[0];
412 lz = m_fielddef[0]->m_homogeneousLengths[1];
413 btype1 = m_fielddef[0]->m_basis[1];
414 btype2 = m_fielddef[0]->m_basis[2];
415 }
416 else
417 {
418 m_session->LoadParameter("HomModesY", nylines);
419 m_session->LoadParameter("HomModesZ", nzlines);
420 m_session->LoadParameter("LY", ly);
421 m_session->LoadParameter("LZ", lz);
422 btype1 = LibUtilities::eFourier;
423 btype2 = LibUtilities::eFourier;
424 }
425
426 // Choose points to be at evenly spaced points at
427 // nplanes points
428 const LibUtilities::PointsKey PkeyY(
430 const LibUtilities::BasisKey BkeyY(btype1, nylines, PkeyY);
431
432 const LibUtilities::PointsKey PkeyZ(
434 const LibUtilities::BasisKey BkeyZ(btype2, nzlines, PkeyZ);
435
437 {
438 Exp3DH2 = MemoryManager<
439 MultiRegions::ContField3DHomogeneous2D>::
440 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
441 m_useFFT, dealiasing, m_graph,
442 m_session->GetVariable(0),
444 }
446 {
447 Exp3DH2 = MemoryManager<
448 MultiRegions::DisContField3DHomogeneous2D>::
449 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
450 m_useFFT, dealiasing, m_graph,
451 m_session->GetVariable(0),
453 }
454 else
455 {
456 Exp3DH2 = MemoryManager<
457 MultiRegions::ExpList3DHomogeneous2D>::
458 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
459 m_useFFT, dealiasing, m_graph,
461 }
462
463 exp = Exp3DH2;
464 }
465 else
466 {
468
470 {
473 m_session, m_graph, m_session->GetVariable(0),
474 true, false, Collections::eNoCollection);
475 }
477 {
480 m_session->GetVariable(0), true,
482 }
483 else
484 {
487 "DefaultVar",
489 }
490
491 exp = Exp1D;
492 }
493 }
494 break;
495 case 2:
496 {
497 ASSERTL0(NumHomogeneousDir <= 1,
498 "NumHomogeneousDir is only set up for 1");
499
500 if (NumHomogeneousDir == 1)
501 {
503
504 // Define Homogeneous expansion
505 int nplanes;
506 NekDouble lz;
510
511 if (fldfilegiven)
512 {
513 nplanes = m_fielddef[0]->m_numModes[2];
514 lz = m_fielddef[0]->m_homogeneousLengths[0];
515 btype = m_fielddef[0]->m_basis[2];
516
518 {
520 m_fielddef[0]->m_basis[2] =
522 if (nplanes <= 2)
523 {
524 nplanes = 4;
525 }
526 }
527 else if (btype == LibUtilities::eFourierHalfModeRe &&
528 nplanes == 1)
529 {
531 }
532 }
533 else
534 {
535 m_session->LoadParameter("HomModesZ", nplanes);
536 m_session->LoadParameter("LZ", lz);
538 }
539 // Choose points to be at evenly spaced points at
540 // nplanes points
541 const LibUtilities::PointsKey Pkey(nplanes, ptype);
542
543 const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
544
546 {
547 Exp3DH1 = MemoryManager<
548 MultiRegions::ContField3DHomogeneous1D>::
549 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
550 dealiasing, m_graph,
551 m_session->GetVariable(0),
553 }
554
556 {
557 Exp3DH1 = MemoryManager<
558 MultiRegions::DisContField3DHomogeneous1D>::
559 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
560 dealiasing, m_graph,
561 m_session->GetVariable(0),
563 }
564
565 else
566 {
567 Exp3DH1 = MemoryManager<
568 MultiRegions::ExpList3DHomogeneous1D>::
569 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
570 dealiasing, m_graph, "DefaultVar",
572 }
573 exp = Exp3DH1;
574 }
575 else
576 {
578
580 {
583 m_session, m_graph, m_session->GetVariable(0),
584 true, false, Collections::eNoCollection);
585 }
586
588 {
591 m_session->GetVariable(0), true,
593 }
594 else
595 {
598 "DefaultVar",
600 }
601
602 exp = Exp2D;
603 }
604 }
605 break;
606 case 3:
607 {
609
611 {
614 m_session->GetVariable(0), true,
616 }
618 {
621 m_session->GetVariable(0), true,
623 }
624 else
625 {
626 Exp3D =
628 m_session, m_graph, true, "DefaultVar",
630 }
631
632 exp = Exp3D;
633 }
634 break;
635 default:
636 ASSERTL0(false, "Expansion dimension not recognised");
637 break;
638 }
639
640 return exp;
641 };
@ eFourierEvenlySpaced
1D Evenly-spaced points using Fourier Fit
Definition: PointsType.h:74
@ ePolyEvenlySpaced
1D Evenly-spaced points using Lagrange polynomial
Definition: PointsType.h:73
@ eFourierSingleMode
Fourier ModifiedExpansion with just the first mode .
Definition: BasisType.h:64
@ eFourierHalfModeRe
Fourier Modified expansions with just the real part of the first mode .
Definition: BasisType.h:66
@ eFourier
Fourier Expansion .
Definition: BasisType.h:55

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::LibUtilities::eFourier, Nektar::LibUtilities::eFourierEvenlySpaced, Nektar::LibUtilities::eFourierHalfModeRe, Nektar::LibUtilities::eFourierSingleMode, Nektar::Collections::eNoCollection, Nektar::LibUtilities::ePolyEvenlySpaced, m_declareExpansionAsContField, m_declareExpansionAsDisContField, m_fielddef, m_graph, m_session, and m_useFFT.

Referenced by CreateExp().

◆ SetupFromExpList()

FIELD_UTILS_EXPORT void Nektar::FieldUtils::Field::SetupFromExpList ( Array< OneD, MultiRegions::ExpListSharedPtr > &  exp)
inline

Definition at line 996 of file Field.hpp.

998 {
999 ClearField();
1000
1001 m_exp.resize(exp.size());
1002 m_variables.resize(exp.size());
1003
1004 if (exp.size() == 0)
1005 {
1006 return;
1007 }
1008
1009 m_session = exp[0]->GetSession();
1010 m_graph = exp[0]->GetGraph();
1011 m_comm = m_session->GetComm();
1012
1013 for (int i = 0; i < exp.size(); ++i)
1014 {
1015 m_exp[i] = exp[i];
1016 m_variables[i] = m_session->GetVariable(i);
1017 }
1018 }
FIELD_UTILS_EXPORT void ClearField()
Definition: Field.hpp:985

References ClearField(), m_comm, m_exp, m_graph, m_session, and m_variables.

Member Data Documentation

◆ m_addNormals

bool Nektar::FieldUtils::Field::m_addNormals

Definition at line 105 of file Field.hpp.

◆ m_bndRegionsToWrite

std::vector<unsigned int> Nektar::FieldUtils::Field::m_bndRegionsToWrite

Definition at line 104 of file Field.hpp.

◆ m_comm

LibUtilities::CommSharedPtr Nektar::FieldUtils::Field::m_comm

Definition at line 93 of file Field.hpp.

Referenced by CreateExp(), FieldIOForFile(), SetupFromExpList(), and ~Field().

◆ m_data

std::vector<std::vector<double> > Nektar::FieldUtils::Field::m_data

Definition at line 79 of file Field.hpp.

Referenced by ClearField(), ReadFieldDefs(), and SetUpExp().

◆ m_declareExpansionAsContField

bool Nektar::FieldUtils::Field::m_declareExpansionAsContField

Definition at line 86 of file Field.hpp.

Referenced by AppendExpList(), and SetUpFirstExpList().

◆ m_declareExpansionAsDisContField

bool Nektar::FieldUtils::Field::m_declareExpansionAsDisContField

Definition at line 87 of file Field.hpp.

Referenced by AppendExpList(), and SetUpFirstExpList().

◆ m_defComm

LibUtilities::CommSharedPtr Nektar::FieldUtils::Field::m_defComm

Definition at line 94 of file Field.hpp.

◆ m_exp

std::vector<MultiRegions::ExpListSharedPtr> Nektar::FieldUtils::Field::m_exp

◆ m_fielddef

std::vector<LibUtilities::FieldDefinitionsSharedPtr> Nektar::FieldUtils::Field::m_fielddef

Definition at line 78 of file Field.hpp.

Referenced by ClearField(), CreateExp(), ReadFieldDefs(), and SetUpFirstExpList().

◆ m_fieldMetaDataMap

LibUtilities::FieldMetaDataMap Nektar::FieldUtils::Field::m_fieldMetaDataMap

Definition at line 109 of file Field.hpp.

◆ m_fieldPts

LibUtilities::PtsFieldSharedPtr Nektar::FieldUtils::Field::m_fieldPts

Definition at line 107 of file Field.hpp.

Referenced by ClearField().

◆ m_fld

std::map<std::string, LibUtilities::FieldIOSharedPtr> Nektar::FieldUtils::Field::m_fld
private

Map to store FieldIO instances. Key is the reader type, value is the FieldIO object.

Definition at line 1023 of file Field.hpp.

Referenced by FieldIOForFile().

◆ m_graph

SpatialDomains::MeshGraphSharedPtr Nektar::FieldUtils::Field::m_graph

◆ m_inputfiles

std::map<std::string, std::vector<std::string> > Nektar::FieldUtils::Field::m_inputfiles

Definition at line 101 of file Field.hpp.

◆ m_nParts

int Nektar::FieldUtils::Field::m_nParts = 1

Definition at line 96 of file Field.hpp.

◆ m_numHomogeneousDir

int Nektar::FieldUtils::Field::m_numHomogeneousDir

Definition at line 84 of file Field.hpp.

Referenced by CreateExp().

◆ m_partComm

LibUtilities::CommSharedPtr Nektar::FieldUtils::Field::m_partComm

Definition at line 95 of file Field.hpp.

◆ m_requireBoundaryExpansion

bool Nektar::FieldUtils::Field::m_requireBoundaryExpansion

Definition at line 89 of file Field.hpp.

Referenced by AppendExpList().

◆ m_session

LibUtilities::SessionReaderSharedPtr Nektar::FieldUtils::Field::m_session

◆ m_useFFT

bool Nektar::FieldUtils::Field::m_useFFT

Definition at line 91 of file Field.hpp.

Referenced by AppendExpList(), and SetUpFirstExpList().

◆ m_variables

std::vector<std::string> Nektar::FieldUtils::Field::m_variables

Definition at line 82 of file Field.hpp.

Referenced by ClearField(), CreateExp(), ReadFieldDefs(), and SetupFromExpList().

◆ m_verbose

bool Nektar::FieldUtils::Field::m_verbose

Definition at line 77 of file Field.hpp.

Referenced by CreateExp().

◆ m_vm

po::variables_map Nektar::FieldUtils::Field::m_vm

Definition at line 97 of file Field.hpp.

◆ m_writeBndFld

bool Nektar::FieldUtils::Field::m_writeBndFld

Definition at line 103 of file Field.hpp.