Nektar++
Loading...
Searching...
No Matches
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 ()=default
 
FIELD_UTILS_EXPORT void SetUpExp (boost::program_options::variables_map &vm, bool equispaced=false)
 
FIELD_UTILS_EXPORT void CreateExp (boost::program_options::variables_map &vm, bool newExp, bool equispaced=false)
 
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.
 
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 = nullptr
 
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.
 

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:82
LibUtilities::PtsFieldSharedPtr m_fieldPts
Definition Field.hpp:102

◆ ~Field()

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

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 679 of file Field.hpp.

682 {
683 if (var.compare("DefaultVar") == 0 && m_requireBoundaryExpansion)
684 {
685 if (m_session->GetVariables().size())
686 {
687 var = m_session->GetVariables()[0];
688 }
689 }
691 switch (m_graph->GetMeshDimension())
692 {
693 case 1:
694 {
695 if (NumHomogeneousDir == 1)
696 {
699 "ContFieldHomogeneous1D or "
700 "DisContFieldHomogenenous1D has not been "
701 "implemented");
702
704 std::dynamic_pointer_cast<
705 MultiRegions::ExpList2DHomogeneous1D>(m_exp[0]);
706
708 AllocateSharedPtr(*tmp2);
709 }
710 else if (NumHomogeneousDir == 2)
711 {
713 {
715 std::dynamic_pointer_cast<
716 MultiRegions::ContField3DHomogeneous2D>(
717 m_exp[0]);
718
719 tmp = MemoryManager<
720 MultiRegions::ContField3DHomogeneous2D>::
721 AllocateSharedPtr(*tmp2);
722 }
724 {
726 tmp2 = std::dynamic_pointer_cast<
727 MultiRegions::DisContField3DHomogeneous2D>(
728 m_exp[0]);
729
730 tmp = MemoryManager<
731 MultiRegions::DisContField3DHomogeneous2D>::
732 AllocateSharedPtr(*tmp2);
733 }
734 else
735 {
737 std::dynamic_pointer_cast<
738 MultiRegions::ExpList3DHomogeneous2D>(m_exp[0]);
739
740 tmp = MemoryManager<
741 MultiRegions::ExpList3DHomogeneous2D>::
742 AllocateSharedPtr(*tmp2);
743 }
744 }
745 else
746 {
748 {
750 std::dynamic_pointer_cast<MultiRegions::ContField>(
751 m_exp[0]);
752
755 false,
757 }
759 {
761 std::dynamic_pointer_cast<
762 MultiRegions::DisContField>(m_exp[0]);
763
767 }
768 else
769 {
771 std::dynamic_pointer_cast<MultiRegions::ExpList>(
772 m_exp[0]);
773
774 tmp = MemoryManager<
775 MultiRegions::ExpList>::AllocateSharedPtr(*tmp2);
776 }
777 }
778 }
779 break;
780 case 2:
781 {
782 if (NumHomogeneousDir == 1)
783 {
785 {
786 if (NewField)
787 {
788 bool dealiasing = false;
789
790 tmp = MemoryManager<
791 MultiRegions::ContField3DHomogeneous1D>::
792 AllocateSharedPtr(m_session,
793 m_exp[0]
794 ->GetHomogeneousBasis()
795 ->GetBasisKey(),
796 m_exp[0]->GetHomoLen(),
797 m_useFFT, dealiasing, m_graph,
798 var,
800 }
801 else
802 {
804 tmp2 = std::dynamic_pointer_cast<
805 MultiRegions::ContField3DHomogeneous1D>(
806 m_exp[0]);
807
808 ASSERTL0(tmp2, "Failed to type cast m_exp[0]");
809 tmp = MemoryManager<
810 MultiRegions::ContField3DHomogeneous1D>::
811 AllocateSharedPtr(*tmp2, m_graph, var);
812 }
813 }
815 {
816 if (NewField)
817 {
818 bool dealiasing = false;
819
820 tmp = MemoryManager<
821 MultiRegions::DisContField3DHomogeneous1D>::
822 AllocateSharedPtr(m_session,
823 m_exp[0]
824 ->GetHomogeneousBasis()
825 ->GetBasisKey(),
826 m_exp[0]->GetHomoLen(),
827 m_useFFT, dealiasing, m_graph,
828 var,
830 }
831 else
832 {
834 tmp2 = std::dynamic_pointer_cast<
835 MultiRegions::DisContField3DHomogeneous1D>(
836 m_exp[0]);
837 ASSERTL0(tmp2, "Failed to type cast m_exp[0]");
838
839 tmp = MemoryManager<
840 MultiRegions::DisContField3DHomogeneous1D>::
841 AllocateSharedPtr(*tmp2);
842 }
843 }
844 else
845 {
846 if (NewField)
847 {
848 bool dealiasing = false;
849
850 tmp = MemoryManager<
851 MultiRegions::ExpList3DHomogeneous1D>::
852 AllocateSharedPtr(m_session,
853 m_exp[0]
854 ->GetHomogeneousBasis()
855 ->GetBasisKey(),
856 m_exp[0]->GetHomoLen(),
857 m_useFFT, dealiasing, m_graph,
858 "DefaultVar",
860 }
861 else
862 {
864 std::dynamic_pointer_cast<
865 MultiRegions::ExpList3DHomogeneous1D>(
866 m_exp[0]);
867 ASSERTL0(tmp2, "Failed to type cast m_exp[0]");
868
869 tmp = MemoryManager<
870 MultiRegions::ExpList3DHomogeneous1D>::
871 AllocateSharedPtr(*tmp2);
872 }
873 }
874 }
875 else
876 {
878 {
879 if (NewField)
880 {
883 false,
885 }
886 else // call copy constructor
887 {
888
890 std::dynamic_pointer_cast<
891 MultiRegions::ContField>(m_exp[0]);
892
894 AllocateSharedPtr(*tmp2, m_graph, var);
895 }
896 }
898 {
899 if (NewField)
900 {
903 true,
905 }
906 else // call copy constructor
907 {
909 std::dynamic_pointer_cast<
910 MultiRegions::DisContField>(m_exp[0]);
911
913 AllocateSharedPtr(*tmp2, m_graph, var);
914 }
915 }
916 else
917 {
919 std::dynamic_pointer_cast<MultiRegions::ExpList>(
920 m_exp[0]);
921
922 tmp = MemoryManager<
923 MultiRegions::ExpList>::AllocateSharedPtr(*tmp2);
924 }
925 }
926 }
927 break;
928 case 3:
929 {
931 {
932 if (NewField)
933 {
936 false,
938 }
939 else
940 {
942 std::dynamic_pointer_cast<MultiRegions::ContField>(
943 m_exp[0]);
944
945 tmp = MemoryManager<
946 MultiRegions::ContField>::AllocateSharedPtr(*tmp2,
947 m_graph,
948 var);
949 }
950 }
952 {
953 if (NewField)
954 {
958 }
959 else
960 {
962 std::dynamic_pointer_cast<
963 MultiRegions::DisContField>(m_exp[0]);
964
966 AllocateSharedPtr(*tmp2, m_graph, var);
967 }
968 }
969 else
970 {
972 std::dynamic_pointer_cast<MultiRegions::ExpList>(
973 m_exp[0]);
974
975 tmp =
977 *tmp2);
978 }
979 }
980 break;
981 default:
982 ASSERTL0(false, "Expansion dimension not recognised");
983 break;
984 }
985
986 return tmp;
987 }
#define ASSERTL0(condition, msg)
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
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:295
SpatialDomains::MeshGraphSharedPtr m_graph
Definition Field.hpp:95
LibUtilities::SessionReaderSharedPtr m_session
Definition Field.hpp:94
std::vector< MultiRegions::ExpListSharedPtr > m_exp
Definition Field.hpp:75

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 989 of file Field.hpp.

990 {
994 m_exp.clear();
995 m_fielddef = std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
996 m_data = std::vector<std::vector<NekDouble>>();
997 m_variables.clear();
998 }
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition MeshGraph.h:224
std::vector< std::string > m_variables
Definition Field.hpp:77
std::vector< LibUtilities::FieldDefinitionsSharedPtr > m_fielddef
Definition Field.hpp:73
std::vector< std::vector< double > > m_data
Definition Field.hpp:74

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,
bool  equispaced = false 
)
inline

Definition at line 119 of file Field.hpp.

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

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), AppendExpList(), 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 658 of file Field.hpp.

660 {
662 std::string fmt = LibUtilities::FieldIO::GetFileType(filename, c);
663
664 auto it = m_fld.find(fmt);
665
666 if (it == m_fld.end())
667 {
670 m_fld[fmt] = fld;
671 return fld;
672 }
673 else
674 {
675 return it->second;
676 }
677 }
static const std::string GetFileType(const std::string &filename, CommSharedPtr comm)
Determine file type of given input file.
Definition FieldIO.cpp:94
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:69
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:1027

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 299 of file Field.hpp.

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

References 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,
bool  equispaced = false 
)
inline

Definition at line 106 of file Field.hpp.

108 {
109 if (m_graph && !m_exp.size())
110 {
111 CreateExp(vm, true, equispaced);
112 }
113 else if (m_graph && m_data.size())
114 {
115 CreateExp(vm, false, equispaced);
116 }
117 }
FIELD_UTILS_EXPORT void CreateExp(boost::program_options::variables_map &vm, bool newExp, bool equispaced=false)
Definition Field.hpp:119

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 339 of file Field.hpp.

341 {
342
344
345 // Set up expansion list
346 int expdim = m_graph->GetMeshDimension();
347 bool dealiasing = false;
348
349 m_session->MatchSolverInfo("USEFFT", "FFTW", m_useFFT, false);
350
351 switch (expdim)
352 {
353 case 1:
354 {
355 ASSERTL0(NumHomogeneousDir <= 2,
356 "Quasi-3D approach is only set up for 1 or 2 "
357 "homogeneous directions");
358
359 if (NumHomogeneousDir == 1)
360 {
362
363 // Define Homogeneous expansion
364 int nplanes;
365 NekDouble ly;
367
368 if (fldfilegiven)
369 {
370 nplanes = m_fielddef[0]->m_numModes[1];
371 ly = m_fielddef[0]->m_homogeneousLengths[0];
372 btype = m_fielddef[0]->m_basis[1];
373 }
374 else
375 {
376 m_session->LoadParameter("HomModesZ", nplanes);
377 m_session->LoadParameter("LY", ly);
379 }
380
381 // Choose points to be at evenly spaced points at
382 // nplanes points
383 const LibUtilities::PointsKey Pkey(
385
386 const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
387
390 {
391 ASSERTL0(false, "ContFieldHomogeneous1D or "
392 "DisContFieldHomogenenous1D has "
393 "not been implemented");
394 }
395
396 Exp2DH1 =
399 dealiasing, m_graph,
401 exp = Exp2DH1;
402 }
403 else if (NumHomogeneousDir == 2)
404 {
406
407 int nylines, nzlines;
408 NekDouble ly, lz;
409 LibUtilities::BasisType btype1, btype2;
410
411 if (fldfilegiven)
412 {
413 nylines = m_fielddef[0]->m_numModes[1];
414 nzlines = m_fielddef[0]->m_numModes[2];
415 ly = m_fielddef[0]->m_homogeneousLengths[0];
416 lz = m_fielddef[0]->m_homogeneousLengths[1];
417 btype1 = m_fielddef[0]->m_basis[1];
418 btype2 = m_fielddef[0]->m_basis[2];
419 }
420 else
421 {
422 m_session->LoadParameter("HomModesY", nylines);
423 m_session->LoadParameter("HomModesZ", nzlines);
424 m_session->LoadParameter("LY", ly);
425 m_session->LoadParameter("LZ", lz);
426 btype1 = LibUtilities::eFourier;
427 btype2 = LibUtilities::eFourier;
428 }
429
430 // Choose points to be at evenly spaced points at
431 // nplanes points
432 const LibUtilities::PointsKey PkeyY(
434 const LibUtilities::BasisKey BkeyY(btype1, nylines, PkeyY);
435
436 const LibUtilities::PointsKey PkeyZ(
438 const LibUtilities::BasisKey BkeyZ(btype2, nzlines, PkeyZ);
439
441 {
442 Exp3DH2 = MemoryManager<
443 MultiRegions::ContField3DHomogeneous2D>::
444 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
445 m_useFFT, dealiasing, m_graph,
446 m_session->GetVariable(0),
448 }
450 {
451 Exp3DH2 = MemoryManager<
452 MultiRegions::DisContField3DHomogeneous2D>::
453 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
454 m_useFFT, dealiasing, m_graph,
455 m_session->GetVariable(0),
457 }
458 else
459 {
460 Exp3DH2 = MemoryManager<
461 MultiRegions::ExpList3DHomogeneous2D>::
462 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
463 m_useFFT, dealiasing, m_graph,
465 }
466
467 exp = Exp3DH2;
468 }
469 else
470 {
472
474 {
477 m_session, m_graph, m_session->GetVariable(0),
478 true, false, Collections::eNoCollection);
479 }
481 {
484 m_session->GetVariable(0), true,
486 }
487 else
488 {
491 "DefaultVar",
493 }
494
495 exp = Exp1D;
496 }
497 }
498 break;
499 case 2:
500 {
501 ASSERTL0(NumHomogeneousDir <= 1,
502 "NumHomogeneousDir is only set up for 1");
503
504 if (NumHomogeneousDir == 1)
505 {
507
508 // Define Homogeneous expansion
509 int nplanes;
510 NekDouble lz;
514
515 if (fldfilegiven)
516 {
517 nplanes = m_fielddef[0]->m_numModes[2];
518 lz = m_fielddef[0]->m_homogeneousLengths[0];
519 btype = m_fielddef[0]->m_basis[2];
520
522 {
524 m_fielddef[0]->m_basis[2] =
526 if (nplanes <= 2)
527 {
528 nplanes = 4;
529 }
530 }
531 else if (btype == LibUtilities::eFourierHalfModeRe &&
532 nplanes == 1)
533 {
535 }
536 }
537 else
538 {
539 m_session->LoadParameter("HomModesZ", nplanes);
540 m_session->LoadParameter("LZ", lz);
542 }
543 // Choose points to be at evenly spaced points at
544 // nplanes points
545 const LibUtilities::PointsKey Pkey(nplanes, ptype);
546
547 const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
548
550 {
551 Exp3DH1 = MemoryManager<
552 MultiRegions::ContField3DHomogeneous1D>::
553 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
554 dealiasing, m_graph,
555 m_session->GetVariable(0),
557 }
558
560 {
561 Exp3DH1 = MemoryManager<
562 MultiRegions::DisContField3DHomogeneous1D>::
563 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
564 dealiasing, m_graph,
565 m_session->GetVariable(0),
567 }
568
569 else
570 {
571 Exp3DH1 = MemoryManager<
572 MultiRegions::ExpList3DHomogeneous1D>::
573 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
574 dealiasing, m_graph, "DefaultVar",
576 }
577 exp = Exp3DH1;
578 }
579 else
580 {
582
584 {
587 m_session, m_graph, m_session->GetVariable(0),
588 true, false, Collections::eNoCollection);
589 }
590
592 {
595 m_session->GetVariable(0), true,
597 }
598 else
599 {
602 "DefaultVar",
604 }
605
606 exp = Exp2D;
607 }
608 }
609 break;
610 case 3:
611 {
613
615 {
618 m_session->GetVariable(0), true,
620 }
622 {
625 m_session->GetVariable(0), true,
627 }
628 else
629 {
630 Exp3D =
632 m_session, m_graph, true, "DefaultVar",
634 }
635
636 exp = Exp3D;
637 }
638 break;
639 default:
640 ASSERTL0(false, "Expansion dimension not recognised");
641 break;
642 }
643
644 return exp;
645 };
@ 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:65
@ eFourierHalfModeRe
Fourier Modified expansions with just the real part of the first mode .
Definition BasisType.h:67
@ 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 1000 of file Field.hpp.

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

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 100 of file Field.hpp.

◆ m_bndRegionsToWrite

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

Definition at line 99 of file Field.hpp.

◆ m_comm

LibUtilities::CommSharedPtr Nektar::FieldUtils::Field::m_comm = nullptr

Definition at line 88 of file Field.hpp.

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

◆ m_data

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

Definition at line 74 of file Field.hpp.

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

◆ m_declareExpansionAsContField

bool Nektar::FieldUtils::Field::m_declareExpansionAsContField

Definition at line 81 of file Field.hpp.

Referenced by AppendExpList(), and SetUpFirstExpList().

◆ m_declareExpansionAsDisContField

bool Nektar::FieldUtils::Field::m_declareExpansionAsDisContField

Definition at line 82 of file Field.hpp.

Referenced by AppendExpList(), and SetUpFirstExpList().

◆ m_defComm

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

Definition at line 89 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 73 of file Field.hpp.

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

◆ m_fieldMetaDataMap

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

Definition at line 104 of file Field.hpp.

◆ m_fieldPts

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

Definition at line 102 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 1027 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 96 of file Field.hpp.

◆ m_nParts

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

Definition at line 91 of file Field.hpp.

◆ m_numHomogeneousDir

int Nektar::FieldUtils::Field::m_numHomogeneousDir

Definition at line 79 of file Field.hpp.

Referenced by CreateExp().

◆ m_partComm

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

Definition at line 90 of file Field.hpp.

◆ m_requireBoundaryExpansion

bool Nektar::FieldUtils::Field::m_requireBoundaryExpansion

Definition at line 84 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 86 of file Field.hpp.

Referenced by AppendExpList(), and SetUpFirstExpList().

◆ m_variables

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

Definition at line 77 of file Field.hpp.

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

◆ m_verbose

bool Nektar::FieldUtils::Field::m_verbose

Definition at line 72 of file Field.hpp.

Referenced by CreateExp().

◆ m_vm

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

Definition at line 92 of file Field.hpp.

◆ m_writeBndFld

bool Nektar::FieldUtils::Field::m_writeBndFld

Definition at line 98 of file Field.hpp.