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

#include <Field.hpp>

Collaboration diagram for Nektar::Utilities::Field:
Collaboration graph
[legend]

Public Member Functions

 Field ()
 
 ~Field ()
 
MultiRegions::ExpListSharedPtr SetUpFirstExpList (int NumHomogeneousDir, bool fldfilegiven=false)
 
MultiRegions::ExpListSharedPtr AppendExpList (int NumHomogeneousDir, string var="DefaultVar", bool NewField=false)
 

Public Attributes

bool m_verbose
 
vector< LibUtilities::FieldDefinitionsSharedPtrm_fielddef
 
vector< vector< double > > m_data
 
vector< MultiRegions::ExpListSharedPtrm_exp
 
bool m_declareExpansionAsContField
 
bool m_declareExpansionAsDisContField
 
bool m_useFFT
 
LibUtilities::CommSharedPtr m_comm
 
LibUtilities::SessionReaderSharedPtr m_session
 
SpatialDomains::MeshGraphSharedPtr m_graph
 
LibUtilities::FieldIOSharedPtr m_fld
 
LibUtilities::PtsIOSharedPtr m_ptsIO
 
map< string, vector< string > > m_inputfiles
 
bool m_writeBndFld
 
vector< unsigned int > m_bndRegionsToWrite
 
bool m_fldToBnd
 
bool m_addNormals
 
bool m_setUpEquiSpacedFields
 
LibUtilities::PtsFieldSharedPtr m_fieldPts
 
MultiRegions::AssemblyMapCGSharedPtr m_locToGlobalMap
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 

Detailed Description

Definition at line 67 of file Field.hpp.

Constructor & Destructor Documentation

Nektar::Utilities::Field::Field ( )
inline

Definition at line 68 of file Field.hpp.

68  : m_verbose(false),
71  m_writeBndFld(false),
72  m_fldToBnd(false),
73  m_addNormals(false),
LibUtilities::PtsFieldSharedPtr m_fieldPts
Definition: Field.hpp:107
bool m_declareExpansionAsDisContField
Definition: Field.hpp:90
static PtsFieldSharedPtr NullPtsField
Definition: PtsField.h:249
bool m_declareExpansionAsContField
Definition: Field.hpp:89
Nektar::Utilities::Field::~Field ( )
inline

Definition at line 77 of file Field.hpp.

78  {
79  if (m_session)
80  {
81  m_session->Finalise();
82  }
83  }
LibUtilities::SessionReaderSharedPtr m_session
Definition: Field.hpp:95

Member Function Documentation

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

Definition at line 390 of file Field.hpp.

References ASSERTL0.

393  {
395  switch (m_graph->GetMeshDimension())
396  {
397  case 1:
398  {
399  if (NumHomogeneousDir == 1)
400  {
403  "ContField2DHomogeneous1D or "
404  "DisContField2DHomogenenous1D has not been "
405  "implemented");
406 
408  boost::dynamic_pointer_cast<MultiRegions::
410 
413  AllocateSharedPtr(*tmp2);
414 
415  }
416  else if (NumHomogeneousDir == 2)
417  {
419  {
421  boost::dynamic_pointer_cast<MultiRegions::
423 
426  AllocateSharedPtr(*tmp2);
427  }
429  {
431  boost::dynamic_pointer_cast<MultiRegions::
433 
436  AllocateSharedPtr(*tmp2);
437  }
438  else
439  {
441  boost::dynamic_pointer_cast<MultiRegions::
443 
446  AllocateSharedPtr(*tmp2);
447  }
448 
449 
450  }
451  else
452  {
454  {
456  boost::dynamic_pointer_cast<MultiRegions::
457  ContField1D>(m_exp[0]);
458 
461  }
463  {
465  boost::dynamic_pointer_cast<MultiRegions::
467 
470  }
471  else
472  {
474  boost::dynamic_pointer_cast<MultiRegions::
475  ExpList1D>(m_exp[0]);
476 
478  AllocateSharedPtr(*tmp2);
479  }
480 
481  }
482  }
483  break;
484  case 2:
485  {
486  if (NumHomogeneousDir == 1)
487  {
489  {
490  if(NewField)
491  {
492  bool dealiasing = false;
493 
495  ContField3DHomogeneous1D>::AllocateSharedPtr(
496  m_session,
497  m_exp[0]->GetHomogeneousBasis()
498  ->GetBasisKey(),
499  m_exp[0]->GetHomoLen(),
500  m_useFFT, dealiasing, m_graph, var);
501  }
502  else
503  {
505  boost::dynamic_pointer_cast<MultiRegions::
507 
508  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
511  AllocateSharedPtr(*tmp2);
512  }
513  }
515  {
516  if(NewField)
517  {
518  bool dealiasing = false;
519 
521  DisContField3DHomogeneous1D>::AllocateSharedPtr(
522  m_session,
523  m_exp[0]->GetHomogeneousBasis()
524  ->GetBasisKey(),
525  m_exp[0]->GetHomoLen(),
526  m_useFFT, dealiasing, m_graph,var);
527  }
528  else
529  {
531  boost::dynamic_pointer_cast<MultiRegions::
533  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
534 
537  AllocateSharedPtr(*tmp2);
538  }
539  }
540  else
541  {
542  if(NewField)
543  {
544  bool dealiasing = false;
545 
547  ExpList3DHomogeneous1D>::AllocateSharedPtr(
548  m_session,
549  m_exp[0]->GetHomogeneousBasis()
550  ->GetBasisKey(),
551  m_exp[0]->GetHomoLen(),
552  m_useFFT, dealiasing, m_graph);
553  }
554  else
555  {
557  boost::dynamic_pointer_cast<MultiRegions::
559  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
560 
563  AllocateSharedPtr(*tmp2);
564  }
565  }
566 
567  }
568  else
569  {
571  {
572  if(NewField)
573  {
576  }
577  else // call copy constructor
578  {
579 
581  boost::dynamic_pointer_cast<MultiRegions::
582  ContField2D>(m_exp[0]);
583 
585  AllocateSharedPtr(*tmp2,m_graph,var);
586  }
587  }
589  {
590  if(NewField)
591  {
594  }
595  else // call copy constructor
596  {
598  boost::dynamic_pointer_cast<MultiRegions::
600 
602  AllocateSharedPtr(*tmp2,m_graph,var);
603  }
604  }
605  else
606  {
608  boost::dynamic_pointer_cast<MultiRegions::
609  ExpList2D>(m_exp[0]);
610 
612  AllocateSharedPtr(*tmp2);
613  }
614  }
615  }
616  break;
617  case 3:
618  {
620  {
621  if(NewField)
622  {
625 
626  }
627  else
628  {
630  boost::dynamic_pointer_cast<MultiRegions::
631  ContField3D>(m_exp[0]);
632 
634  AllocateSharedPtr(*tmp2,m_graph,var);
635 
636  m_locToGlobalMap = tmp2->GetLocalToGlobalMap();
637  }
638  }
640  {
641  if(NewField)
642  {
645  }
646  else
647  {
649  boost::dynamic_pointer_cast<MultiRegions::
651 
653  AllocateSharedPtr(*tmp2,m_graph,var);
654  }
655  }
656  else
657  {
659  boost::dynamic_pointer_cast<MultiRegions::
660  ExpList3D>(m_exp[0]);
661 
663  AllocateSharedPtr(*tmp2);
664  }
665  }
666  break;
667  default:
668  ASSERTL0(false, "Expansion dimension not recognised");
669  break;
670  }
671 
672  return tmp;
673  }
vector< MultiRegions::ExpListSharedPtr > m_exp
Definition: Field.hpp:87
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
boost::shared_ptr< ContField1D > ContField1DSharedPtr
Definition: ContField1D.h:235
boost::shared_ptr< ContField3DHomogeneous1D > ContField3DHomogeneous1DSharedPtr
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
MultiRegions::AssemblyMapCGSharedPtr m_locToGlobalMap
Definition: Field.hpp:109
boost::shared_ptr< DisContField3DHomogeneous1D > DisContField3DHomogeneous1DSharedPtr
boost::shared_ptr< ContField2D > ContField2DSharedPtr
Definition: ContField2D.h:291
boost::shared_ptr< ExpList3DHomogeneous2D > ExpList3DHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
boost::shared_ptr< DisContField3DHomogeneous2D > DisContField3DHomogeneous2DSharedPtr
This class is the abstraction of a global continuous two- dimensional spectral/hp element expansion w...
Definition: ContField2D.h:56
Abstraction of a global continuous one-dimensional spectral/hp element expansion which approximates t...
Definition: ContField1D.h:56
boost::shared_ptr< ContField3DHomogeneous2D > ContField3DHomogeneous2DSharedPtr
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
Definition: ExpList1D.h:50
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Definition: ExpList.h:1340
bool m_declareExpansionAsDisContField
Definition: Field.hpp:90
boost::shared_ptr< DisContField2D > DisContField2DSharedPtr
This class is the abstraction of a global discontinuous two- dimensional spectral/hp element expansio...
SpatialDomains::MeshGraphSharedPtr m_graph
Definition: Field.hpp:96
boost::shared_ptr< DisContField1D > DisContField1DSharedPtr
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
Definition: ExpList2D.h:49
boost::shared_ptr< DisContField3D > DisContField3DSharedPtr
boost::shared_ptr< ExpList2DHomogeneous1D > ExpList2DHomogeneous1DSharedPtr
Shared pointer to an ExpList2DHomogeneous1D object.
boost::shared_ptr< ExpList3D > ExpList3DSharedPtr
Shared pointer to an ExpList3D object.
Definition: ExpList3D.h:110
This class is the abstraction of a one-dimensional multi-elemental expansions which is merely a colle...
Definition: ExpList1D.h:61
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
Definition: ExpList2D.h:60
Abstraction of a three-dimensional multi-elemental expansion which is merely a collection of local ex...
Definition: ExpList3D.h:49
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
bool m_declareExpansionAsContField
Definition: Field.hpp:89
LibUtilities::SessionReaderSharedPtr m_session
Definition: Field.hpp:95
boost::shared_ptr< ContField3D > ContField3DSharedPtr
Definition: ContField3D.h:190
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...
MultiRegions::ExpListSharedPtr Nektar::Utilities::Field::SetUpFirstExpList ( int  NumHomogeneousDir,
bool  fldfilegiven = false 
)
inline

Definition at line 113 of file Field.hpp.

References ASSERTL0, Nektar::LibUtilities::eFourier, and Nektar::LibUtilities::ePolyEvenlySpaced.

115  {
116 
118 
119  // Set up expansion list
120  int expdim = m_graph->GetMeshDimension();
121  bool dealiasing = false;
122 
123  m_session->MatchSolverInfo("USEFFT", "FFTW", m_useFFT, false);
124 
125  switch (expdim)
126  {
127  case 1:
128  {
129  ASSERTL0(NumHomogeneousDir <= 2,
130  "Quasi-3D approach is only set up for 1 or 2 "
131  "homogeneous directions");
132 
133  if (NumHomogeneousDir == 1)
134  {
136 
137  // Define Homogeneous expansion
138  int nplanes;
139  NekDouble ly;
141 
142  if(fldfilegiven)
143  {
144  nplanes = m_fielddef[0]->m_numModes[1];
145  ly = m_fielddef[0]->m_homogeneousLengths[0];
146  btype = m_fielddef[0]->m_basis[1];
147  }
148  else
149  {
150  m_session->LoadParameter("HomModesZ", nplanes);
151  m_session->LoadParameter("LY",ly);
152  btype = LibUtilities::eFourier;
153  }
154 
155  // Choose points to be at evenly spaced points at
156  // nplanes points
158  Pkey(nplanes, LibUtilities::ePolyEvenlySpaced);
159 
160  const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
161 
162 
163 
166  {
167  ASSERTL0(false,"ContField2DHomogeneous1D or "
168  "DisContField2DHomogenenous1D has "
169  "not been implemented");
170  }
171 
172  Exp2DH1 = MemoryManager<MultiRegions::
174  AllocateSharedPtr(m_session, Bkey, ly,
175  m_useFFT, dealiasing,
176  m_graph);
177  exp = Exp2DH1;
178  }
179  else if (NumHomogeneousDir == 2)
180  {
182 
183  int nylines,nzlines;
184  NekDouble ly,lz;
185  LibUtilities::BasisType btype1,btype2;
186 
187  if(fldfilegiven)
188  {
189  nylines = m_fielddef[0]->m_numModes[1];
190  nzlines = m_fielddef[0]->m_numModes[2];
191  ly = m_fielddef[0]->m_homogeneousLengths[0];
192  lz = m_fielddef[0]->m_homogeneousLengths[1];
193  btype1 = m_fielddef[0]->m_basis[1];
194  btype2 = m_fielddef[0]->m_basis[2];
195  }
196  else
197  {
198  m_session->LoadParameter("HomModesY", nylines);
199  m_session->LoadParameter("HomModesZ", nzlines);
200  m_session->LoadParameter("LY",ly);
201  m_session->LoadParameter("LZ",lz);
202  btype1 = LibUtilities::eFourier;
203  btype2 = LibUtilities::eFourier;
204  }
205 
206  // Choose points to be at evenly spaced points at
207  // nplanes points
209  PkeyY(nylines, LibUtilities::ePolyEvenlySpaced);
210  const LibUtilities::BasisKey BkeyY(btype1, nylines, PkeyY);
211 
213  PkeyZ(nzlines, LibUtilities::ePolyEvenlySpaced);
214  const LibUtilities::BasisKey BkeyZ(btype2, nzlines, PkeyZ);
215 
217  {
218  Exp3DH2 = MemoryManager<MultiRegions::
220  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
221  ly, lz, m_useFFT, dealiasing,
222  m_graph,
223  m_session->GetVariable(0));
224  }
226  {
227  Exp3DH2 = MemoryManager<MultiRegions::
229  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
230  ly, lz, m_useFFT, dealiasing,
231  m_graph,
232  m_session->GetVariable(0));
233  }
234  else
235  {
236  Exp3DH2 = MemoryManager<MultiRegions::
238  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
239  ly, lz, m_useFFT, dealiasing,
240  m_graph);
241  }
242 
243  exp = Exp3DH2;
244  }
245  else
246  {
248 
250  {
253  m_session->GetVariable(0));
254  }
256  {
259  m_session->GetVariable(0));
260  }
261  else
262  {
265  }
266 
267  exp = Exp1D;
268  }
269  }
270  break;
271  case 2:
272  {
273  ASSERTL0(NumHomogeneousDir <= 1,
274  "NumHomogeneousDir is only set up for 1");
275 
276  if (NumHomogeneousDir == 1)
277  {
279 
280  // Define Homogeneous expansion
281  int nplanes;
282  NekDouble lz;
284 
285  if(fldfilegiven)
286  {
287  nplanes = m_fielddef[0]->m_numModes[2];
288  lz = m_fielddef[0]->m_homogeneousLengths[0];
289  btype = m_fielddef[0]->m_basis[2];
290  }
291  else
292  {
293  m_session->LoadParameter("HomModesZ", nplanes);
294  m_session->LoadParameter("LZ",lz);
295  btype = LibUtilities::eFourier;
296  }
297 
298  // Choose points to be at evenly spaced points at
299  // nplanes points
301  Pkey(nplanes, LibUtilities::ePolyEvenlySpaced);
302 
303  const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
304 
306  {
307  Exp3DH1 = MemoryManager<MultiRegions::
309  AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
310  dealiasing, m_graph,
311  m_session->GetVariable(0));
312  }
314  {
315  Exp3DH1 = MemoryManager<MultiRegions::
317  AllocateSharedPtr(m_session,
318  Bkey, lz, m_useFFT,
319  dealiasing, m_graph,
320  m_session->GetVariable(0));
321  }
322  else
323  {
324  Exp3DH1 = MemoryManager<MultiRegions::
326  AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
327  dealiasing, m_graph);
328  }
329  exp = Exp3DH1;
330  }
331  else
332  {
334 
336  {
339  m_session->GetVariable(0));
340  }
342  {
345  m_session->GetVariable(0));
346  }
347  else
348  {
351  }
352 
353  exp = Exp2D;
354  }
355  }
356  break;
357  case 3:
358  {
360 
362  {
365  m_session->GetVariable(0));
366  }
368  {
371  m_session->GetVariable(0));
372  }
373  else
374  {
377  }
378 
379  exp = Exp3D;
380  }
381  break;
382  default:
383  ASSERTL0(false, "Expansion dimension not recognised");
384  break;
385  }
386 
387  return exp;
388  };
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
vector< LibUtilities::FieldDefinitionsSharedPtr > m_fielddef
Definition: Field.hpp:85
Fourier Expansion .
Definition: BasisType.h:52
boost::shared_ptr< ExpList3DHomogeneous2D > ExpList3DHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
1D Evenly-spaced points using Lagrange polynomial
Definition: PointsType.h:63
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
Definition: ExpList1D.h:50
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Definition: ExpList.h:1340
bool m_declareExpansionAsDisContField
Definition: Field.hpp:90
Defines a specification for a set of points.
Definition: Points.h:58
double NekDouble
SpatialDomains::MeshGraphSharedPtr m_graph
Definition: Field.hpp:96
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
Definition: ExpList2D.h:49
boost::shared_ptr< ExpList2DHomogeneous1D > ExpList2DHomogeneous1DSharedPtr
Shared pointer to an ExpList2DHomogeneous1D object.
boost::shared_ptr< ExpList3D > ExpList3DSharedPtr
Shared pointer to an ExpList3D object.
Definition: ExpList3D.h:110
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
bool m_declareExpansionAsContField
Definition: Field.hpp:89
LibUtilities::SessionReaderSharedPtr m_session
Definition: Field.hpp:95
Abstraction of a one-dimensional multi-elemental expansion which is merely a collection of local expa...
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
Describes the specification for a Basis.
Definition: Basis.h:50

Member Data Documentation

bool Nektar::Utilities::Field::m_addNormals

Definition at line 104 of file Field.hpp.

vector<unsigned int> Nektar::Utilities::Field::m_bndRegionsToWrite

Definition at line 102 of file Field.hpp.

LibUtilities::CommSharedPtr Nektar::Utilities::Field::m_comm

Definition at line 94 of file Field.hpp.

vector<vector<double> > Nektar::Utilities::Field::m_data

Definition at line 86 of file Field.hpp.

bool Nektar::Utilities::Field::m_declareExpansionAsContField

Definition at line 89 of file Field.hpp.

bool Nektar::Utilities::Field::m_declareExpansionAsDisContField

Definition at line 90 of file Field.hpp.

vector<MultiRegions::ExpListSharedPtr> Nektar::Utilities::Field::m_exp

Definition at line 87 of file Field.hpp.

vector<LibUtilities::FieldDefinitionsSharedPtr> Nektar::Utilities::Field::m_fielddef

Definition at line 85 of file Field.hpp.

LibUtilities::FieldMetaDataMap Nektar::Utilities::Field::m_fieldMetaDataMap

Definition at line 111 of file Field.hpp.

LibUtilities::PtsFieldSharedPtr Nektar::Utilities::Field::m_fieldPts

Definition at line 107 of file Field.hpp.

LibUtilities::FieldIOSharedPtr Nektar::Utilities::Field::m_fld

Definition at line 97 of file Field.hpp.

bool Nektar::Utilities::Field::m_fldToBnd

Definition at line 103 of file Field.hpp.

SpatialDomains::MeshGraphSharedPtr Nektar::Utilities::Field::m_graph

Definition at line 96 of file Field.hpp.

map<string, vector<string> > Nektar::Utilities::Field::m_inputfiles

Definition at line 99 of file Field.hpp.

MultiRegions::AssemblyMapCGSharedPtr Nektar::Utilities::Field::m_locToGlobalMap

Definition at line 109 of file Field.hpp.

LibUtilities::PtsIOSharedPtr Nektar::Utilities::Field::m_ptsIO

Definition at line 98 of file Field.hpp.

LibUtilities::SessionReaderSharedPtr Nektar::Utilities::Field::m_session

Definition at line 95 of file Field.hpp.

bool Nektar::Utilities::Field::m_setUpEquiSpacedFields

Definition at line 106 of file Field.hpp.

bool Nektar::Utilities::Field::m_useFFT

Definition at line 92 of file Field.hpp.

bool Nektar::Utilities::Field::m_verbose

Definition at line 84 of file Field.hpp.

bool Nektar::Utilities::Field::m_writeBndFld

Definition at line 101 of file Field.hpp.