Nektar++
Loading...
Searching...
No Matches
FieldUtils/Field.hpp
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: Field.hpp
4//
5// For more information, please see: http://www.nektar.info/
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Field converter module base classes.
32//
33////////////////////////////////////////////////////////////////////////////////
34
35#ifndef FIELDUTILS_FIELD
36#define FIELDUTILS_FIELD
37
44#include <boost/program_options.hpp>
45#include <iomanip>
46#include <memory>
47
52
53#include "FieldUtilsDeclspec.h"
54
55namespace po = boost::program_options;
56
58{
59
60struct Field
61{
69
71
73 std::vector<LibUtilities::FieldDefinitionsSharedPtr> m_fielddef;
74 std::vector<std::vector<double>> m_data;
75 std::vector<MultiRegions::ExpListSharedPtr> m_exp;
76
77 std::vector<std::string> m_variables;
78
80
83
85
87
91 int m_nParts = 1;
92 po::variables_map m_vm;
93
96 std::map<std::string, std::vector<std::string>> m_inputfiles;
97
99 std::vector<unsigned int> m_bndRegionsToWrite;
101
103
105
106 FIELD_UTILS_EXPORT void SetUpExp(boost::program_options::variables_map &vm,
107 bool equispaced = false)
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 }
118
119 FIELD_UTILS_EXPORT void CreateExp(boost::program_options::variables_map &vm,
120 bool newExp, bool equispaced = false)
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
263 // If no session file was given the session holds no variable
264 // list, in which case every field below would be built from
265 // the "DefaultVar" expansion. That default belongs to whatever
266 // expansion the mesh file happened to declare first, so it can
267 // easily disagree in order or basis with the data actually
268 // being read. Prefer the field file's own variable list so
269 // each field uses the expansion declared for it there.
270 if (vars.empty() && !vm.count("use-session-expansion"))
271 {
272 vars = m_variables;
273 }
274
275 nfields = m_variables.size();
276
277 m_exp.resize(nfields * nstrips);
278 // declare other fields;
279 for (size_t s = 0; s < nstrips; ++s) // homogeneous strip varient
280 {
281 for (i = 0; i < nfields; ++i)
282 {
283 if (i < vars.size())
284 {
285 // check to see if field already defined
286 if (!m_exp[s * nfields + i])
287 {
288 m_exp[s * nfields + i] =
290 }
291 }
292 else
293 {
294 if (vars.size())
295 {
296 m_exp[s * nfields + i] =
298 }
299 else
300 {
301 m_exp[s * nfields + i] =
303 }
304 }
305 }
306 }
307
309 }
310 }
311
313 {
314 size_t i, j, nfields, nstrips;
315 m_session->LoadParameter("Strip_Z", nstrips, 1);
316 std::vector<std::string> vars = m_session->GetVariables();
317
318 nfields = m_variables.size();
319
320 // Extract data to coeffs and bwd transform
321 for (size_t s = 0; s < nstrips; ++s) // homogeneous strip varient
322 {
323 for (j = 0; j < nfields; ++j)
324 {
325 for (i = 0; i < m_data.size() / nstrips; ++i)
326 {
327 size_t n = i * nstrips + s;
328 // In case of multiple flds, we might not have a
329 // variable in this m_data[n] -> skip in this case
330 auto it =
331 find(m_fielddef[n]->m_fields.begin(),
332 m_fielddef[n]->m_fields.end(), m_variables[j]);
333 if (it != m_fielddef[n]->m_fields.end())
334 {
335 m_exp[s * nfields + j]->ExtractDataToCoeffs(
336 m_fielddef[n], m_data[n], m_variables[j],
337 m_exp[s * nfields + j]->UpdateCoeffs());
338 }
339 }
340 m_exp[s * nfields + j]->BwdTrans(
341 m_exp[s * nfields + j]->GetCoeffs(),
342 m_exp[s * nfields + j]->UpdatePhys());
343 }
344 }
345
346 // Clear fielddef and data
347 // (they should not be used after running this module)
348 m_fielddef = std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
349 m_data = std::vector<std::vector<NekDouble>>();
350 }
351
352 /**
353 * Name of the variable whose expansion to use where no particular
354 * variable has been asked for.
355 *
356 * The graph's "DefaultVar" is claimed by whichever expansion the mesh
357 * file declared first, which need not have anything to do with the data
358 * being read - a mesh carrying an old FIELDS="u" expansion will hand
359 * back that expansion for a field file holding rho, rhou, rhov, E. So
360 * when the expansions are being taken from a field file, prefer that
361 * file's own first variable.
362 */
363 FIELD_UTILS_EXPORT std::string GetDefaultVar(bool fldfilegiven)
364 {
365 if (fldfilegiven && m_variables.size())
366 {
367 return m_variables[0];
368 }
369
370 return "DefaultVar";
371 }
372
374 int NumHomogeneousDir, bool fldfilegiven = false)
375 {
376
378 std::string defaultVar = GetDefaultVar(fldfilegiven);
379
380 // Set up expansion list
381 int expdim = m_graph->GetMeshDimension();
382 bool dealiasing = false;
383
384 m_session->MatchSolverInfo("USEFFT", "FFTW", m_useFFT, false);
385
386 switch (expdim)
387 {
388 case 1:
389 {
390 ASSERTL0(NumHomogeneousDir <= 2,
391 "Quasi-3D approach is only set up for 1 or 2 "
392 "homogeneous directions");
393
394 if (NumHomogeneousDir == 1)
395 {
397
398 // Define Homogeneous expansion
399 int nplanes;
400 NekDouble ly;
402
403 if (fldfilegiven)
404 {
405 nplanes = m_fielddef[0]->m_numModes[1];
406 ly = m_fielddef[0]->m_homogeneousLengths[0];
407 btype = m_fielddef[0]->m_basis[1];
408 }
409 else
410 {
411 m_session->LoadParameter("HomModesZ", nplanes);
412 m_session->LoadParameter("LY", ly);
414 }
415
416 // Choose points to be at evenly spaced points at
417 // nplanes points
418 const LibUtilities::PointsKey Pkey(
420
421 const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
422
425 {
426 ASSERTL0(false, "ContFieldHomogeneous1D or "
427 "DisContFieldHomogenenous1D has "
428 "not been implemented");
429 }
430
431 Exp2DH1 =
434 dealiasing, m_graph,
436 exp = Exp2DH1;
437 }
438 else if (NumHomogeneousDir == 2)
439 {
441
442 int nylines, nzlines;
443 NekDouble ly, lz;
444 LibUtilities::BasisType btype1, btype2;
445
446 if (fldfilegiven)
447 {
448 nylines = m_fielddef[0]->m_numModes[1];
449 nzlines = m_fielddef[0]->m_numModes[2];
450 ly = m_fielddef[0]->m_homogeneousLengths[0];
451 lz = m_fielddef[0]->m_homogeneousLengths[1];
452 btype1 = m_fielddef[0]->m_basis[1];
453 btype2 = m_fielddef[0]->m_basis[2];
454 }
455 else
456 {
457 m_session->LoadParameter("HomModesY", nylines);
458 m_session->LoadParameter("HomModesZ", nzlines);
459 m_session->LoadParameter("LY", ly);
460 m_session->LoadParameter("LZ", lz);
461 btype1 = LibUtilities::eFourier;
462 btype2 = LibUtilities::eFourier;
463 }
464
465 // Choose points to be at evenly spaced points at
466 // nplanes points
467 const LibUtilities::PointsKey PkeyY(
469 const LibUtilities::BasisKey BkeyY(btype1, nylines, PkeyY);
470
471 const LibUtilities::PointsKey PkeyZ(
473 const LibUtilities::BasisKey BkeyZ(btype2, nzlines, PkeyZ);
474
476 {
477 Exp3DH2 = MemoryManager<
479 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
480 m_useFFT, dealiasing, m_graph,
481 m_session->GetVariable(0),
483 }
485 {
486 Exp3DH2 = MemoryManager<
488 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
489 m_useFFT, dealiasing, m_graph,
490 m_session->GetVariable(0),
492 }
493 else
494 {
495 Exp3DH2 = MemoryManager<
497 AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
498 m_useFFT, dealiasing, m_graph,
500 }
501
502 exp = Exp3DH2;
503 }
504 else
505 {
507
509 {
512 m_session, m_graph, m_session->GetVariable(0),
513 true, false, Collections::eNoCollection);
514 }
516 {
519 m_session->GetVariable(0), true,
521 }
522 else
523 {
526 defaultVar,
528 }
529
530 exp = Exp1D;
531 }
532 }
533 break;
534 case 2:
535 {
536 ASSERTL0(NumHomogeneousDir <= 1,
537 "NumHomogeneousDir is only set up for 1");
538
539 if (NumHomogeneousDir == 1)
540 {
542
543 // Define Homogeneous expansion
544 int nplanes;
545 NekDouble lz;
549
550 if (fldfilegiven)
551 {
552 nplanes = m_fielddef[0]->m_numModes[2];
553 lz = m_fielddef[0]->m_homogeneousLengths[0];
554 btype = m_fielddef[0]->m_basis[2];
555
557 {
559 m_fielddef[0]->m_basis[2] =
561 if (nplanes <= 2)
562 {
563 nplanes = 4;
564 }
565 }
566 else if (btype == LibUtilities::eFourierHalfModeRe &&
567 nplanes == 1)
568 {
570 }
571 }
572 else
573 {
574 m_session->LoadParameter("HomModesZ", nplanes);
575 m_session->LoadParameter("LZ", lz);
577 }
578 // Choose points to be at evenly spaced points at
579 // nplanes points
580 const LibUtilities::PointsKey Pkey(nplanes, ptype);
581
582 const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
583
585 {
586 Exp3DH1 = MemoryManager<
588 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
589 dealiasing, m_graph,
590 m_session->GetVariable(0),
592 }
593
595 {
596 Exp3DH1 = MemoryManager<
598 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
599 dealiasing, m_graph,
600 m_session->GetVariable(0),
602 }
603
604 else
605 {
606 Exp3DH1 = MemoryManager<
608 AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
609 dealiasing, m_graph, defaultVar,
611 }
612 exp = Exp3DH1;
613 }
614 else
615 {
617
619 {
622 m_session, m_graph, m_session->GetVariable(0),
623 true, false, Collections::eNoCollection);
624 }
625
627 {
630 m_session->GetVariable(0), true,
632 }
633 else
634 {
637 defaultVar,
639 }
640
641 exp = Exp2D;
642 }
643 }
644 break;
645 case 3:
646 {
648
650 {
653 m_session->GetVariable(0), true,
655 }
657 {
660 m_session->GetVariable(0), true,
662 }
663 else
664 {
665 Exp3D =
667 m_session, m_graph, true, defaultVar,
669 }
670
671 exp = Exp3D;
672 }
673 break;
674 default:
675 ASSERTL0(false, "Expansion dimension not recognised");
676 break;
677 }
678
679 return exp;
680 };
681
682 /**
683 * @brief Construct a FieldIO object for the file @p filename.
684 *
685 * This routine constructs an appropriate FieldIO object for a filename
686 * through the LibUtilities::FieldIO::GetFileType function to detect the
687 * file format. The result is then cached in Field::m_fld to avoid needing
688 * to repeatedly construct the object.
689 *
690 * @param filename Filename to open.
691 * @return Reader for @p filename.
692 */
694 std::string filename)
695 {
697 std::string fmt = LibUtilities::FieldIO::GetFileType(filename, c);
698
699 auto it = m_fld.find(fmt);
700
701 if (it == m_fld.end())
702 {
705 m_fld[fmt] = fld;
706 return fld;
707 }
708 else
709 {
710 return it->second;
711 }
712 }
713
715 int NumHomogeneousDir, std::string var = "DefaultVar",
716 bool NewField = false)
717 {
718 if (var == "DefaultVar" && m_requireBoundaryExpansion)
719 {
720 if (m_session->GetVariables().size())
721 {
722 var = m_session->GetVariables()[0];
723 }
724 }
726 switch (m_graph->GetMeshDimension())
727 {
728 case 1:
729 {
730 if (NumHomogeneousDir == 1)
731 {
734 "ContFieldHomogeneous1D or "
735 "DisContFieldHomogenenous1D has not been "
736 "implemented");
737
739 std::dynamic_pointer_cast<
741
743 AllocateSharedPtr(*tmp2);
744 }
745 else if (NumHomogeneousDir == 2)
746 {
748 {
750 std::dynamic_pointer_cast<
752 m_exp[0]);
753
754 tmp = MemoryManager<
756 AllocateSharedPtr(*tmp2);
757 }
759 {
761 tmp2 = std::dynamic_pointer_cast<
763 m_exp[0]);
764
765 tmp = MemoryManager<
767 AllocateSharedPtr(*tmp2);
768 }
769 else
770 {
772 std::dynamic_pointer_cast<
774
775 tmp = MemoryManager<
777 AllocateSharedPtr(*tmp2);
778 }
779 }
780 else
781 {
783 {
785 std::dynamic_pointer_cast<MultiRegions::ContField>(
786 m_exp[0]);
787
790 false,
792 }
794 {
796 std::dynamic_pointer_cast<
798
802 }
803 else
804 {
806 std::dynamic_pointer_cast<MultiRegions::ExpList>(
807 m_exp[0]);
808
809 tmp = MemoryManager<
810 MultiRegions::ExpList>::AllocateSharedPtr(*tmp2);
811 }
812 }
813 }
814 break;
815 case 2:
816 {
817 if (NumHomogeneousDir == 1)
818 {
820 {
821 if (NewField)
822 {
823 bool dealiasing = false;
824
825 tmp = MemoryManager<
827 AllocateSharedPtr(m_session,
828 m_exp[0]
829 ->GetHomogeneousBasis()
830 ->GetBasisKey(),
831 m_exp[0]->GetHomoLen(),
832 m_useFFT, dealiasing, m_graph,
833 var,
835 }
836 else
837 {
839 tmp2 = std::dynamic_pointer_cast<
841 m_exp[0]);
842
843 ASSERTL0(tmp2, "Failed to type cast m_exp[0]");
844 tmp = MemoryManager<
846 AllocateSharedPtr(*tmp2, m_graph, var);
847 }
848 }
850 {
851 if (NewField)
852 {
853 bool dealiasing = false;
854
855 tmp = MemoryManager<
857 AllocateSharedPtr(m_session,
858 m_exp[0]
859 ->GetHomogeneousBasis()
860 ->GetBasisKey(),
861 m_exp[0]->GetHomoLen(),
862 m_useFFT, dealiasing, m_graph,
863 var,
865 }
866 else
867 {
869 tmp2 = std::dynamic_pointer_cast<
871 m_exp[0]);
872 ASSERTL0(tmp2, "Failed to type cast m_exp[0]");
873
874 tmp = MemoryManager<
876 AllocateSharedPtr(*tmp2);
877 }
878 }
879 else
880 {
881 if (NewField)
882 {
883 bool dealiasing = false;
884
885 tmp = MemoryManager<
887 AllocateSharedPtr(m_session,
888 m_exp[0]
889 ->GetHomogeneousBasis()
890 ->GetBasisKey(),
891 m_exp[0]->GetHomoLen(),
892 m_useFFT, dealiasing, m_graph,
893 "DefaultVar",
895 }
896 else
897 {
899 std::dynamic_pointer_cast<
901 m_exp[0]);
902 ASSERTL0(tmp2, "Failed to type cast m_exp[0]");
903
904 tmp = MemoryManager<
906 AllocateSharedPtr(*tmp2);
907 }
908 }
909 }
910 else
911 {
913 {
914 if (NewField)
915 {
918 false,
920 }
921 else // call copy constructor
922 {
923
925 std::dynamic_pointer_cast<
927
929 AllocateSharedPtr(*tmp2, m_graph, var);
930 }
931 }
933 {
934 if (NewField)
935 {
938 true,
940 }
941 else // call copy constructor
942 {
944 std::dynamic_pointer_cast<
946
948 AllocateSharedPtr(*tmp2, m_graph, var);
949 }
950 }
951 else
952 {
954 std::dynamic_pointer_cast<MultiRegions::ExpList>(
955 m_exp[0]);
956
957 tmp = MemoryManager<
958 MultiRegions::ExpList>::AllocateSharedPtr(*tmp2);
959 }
960 }
961 }
962 break;
963 case 3:
964 {
966 {
967 if (NewField)
968 {
971 false,
973 }
974 else
975 {
977 std::dynamic_pointer_cast<MultiRegions::ContField>(
978 m_exp[0]);
979
980 tmp = MemoryManager<
981 MultiRegions::ContField>::AllocateSharedPtr(*tmp2,
982 m_graph,
983 var);
984 }
985 }
987 {
988 if (NewField)
989 {
993 }
994 else
995 {
997 std::dynamic_pointer_cast<
999
1001 AllocateSharedPtr(*tmp2, m_graph, var);
1002 }
1003 }
1004 else
1005 {
1007 std::dynamic_pointer_cast<MultiRegions::ExpList>(
1008 m_exp[0]);
1009
1010 tmp =
1012 *tmp2);
1013 }
1014 }
1015 break;
1016 default:
1017 ASSERTL0(false, "Expansion dimension not recognised");
1018 break;
1019 }
1020
1021 return tmp;
1022 }
1023
1025 {
1029 m_exp.clear();
1030 m_fielddef = std::vector<LibUtilities::FieldDefinitionsSharedPtr>();
1031 m_data = std::vector<std::vector<NekDouble>>();
1032 m_variables.clear();
1033 }
1034
1037 {
1038 ClearField();
1039
1040 m_exp.resize(exp.size());
1041 m_variables.resize(exp.size());
1042
1043 if (exp.size() == 0)
1044 {
1045 return;
1046 }
1047
1048 m_session = exp[0]->GetSession();
1049 m_graph = exp[0]->GetGraph();
1050 m_comm = m_session->GetComm();
1051
1052 for (int i = 0; i < exp.size(); ++i)
1053 {
1054 m_exp[i] = exp[i];
1055 m_variables[i] = m_session->GetVariable(i);
1056 }
1057 }
1058
1059private:
1060 /// Map to store FieldIO instances. Key is the reader type, value is the
1061 /// FieldIO object.
1062 std::map<std::string, LibUtilities::FieldIOSharedPtr> m_fld;
1063};
1064
1065typedef std::shared_ptr<Field> FieldSharedPtr;
1066} // namespace Nektar::FieldUtils
1067
1068#endif
#define ASSERTL0(condition, msg)
#define FIELD_UTILS_EXPORT
Describes the specification for a Basis.
Definition Basis.h:45
static const std::string GetFileType(const std::string &filename, CommSharedPtr comm)
Determine file type of given input file.
Definition FieldIO.cpp:94
tBasePtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Defines a specification for a set of points.
Definition Points.h:50
NekDouble TimePerTest(unsigned int n)
Returns amount of seconds per iteration in a test with n iterations.
Definition Timer.cpp:65
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
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 continuous two- dimensional spectral/hp element expansion w...
Definition ContField.h:60
This class is the abstractio n of a global discontinuous two- dimensional spectral/hp element expansi...
Abstraction of a two-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...
Abstraction of a one-dimensional multi-elemental expansion which is merely a collection of local expa...
Base class for all multi-elemental spectral/hp expansions.
Definition ExpList.h:160
std::shared_ptr< Field > FieldSharedPtr
std::shared_ptr< FieldIO > FieldIOSharedPtr
Definition FieldIO.h:322
std::map< std::string, std::string > FieldMetaDataMap
Definition FieldIO.h:50
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< PtsField > PtsFieldSharedPtr
Definition PtsField.h:184
static PtsFieldSharedPtr NullPtsField
Definition PtsField.h:185
FieldIOFactory & GetFieldIOFactory()
Returns the FieldIO factory.
Definition FieldIO.cpp:69
@ eFourierEvenlySpaced
1D Evenly-spaced points using Fourier Fit
Definition PointsType.h:74
@ ePolyEvenlySpaced
1D Evenly-spaced points using Lagrange polynomial
Definition PointsType.h:73
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition Comm.h:62
@ 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
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:330
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition MeshGraph.h:287
FIELD_UTILS_EXPORT void SetupFromExpList(Array< OneD, MultiRegions::ExpListSharedPtr > &exp)
LibUtilities::CommSharedPtr m_partComm
FIELD_UTILS_EXPORT void ReadFieldDefs()
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr SetUpFirstExpList(int NumHomogeneousDir, bool fldfilegiven=false)
FIELD_UTILS_EXPORT MultiRegions::ExpListSharedPtr AppendExpList(int NumHomogeneousDir, std::string var="DefaultVar", bool NewField=false)
FIELD_UTILS_EXPORT ~Field()=default
SpatialDomains::MeshGraphSharedPtr m_graph
std::vector< std::string > m_variables
std::vector< unsigned int > m_bndRegionsToWrite
LibUtilities::SessionReaderSharedPtr m_session
FIELD_UTILS_EXPORT std::string GetDefaultVar(bool fldfilegiven)
std::map< std::string, LibUtilities::FieldIOSharedPtr > m_fld
Map to store FieldIO instances. Key is the reader type, value is the FieldIO object.
std::map< std::string, std::vector< std::string > > m_inputfiles
FIELD_UTILS_EXPORT Field()
FIELD_UTILS_EXPORT void SetUpExp(boost::program_options::variables_map &vm, bool equispaced=false)
FIELD_UTILS_EXPORT void ClearField()
std::vector< LibUtilities::FieldDefinitionsSharedPtr > m_fielddef
FIELD_UTILS_EXPORT void CreateExp(boost::program_options::variables_map &vm, bool newExp, bool equispaced=false)
LibUtilities::PtsFieldSharedPtr m_fieldPts
std::vector< std::vector< double > > m_data
std::vector< MultiRegions::ExpListSharedPtr > m_exp
LibUtilities::CommSharedPtr m_comm
LibUtilities::CommSharedPtr m_defComm
FIELD_UTILS_EXPORT LibUtilities::FieldIOSharedPtr FieldIOForFile(std::string filename)
Construct a FieldIO object for the file filename.
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap