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_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:108
bool m_declareExpansionAsDisContField
Definition: Field.hpp:90
static PtsFieldSharedPtr NullPtsField
Definition: PtsField.h:263
bool m_declareExpansionAsContField
Definition: Field.hpp:89
Nektar::Utilities::Field::~Field ( )
inline

Definition at line 77 of file Field.hpp.

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

Member Function Documentation

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

Definition at line 401 of file Field.hpp.

References ASSERTL0.

404  {
405  if(var.compare("DefaultVar") == 0 && m_declareExpansionAsContField)
406  {
407  if (m_session->GetVariables().size())
408  {
409  var = m_session->GetVariables()[0];
410  }
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::
427  ExpList2DHomogeneous1D>(m_exp[0]);
428 
429  tmp = MemoryManager<MultiRegions::
430  ExpList2DHomogeneous1D>::
431  AllocateSharedPtr(*tmp2);
432 
433  }
434  else if (NumHomogeneousDir == 2)
435  {
437  {
439  boost::dynamic_pointer_cast<MultiRegions::
440  ContField3DHomogeneous2D>(m_exp[0]);
441 
442  tmp = MemoryManager<MultiRegions::
443  ContField3DHomogeneous2D>::
444  AllocateSharedPtr(*tmp2);
445  }
447  {
449  boost::dynamic_pointer_cast<MultiRegions::
450  DisContField3DHomogeneous2D>(m_exp[0]);
451 
452  tmp = MemoryManager<MultiRegions::
453  DisContField3DHomogeneous2D>::
454  AllocateSharedPtr(*tmp2);
455  }
456  else
457  {
459  boost::dynamic_pointer_cast<MultiRegions::
460  ExpList3DHomogeneous2D>(m_exp[0]);
461 
462  tmp = MemoryManager<MultiRegions::
463  ExpList3DHomogeneous2D>::
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::
484  DisContField1D>(m_exp[0]);
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 
512  tmp = MemoryManager<MultiRegions::
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::
524  ContField3DHomogeneous1D>(m_exp[0]);
525 
526  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
527  tmp = MemoryManager<MultiRegions::
528  ContField3DHomogeneous1D>::
529  AllocateSharedPtr(*tmp2, m_graph, var);
530  }
531  }
533  {
534  if(NewField)
535  {
536  bool dealiasing = false;
537 
538  tmp = MemoryManager<MultiRegions::
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::
550  DisContField3DHomogeneous1D>(m_exp[0]);
551  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
552 
553  tmp = MemoryManager<MultiRegions::
554  DisContField3DHomogeneous1D>::
555  AllocateSharedPtr(*tmp2);
556  }
557  }
558  else
559  {
560  if(NewField)
561  {
562  bool dealiasing = false;
563 
564  tmp = MemoryManager<MultiRegions::
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::
576  ExpList3DHomogeneous1D>(m_exp[0]);
577  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
578 
579  tmp = MemoryManager<MultiRegions::
580  ExpList3DHomogeneous1D>::
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::
617  DisContField2D>(m_exp[0]);
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::
668  DisContField3D>(m_exp[0]);
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:87
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
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.
MultiRegions::AssemblyMapCGSharedPtr m_locToGlobalMap
Definition: Field.hpp:110
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.
boost::shared_ptr< DisContField3DHomogeneous2D > DisContField3DHomogeneous2DSharedPtr
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:90
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
boost::shared_ptr< DisContField2D > DisContField2DSharedPtr
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:114
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:191
MultiRegions::ExpListSharedPtr Nektar::Utilities::Field::SetUpFirstExpList ( int  NumHomogeneousDir,
bool  fldfilegiven = false 
)
inline

Definition at line 114 of file Field.hpp.

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

116  {
117 
119 
120  // Set up expansion list
121  int expdim = m_graph->GetMeshDimension();
122  bool dealiasing = false;
123 
124  m_session->MatchSolverInfo("USEFFT", "FFTW", m_useFFT, false);
125 
126  switch (expdim)
127  {
128  case 1:
129  {
130  ASSERTL0(NumHomogeneousDir <= 2,
131  "Quasi-3D approach is only set up for 1 or 2 "
132  "homogeneous directions");
133 
134  if (NumHomogeneousDir == 1)
135  {
137 
138  // Define Homogeneous expansion
139  int nplanes;
140  NekDouble ly;
142 
143  if(fldfilegiven)
144  {
145  nplanes = m_fielddef[0]->m_numModes[1];
146  ly = m_fielddef[0]->m_homogeneousLengths[0];
147  btype = m_fielddef[0]->m_basis[1];
148  }
149  else
150  {
151  m_session->LoadParameter("HomModesZ", nplanes);
152  m_session->LoadParameter("LY",ly);
153  btype = LibUtilities::eFourier;
154  }
155 
156  // Choose points to be at evenly spaced points at
157  // nplanes points
158  const LibUtilities::PointsKey
159  Pkey(nplanes, LibUtilities::eFourierEvenlySpaced);
160 
161  const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
162 
163 
164 
167  {
168  ASSERTL0(false,"ContField2DHomogeneous1D or "
169  "DisContField2DHomogenenous1D has "
170  "not been implemented");
171  }
172 
173  Exp2DH1 = MemoryManager<MultiRegions::
174  ExpList2DHomogeneous1D>::
175  AllocateSharedPtr(m_session, Bkey, ly,
176  m_useFFT, dealiasing,
177  m_graph);
178  exp = Exp2DH1;
179  }
180  else if (NumHomogeneousDir == 2)
181  {
183 
184  int nylines,nzlines;
185  NekDouble ly,lz;
186  LibUtilities::BasisType btype1,btype2;
187 
188  if(fldfilegiven)
189  {
190  nylines = m_fielddef[0]->m_numModes[1];
191  nzlines = m_fielddef[0]->m_numModes[2];
192  ly = m_fielddef[0]->m_homogeneousLengths[0];
193  lz = m_fielddef[0]->m_homogeneousLengths[1];
194  btype1 = m_fielddef[0]->m_basis[1];
195  btype2 = m_fielddef[0]->m_basis[2];
196  }
197  else
198  {
199  m_session->LoadParameter("HomModesY", nylines);
200  m_session->LoadParameter("HomModesZ", nzlines);
201  m_session->LoadParameter("LY",ly);
202  m_session->LoadParameter("LZ",lz);
203  btype1 = LibUtilities::eFourier;
204  btype2 = LibUtilities::eFourier;
205  }
206 
207  // Choose points to be at evenly spaced points at
208  // nplanes points
209  const LibUtilities::PointsKey
210  PkeyY(nylines, LibUtilities::eFourierEvenlySpaced);
211  const LibUtilities::BasisKey BkeyY(btype1, nylines, PkeyY);
212 
213  const LibUtilities::PointsKey
214  PkeyZ(nzlines, LibUtilities::eFourierEvenlySpaced);
215  const LibUtilities::BasisKey BkeyZ(btype2, nzlines, PkeyZ);
216 
218  {
219  Exp3DH2 = MemoryManager<MultiRegions::
220  ContField3DHomogeneous2D>::
221  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
222  ly, lz, m_useFFT, dealiasing,
223  m_graph,
224  m_session->GetVariable(0));
225  }
227  {
228  Exp3DH2 = MemoryManager<MultiRegions::
229  DisContField3DHomogeneous2D>::
230  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
231  ly, lz, m_useFFT, dealiasing,
232  m_graph,
233  m_session->GetVariable(0));
234  }
235  else
236  {
237  Exp3DH2 = MemoryManager<MultiRegions::
238  ExpList3DHomogeneous2D>::
239  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
240  ly, lz, m_useFFT, dealiasing,
241  m_graph);
242  }
243 
244  exp = Exp3DH2;
245  }
246  else
247  {
249 
251  {
254  m_session->GetVariable(0));
255  }
257  {
260  m_session->GetVariable(0));
261  }
262  else
263  {
266  }
267 
268  exp = Exp1D;
269  }
270  }
271  break;
272  case 2:
273  {
274  ASSERTL0(NumHomogeneousDir <= 1,
275  "NumHomogeneousDir is only set up for 1");
276 
277  if (NumHomogeneousDir == 1)
278  {
280 
281  // Define Homogeneous expansion
282  int nplanes;
283  NekDouble lz;
285 
286  if(fldfilegiven)
287  {
288  nplanes = m_fielddef[0]->m_numModes[2];
289  lz = m_fielddef[0]->m_homogeneousLengths[0];
290  btype = m_fielddef[0]->m_basis[2];
291 
293  {
294  btype = LibUtilities::eFourier;
296  if (nplanes <= 2)
297  {
298  nplanes = 4;
299  }
300  }
301  }
302  else
303  {
304  m_session->LoadParameter("HomModesZ", nplanes);
305  m_session->LoadParameter("LZ",lz);
306  btype = LibUtilities::eFourier;
307  }
308 
309  // Choose points to be at evenly spaced points at
310  // nplanes points
311  const LibUtilities::PointsKey
312  Pkey(nplanes, LibUtilities::eFourierEvenlySpaced);
313 
314  const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
315 
317  {
318  Exp3DH1 = MemoryManager<MultiRegions::
319  ContField3DHomogeneous1D>::
320  AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
321  dealiasing, m_graph,
322  m_session->GetVariable(0));
323  }
325  {
326  Exp3DH1 = MemoryManager<MultiRegions::
327  DisContField3DHomogeneous1D>::
328  AllocateSharedPtr(m_session,
329  Bkey, lz, m_useFFT,
330  dealiasing, m_graph,
331  m_session->GetVariable(0));
332  }
333  else
334  {
335  Exp3DH1 = MemoryManager<MultiRegions::
336  ExpList3DHomogeneous1D>::
337  AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
338  dealiasing, m_graph);
339  }
340  exp = Exp3DH1;
341  }
342  else
343  {
345 
347  {
350  m_session->GetVariable(0));
351  }
353  {
356  m_session->GetVariable(0));
357  }
358  else
359  {
362  }
363 
364  exp = Exp2D;
365  }
366  }
367  break;
368  case 3:
369  {
371 
373  {
376  m_session->GetVariable(0));
377  }
379  {
382  m_session->GetVariable(0));
383  }
384  else
385  {
388  }
389 
390  exp = Exp3D;
391  }
392  break;
393  default:
394  ASSERTL0(false, "Expansion dimension not recognised");
395  break;
396  }
397 
398  return exp;
399  };
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
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.
1D Evenly-spaced points using Fourier Fit
Definition: PointsType.h:64
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
Definition: ExpList1D.h:50
bool m_declareExpansionAsDisContField
Definition: Field.hpp:90
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
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: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:89
LibUtilities::SessionReaderSharedPtr m_session
Definition: Field.hpp:95

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

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

Definition at line 108 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 110 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.