Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::FieldDefinitionsSharedPtr
m_fielddef
 
vector< vector< double > > m_data
 
vector
< MultiRegions::ExpListSharedPtr
m_exp
 
bool m_declareExpansionAsContField
 
bool m_declareExpansionAsDisContField
 
bool m_declareAsNewField
 
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_declareAsNewField(false),
72  m_writeBndFld(false),
73  m_fldToBnd(false),
74  m_addNormals(false),
LibUtilities::PtsFieldSharedPtr m_fieldPts
Definition: Field.hpp:110
bool m_declareExpansionAsDisContField
Definition: Field.hpp:91
static PtsFieldSharedPtr NullPtsField
Definition: PtsField.h:264
bool m_declareExpansionAsContField
Definition: Field.hpp:90
Nektar::Utilities::Field::~Field ( )
inline

Definition at line 78 of file Field.hpp.

79  {
80  if (m_comm)
81  {
82  m_comm->Finalise();
83  }
84  }
LibUtilities::CommSharedPtr m_comm
Definition: Field.hpp:96

Member Function Documentation

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

Definition at line 403 of file Field.hpp.

References ASSERTL0.

406  {
408  {
409  NewField = true;
410  var = m_session->GetVariables()[0];
411  }
413  switch (m_graph->GetMeshDimension())
414  {
415  case 1:
416  {
417  if (NumHomogeneousDir == 1)
418  {
421  "ContField2DHomogeneous1D or "
422  "DisContField2DHomogenenous1D has not been "
423  "implemented");
424 
426  boost::dynamic_pointer_cast<MultiRegions::
428 
431  AllocateSharedPtr(*tmp2);
432 
433  }
434  else if (NumHomogeneousDir == 2)
435  {
437  {
439  boost::dynamic_pointer_cast<MultiRegions::
441 
444  AllocateSharedPtr(*tmp2);
445  }
447  {
449  boost::dynamic_pointer_cast<MultiRegions::
451 
454  AllocateSharedPtr(*tmp2);
455  }
456  else
457  {
459  boost::dynamic_pointer_cast<MultiRegions::
461 
464  AllocateSharedPtr(*tmp2);
465  }
466 
467 
468  }
469  else
470  {
472  {
474  boost::dynamic_pointer_cast<MultiRegions::
475  ContField1D>(m_exp[0]);
476 
479  }
481  {
483  boost::dynamic_pointer_cast<MultiRegions::
485 
488  }
489  else
490  {
492  boost::dynamic_pointer_cast<MultiRegions::
493  ExpList1D>(m_exp[0]);
494 
496  AllocateSharedPtr(*tmp2);
497  }
498 
499  }
500  }
501  break;
502  case 2:
503  {
504  if (NumHomogeneousDir == 1)
505  {
507  {
508  if(NewField)
509  {
510  bool dealiasing = false;
511 
513  ContField3DHomogeneous1D>::AllocateSharedPtr(
514  m_session,
515  m_exp[0]->GetHomogeneousBasis()
516  ->GetBasisKey(),
517  m_exp[0]->GetHomoLen(),
518  m_useFFT, dealiasing, m_graph, var);
519  }
520  else
521  {
523  boost::dynamic_pointer_cast<MultiRegions::
525 
526  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
529  AllocateSharedPtr(*tmp2);
530  }
531  }
533  {
534  if(NewField)
535  {
536  bool dealiasing = false;
537 
539  DisContField3DHomogeneous1D>::AllocateSharedPtr(
540  m_session,
541  m_exp[0]->GetHomogeneousBasis()
542  ->GetBasisKey(),
543  m_exp[0]->GetHomoLen(),
544  m_useFFT, dealiasing, m_graph,var);
545  }
546  else
547  {
549  boost::dynamic_pointer_cast<MultiRegions::
551  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
552 
555  AllocateSharedPtr(*tmp2);
556  }
557  }
558  else
559  {
560  if(NewField)
561  {
562  bool dealiasing = false;
563 
565  ExpList3DHomogeneous1D>::AllocateSharedPtr(
566  m_session,
567  m_exp[0]->GetHomogeneousBasis()
568  ->GetBasisKey(),
569  m_exp[0]->GetHomoLen(),
570  m_useFFT, dealiasing, m_graph);
571  }
572  else
573  {
575  boost::dynamic_pointer_cast<MultiRegions::
577  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
578 
581  AllocateSharedPtr(*tmp2);
582  }
583  }
584 
585  }
586  else
587  {
589  {
590  if(NewField)
591  {
594  }
595  else // call copy constructor
596  {
597 
599  boost::dynamic_pointer_cast<MultiRegions::
600  ContField2D>(m_exp[0]);
601 
603  AllocateSharedPtr(*tmp2,m_graph,var);
604  }
605  }
607  {
608  if(NewField)
609  {
612  }
613  else // call copy constructor
614  {
616  boost::dynamic_pointer_cast<MultiRegions::
618 
620  AllocateSharedPtr(*tmp2,m_graph,var);
621  }
622  }
623  else
624  {
626  boost::dynamic_pointer_cast<MultiRegions::
627  ExpList2D>(m_exp[0]);
628 
630  AllocateSharedPtr(*tmp2);
631  }
632  }
633  }
634  break;
635  case 3:
636  {
638  {
639  if(NewField)
640  {
643 
644  }
645  else
646  {
648  boost::dynamic_pointer_cast<MultiRegions::
649  ContField3D>(m_exp[0]);
650 
652  AllocateSharedPtr(*tmp2,m_graph,var);
653 
654  m_locToGlobalMap = tmp2->GetLocalToGlobalMap();
655  }
656  }
658  {
659  if(NewField)
660  {
663  }
664  else
665  {
667  boost::dynamic_pointer_cast<MultiRegions::
669 
671  AllocateSharedPtr(*tmp2,m_graph,var);
672  }
673  }
674  else
675  {
677  boost::dynamic_pointer_cast<MultiRegions::
678  ExpList3D>(m_exp[0]);
679 
681  AllocateSharedPtr(*tmp2);
682  }
683  }
684  break;
685  default:
686  ASSERTL0(false, "Expansion dimension not recognised");
687  break;
688  }
689 
690  return tmp;
691  }
vector< MultiRegions::ExpListSharedPtr > m_exp
Definition: Field.hpp:88
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
boost::shared_ptr< ContField1D > ContField1DSharedPtr
Definition: ContField1D.h:237
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:112
boost::shared_ptr< DisContField3DHomogeneous1D > DisContField3DHomogeneous1DSharedPtr
boost::shared_ptr< ContField2D > ContField2DSharedPtr
Definition: ContField2D.h:293
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
bool m_declareExpansionAsDisContField
Definition: Field.hpp:91
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
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:98
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:114
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:90
LibUtilities::SessionReaderSharedPtr m_session
Definition: Field.hpp:97
boost::shared_ptr< ContField3D > ContField3DSharedPtr
Definition: ContField3D.h:191
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 116 of file Field.hpp.

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

118  {
119 
121 
122  // Set up expansion list
123  int expdim = m_graph->GetMeshDimension();
124  bool dealiasing = false;
125 
126  m_session->MatchSolverInfo("USEFFT", "FFTW", m_useFFT, false);
127 
128  switch (expdim)
129  {
130  case 1:
131  {
132  ASSERTL0(NumHomogeneousDir <= 2,
133  "Quasi-3D approach is only set up for 1 or 2 "
134  "homogeneous directions");
135 
136  if (NumHomogeneousDir == 1)
137  {
139 
140  // Define Homogeneous expansion
141  int nplanes;
142  NekDouble ly;
144 
145  if(fldfilegiven)
146  {
147  nplanes = m_fielddef[0]->m_numModes[1];
148  ly = m_fielddef[0]->m_homogeneousLengths[0];
149  btype = m_fielddef[0]->m_basis[1];
150  }
151  else
152  {
153  m_session->LoadParameter("HomModesZ", nplanes);
154  m_session->LoadParameter("LY",ly);
155  btype = LibUtilities::eFourier;
156  }
157 
158  // Choose points to be at evenly spaced points at
159  // nplanes points
161  Pkey(nplanes, LibUtilities::ePolyEvenlySpaced);
162 
163  const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
164 
165 
166 
169  {
170  ASSERTL0(false,"ContField2DHomogeneous1D or "
171  "DisContField2DHomogenenous1D has "
172  "not been implemented");
173  }
174 
175  Exp2DH1 = MemoryManager<MultiRegions::
177  AllocateSharedPtr(m_session, Bkey, ly,
178  m_useFFT, dealiasing,
179  m_graph);
180  exp = Exp2DH1;
181  }
182  else if (NumHomogeneousDir == 2)
183  {
185 
186  int nylines,nzlines;
187  NekDouble ly,lz;
188  LibUtilities::BasisType btype1,btype2;
189 
190  if(fldfilegiven)
191  {
192  nylines = m_fielddef[0]->m_numModes[1];
193  nzlines = m_fielddef[0]->m_numModes[2];
194  ly = m_fielddef[0]->m_homogeneousLengths[0];
195  lz = m_fielddef[0]->m_homogeneousLengths[1];
196  btype1 = m_fielddef[0]->m_basis[1];
197  btype2 = m_fielddef[0]->m_basis[2];
198  }
199  else
200  {
201  m_session->LoadParameter("HomModesY", nylines);
202  m_session->LoadParameter("HomModesZ", nzlines);
203  m_session->LoadParameter("LY",ly);
204  m_session->LoadParameter("LZ",lz);
205  btype1 = LibUtilities::eFourier;
206  btype2 = LibUtilities::eFourier;
207  }
208 
209  // Choose points to be at evenly spaced points at
210  // nplanes points
212  PkeyY(nylines, LibUtilities::ePolyEvenlySpaced);
213  const LibUtilities::BasisKey BkeyY(btype1, nylines, PkeyY);
214 
216  PkeyZ(nzlines, LibUtilities::ePolyEvenlySpaced);
217  const LibUtilities::BasisKey BkeyZ(btype2, nzlines, PkeyZ);
218 
220  {
221  Exp3DH2 = MemoryManager<MultiRegions::
223  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
224  ly, lz, m_useFFT, dealiasing,
225  m_graph,
226  m_session->GetVariable(0));
227  }
229  {
230  Exp3DH2 = MemoryManager<MultiRegions::
232  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
233  ly, lz, m_useFFT, dealiasing,
234  m_graph,
235  m_session->GetVariable(0));
236  }
237  else
238  {
239  Exp3DH2 = MemoryManager<MultiRegions::
241  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
242  ly, lz, m_useFFT, dealiasing,
243  m_graph);
244  }
245 
246  exp = Exp3DH2;
247  }
248  else
249  {
251 
253  {
256  m_session->GetVariable(0));
257  }
259  {
262  m_session->GetVariable(0));
263  }
264  else
265  {
268  }
269 
270  exp = Exp1D;
271  }
272  }
273  break;
274  case 2:
275  {
276  ASSERTL0(NumHomogeneousDir <= 1,
277  "NumHomogeneousDir is only set up for 1");
278 
279  if (NumHomogeneousDir == 1)
280  {
282 
283  // Define Homogeneous expansion
284  int nplanes;
285  NekDouble lz;
287 
288  if(fldfilegiven)
289  {
290  nplanes = m_fielddef[0]->m_numModes[2];
291  lz = m_fielddef[0]->m_homogeneousLengths[0];
292  btype = m_fielddef[0]->m_basis[2];
293 
295  {
296  btype = LibUtilities::eFourier;
298  if (nplanes <= 2)
299  {
300  nplanes = 4;
301  }
302  }
303  }
304  else
305  {
306  m_session->LoadParameter("HomModesZ", nplanes);
307  m_session->LoadParameter("LZ",lz);
308  btype = LibUtilities::eFourier;
309  }
310 
311  // Choose points to be at evenly spaced points at
312  // nplanes points
314  Pkey(nplanes, LibUtilities::ePolyEvenlySpaced);
315 
316  const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
317 
319  {
320  Exp3DH1 = MemoryManager<MultiRegions::
322  AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
323  dealiasing, m_graph,
324  m_session->GetVariable(0));
325  }
327  {
328  Exp3DH1 = MemoryManager<MultiRegions::
330  AllocateSharedPtr(m_session,
331  Bkey, lz, m_useFFT,
332  dealiasing, m_graph,
333  m_session->GetVariable(0));
334  }
335  else
336  {
337  Exp3DH1 = MemoryManager<MultiRegions::
339  AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
340  dealiasing, m_graph);
341  }
342  exp = Exp3DH1;
343  }
344  else
345  {
347 
349  {
352  m_session->GetVariable(0));
353  }
355  {
358  m_session->GetVariable(0));
359  }
360  else
361  {
364  }
365 
366  exp = Exp2D;
367  }
368  }
369  break;
370  case 3:
371  {
373 
375  {
378  m_session->GetVariable(0));
379  }
381  {
384  m_session->GetVariable(0));
385  }
386  else
387  {
390  }
391 
392  exp = Exp3D;
393  }
394  break;
395  default:
396  ASSERTL0(false, "Expansion dimension not recognised");
397  break;
398  }
399 
400  return exp;
401  };
#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:86
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
bool m_declareExpansionAsDisContField
Definition: Field.hpp:91
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Defines a specification for a set of points.
Definition: Points.h:58
double NekDouble
SpatialDomains::MeshGraphSharedPtr m_graph
Definition: Field.hpp:98
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:114
Fourier ModifiedExpansion with just the first mode .
Definition: BasisType.h:58
boost::shared_ptr< ExpList3DHomogeneous1D > ExpList3DHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
bool m_declareExpansionAsContField
Definition: Field.hpp:90
LibUtilities::SessionReaderSharedPtr m_session
Definition: Field.hpp:97
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 106 of file Field.hpp.

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

Definition at line 104 of file Field.hpp.

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

Definition at line 96 of file Field.hpp.

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

Definition at line 87 of file Field.hpp.

bool Nektar::Utilities::Field::m_declareAsNewField

Definition at line 92 of file Field.hpp.

bool Nektar::Utilities::Field::m_declareExpansionAsContField

Definition at line 90 of file Field.hpp.

bool Nektar::Utilities::Field::m_declareExpansionAsDisContField

Definition at line 91 of file Field.hpp.

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

Definition at line 88 of file Field.hpp.

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

Definition at line 86 of file Field.hpp.

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

Definition at line 114 of file Field.hpp.

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

Definition at line 110 of file Field.hpp.

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

Definition at line 99 of file Field.hpp.

bool Nektar::Utilities::Field::m_fldToBnd

Definition at line 105 of file Field.hpp.

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

Definition at line 98 of file Field.hpp.

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

Definition at line 101 of file Field.hpp.

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

Definition at line 112 of file Field.hpp.

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

Definition at line 100 of file Field.hpp.

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

Definition at line 97 of file Field.hpp.

bool Nektar::Utilities::Field::m_setUpEquiSpacedFields

Definition at line 108 of file Field.hpp.

bool Nektar::Utilities::Field::m_useFFT

Definition at line 94 of file Field.hpp.

bool Nektar::Utilities::Field::m_verbose

Definition at line 85 of file Field.hpp.

bool Nektar::Utilities::Field::m_writeBndFld

Definition at line 103 of file Field.hpp.