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_requireBoundaryExpansion
 
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),
72  m_writeBndFld(false),
73  m_fldToBnd(false),
74  m_addNormals(false),
bool m_requireBoundaryExpansion
Definition: Field.hpp:93
LibUtilities::PtsFieldSharedPtr m_fieldPts
Definition: Field.hpp:111
bool m_declareExpansionAsDisContField
Definition: Field.hpp:91
static PtsFieldSharedPtr NullPtsField
Definition: PtsField.h:263
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:97

Member Function Documentation

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

Definition at line 404 of file Field.hpp.

References ASSERTL0.

407  {
408  if(var.compare("DefaultVar") == 0 && m_requireBoundaryExpansion)
409  {
410  if (m_session->GetVariables().size())
411  {
412  var = m_session->GetVariables()[0];
413  }
414  }
416  switch (m_graph->GetMeshDimension())
417  {
418  case 1:
419  {
420  if (NumHomogeneousDir == 1)
421  {
424  "ContField2DHomogeneous1D or "
425  "DisContField2DHomogenenous1D has not been "
426  "implemented");
427 
429  boost::dynamic_pointer_cast<MultiRegions::
430  ExpList2DHomogeneous1D>(m_exp[0]);
431 
432  tmp = MemoryManager<MultiRegions::
433  ExpList2DHomogeneous1D>::
434  AllocateSharedPtr(*tmp2);
435 
436  }
437  else if (NumHomogeneousDir == 2)
438  {
440  {
442  boost::dynamic_pointer_cast<MultiRegions::
443  ContField3DHomogeneous2D>(m_exp[0]);
444 
445  tmp = MemoryManager<MultiRegions::
446  ContField3DHomogeneous2D>::
447  AllocateSharedPtr(*tmp2);
448  }
450  {
452  boost::dynamic_pointer_cast<MultiRegions::
453  DisContField3DHomogeneous2D>(m_exp[0]);
454 
455  tmp = MemoryManager<MultiRegions::
456  DisContField3DHomogeneous2D>::
457  AllocateSharedPtr(*tmp2);
458  }
459  else
460  {
462  boost::dynamic_pointer_cast<MultiRegions::
463  ExpList3DHomogeneous2D>(m_exp[0]);
464 
465  tmp = MemoryManager<MultiRegions::
466  ExpList3DHomogeneous2D>::
467  AllocateSharedPtr(*tmp2);
468  }
469 
470 
471  }
472  else
473  {
475  {
477  boost::dynamic_pointer_cast<MultiRegions::
478  ContField1D>(m_exp[0]);
479 
482  }
484  {
486  boost::dynamic_pointer_cast<MultiRegions::
487  DisContField1D>(m_exp[0]);
488 
491  }
492  else
493  {
495  boost::dynamic_pointer_cast<MultiRegions::
496  ExpList1D>(m_exp[0]);
497 
499  AllocateSharedPtr(*tmp2);
500  }
501 
502  }
503  }
504  break;
505  case 2:
506  {
507  if (NumHomogeneousDir == 1)
508  {
510  {
511  if(NewField)
512  {
513  bool dealiasing = false;
514 
515  tmp = MemoryManager<MultiRegions::
516  ContField3DHomogeneous1D>::AllocateSharedPtr(
517  m_session,
518  m_exp[0]->GetHomogeneousBasis()
519  ->GetBasisKey(),
520  m_exp[0]->GetHomoLen(),
521  m_useFFT, dealiasing, m_graph, var);
522  }
523  else
524  {
526  boost::dynamic_pointer_cast<MultiRegions::
527  ContField3DHomogeneous1D>(m_exp[0]);
528 
529  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
530  tmp = MemoryManager<MultiRegions::
531  ContField3DHomogeneous1D>::
532  AllocateSharedPtr(*tmp2, m_graph, var);
533  }
534  }
536  {
537  if(NewField)
538  {
539  bool dealiasing = false;
540 
541  tmp = MemoryManager<MultiRegions::
542  DisContField3DHomogeneous1D>::AllocateSharedPtr(
543  m_session,
544  m_exp[0]->GetHomogeneousBasis()
545  ->GetBasisKey(),
546  m_exp[0]->GetHomoLen(),
547  m_useFFT, dealiasing, m_graph,var);
548  }
549  else
550  {
552  boost::dynamic_pointer_cast<MultiRegions::
553  DisContField3DHomogeneous1D>(m_exp[0]);
554  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
555 
556  tmp = MemoryManager<MultiRegions::
557  DisContField3DHomogeneous1D>::
558  AllocateSharedPtr(*tmp2);
559  }
560  }
561  else
562  {
563  if(NewField)
564  {
565  bool dealiasing = false;
566 
567  tmp = MemoryManager<MultiRegions::
568  ExpList3DHomogeneous1D>::AllocateSharedPtr(
569  m_session,
570  m_exp[0]->GetHomogeneousBasis()
571  ->GetBasisKey(),
572  m_exp[0]->GetHomoLen(),
573  m_useFFT, dealiasing, m_graph);
574  }
575  else
576  {
578  boost::dynamic_pointer_cast<MultiRegions::
579  ExpList3DHomogeneous1D>(m_exp[0]);
580  ASSERTL0(tmp2,"Failed to type cast m_exp[0]");
581 
582  tmp = MemoryManager<MultiRegions::
583  ExpList3DHomogeneous1D>::
584  AllocateSharedPtr(*tmp2);
585  }
586  }
587 
588  }
589  else
590  {
592  {
593  if(NewField)
594  {
597  }
598  else // call copy constructor
599  {
600 
602  boost::dynamic_pointer_cast<MultiRegions::
603  ContField2D>(m_exp[0]);
604 
606  AllocateSharedPtr(*tmp2,m_graph,var);
607  }
608  }
610  {
611  if(NewField)
612  {
615  }
616  else // call copy constructor
617  {
619  boost::dynamic_pointer_cast<MultiRegions::
620  DisContField2D>(m_exp[0]);
621 
623  AllocateSharedPtr(*tmp2,m_graph,var);
624  }
625  }
626  else
627  {
629  boost::dynamic_pointer_cast<MultiRegions::
630  ExpList2D>(m_exp[0]);
631 
633  AllocateSharedPtr(*tmp2);
634  }
635  }
636  }
637  break;
638  case 3:
639  {
641  {
642  if(NewField)
643  {
646 
647  }
648  else
649  {
651  boost::dynamic_pointer_cast<MultiRegions::
652  ContField3D>(m_exp[0]);
653 
655  AllocateSharedPtr(*tmp2,m_graph,var);
656 
657  m_locToGlobalMap = tmp2->GetLocalToGlobalMap();
658  }
659  }
661  {
662  if(NewField)
663  {
666  }
667  else
668  {
670  boost::dynamic_pointer_cast<MultiRegions::
671  DisContField3D>(m_exp[0]);
672 
674  AllocateSharedPtr(*tmp2,m_graph,var);
675  }
676  }
677  else
678  {
680  boost::dynamic_pointer_cast<MultiRegions::
681  ExpList3D>(m_exp[0]);
682 
684  AllocateSharedPtr(*tmp2);
685  }
686  }
687  break;
688  default:
689  ASSERTL0(false, "Expansion dimension not recognised");
690  break;
691  }
692 
693  return tmp;
694  }
vector< MultiRegions::ExpListSharedPtr > m_exp
Definition: Field.hpp:88
#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.
bool m_requireBoundaryExpansion
Definition: Field.hpp:93
MultiRegions::AssemblyMapCGSharedPtr m_locToGlobalMap
Definition: Field.hpp:113
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:91
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
boost::shared_ptr< DisContField2D > DisContField2DSharedPtr
SpatialDomains::MeshGraphSharedPtr m_graph
Definition: Field.hpp:99
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:90
LibUtilities::SessionReaderSharedPtr m_session
Definition: Field.hpp:98
boost::shared_ptr< ContField3D > ContField3DSharedPtr
Definition: ContField3D.h:191
MultiRegions::ExpListSharedPtr Nektar::Utilities::Field::SetUpFirstExpList ( int  NumHomogeneousDir,
bool  fldfilegiven = false 
)
inline

Definition at line 117 of file Field.hpp.

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

119  {
120 
122 
123  // Set up expansion list
124  int expdim = m_graph->GetMeshDimension();
125  bool dealiasing = false;
126 
127  m_session->MatchSolverInfo("USEFFT", "FFTW", m_useFFT, false);
128 
129  switch (expdim)
130  {
131  case 1:
132  {
133  ASSERTL0(NumHomogeneousDir <= 2,
134  "Quasi-3D approach is only set up for 1 or 2 "
135  "homogeneous directions");
136 
137  if (NumHomogeneousDir == 1)
138  {
140 
141  // Define Homogeneous expansion
142  int nplanes;
143  NekDouble ly;
145 
146  if(fldfilegiven)
147  {
148  nplanes = m_fielddef[0]->m_numModes[1];
149  ly = m_fielddef[0]->m_homogeneousLengths[0];
150  btype = m_fielddef[0]->m_basis[1];
151  }
152  else
153  {
154  m_session->LoadParameter("HomModesZ", nplanes);
155  m_session->LoadParameter("LY",ly);
156  btype = LibUtilities::eFourier;
157  }
158 
159  // Choose points to be at evenly spaced points at
160  // nplanes points
161  const LibUtilities::PointsKey
162  Pkey(nplanes, LibUtilities::eFourierEvenlySpaced);
163 
164  const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
165 
166 
167 
170  {
171  ASSERTL0(false,"ContField2DHomogeneous1D or "
172  "DisContField2DHomogenenous1D has "
173  "not been implemented");
174  }
175 
176  Exp2DH1 = MemoryManager<MultiRegions::
177  ExpList2DHomogeneous1D>::
178  AllocateSharedPtr(m_session, Bkey, ly,
179  m_useFFT, dealiasing,
180  m_graph);
181  exp = Exp2DH1;
182  }
183  else if (NumHomogeneousDir == 2)
184  {
186 
187  int nylines,nzlines;
188  NekDouble ly,lz;
189  LibUtilities::BasisType btype1,btype2;
190 
191  if(fldfilegiven)
192  {
193  nylines = m_fielddef[0]->m_numModes[1];
194  nzlines = m_fielddef[0]->m_numModes[2];
195  ly = m_fielddef[0]->m_homogeneousLengths[0];
196  lz = m_fielddef[0]->m_homogeneousLengths[1];
197  btype1 = m_fielddef[0]->m_basis[1];
198  btype2 = m_fielddef[0]->m_basis[2];
199  }
200  else
201  {
202  m_session->LoadParameter("HomModesY", nylines);
203  m_session->LoadParameter("HomModesZ", nzlines);
204  m_session->LoadParameter("LY",ly);
205  m_session->LoadParameter("LZ",lz);
206  btype1 = LibUtilities::eFourier;
207  btype2 = LibUtilities::eFourier;
208  }
209 
210  // Choose points to be at evenly spaced points at
211  // nplanes points
212  const LibUtilities::PointsKey
213  PkeyY(nylines, LibUtilities::eFourierEvenlySpaced);
214  const LibUtilities::BasisKey BkeyY(btype1, nylines, PkeyY);
215 
216  const LibUtilities::PointsKey
217  PkeyZ(nzlines, LibUtilities::eFourierEvenlySpaced);
218  const LibUtilities::BasisKey BkeyZ(btype2, nzlines, PkeyZ);
219 
221  {
222  Exp3DH2 = MemoryManager<MultiRegions::
223  ContField3DHomogeneous2D>::
224  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
225  ly, lz, m_useFFT, dealiasing,
226  m_graph,
227  m_session->GetVariable(0));
228  }
230  {
231  Exp3DH2 = MemoryManager<MultiRegions::
232  DisContField3DHomogeneous2D>::
233  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
234  ly, lz, m_useFFT, dealiasing,
235  m_graph,
236  m_session->GetVariable(0));
237  }
238  else
239  {
240  Exp3DH2 = MemoryManager<MultiRegions::
241  ExpList3DHomogeneous2D>::
242  AllocateSharedPtr(m_session, BkeyY, BkeyZ,
243  ly, lz, m_useFFT, dealiasing,
244  m_graph);
245  }
246 
247  exp = Exp3DH2;
248  }
249  else
250  {
252 
254  {
257  m_session->GetVariable(0));
258  }
260  {
263  m_session->GetVariable(0));
264  }
265  else
266  {
269  }
270 
271  exp = Exp1D;
272  }
273  }
274  break;
275  case 2:
276  {
277  ASSERTL0(NumHomogeneousDir <= 1,
278  "NumHomogeneousDir is only set up for 1");
279 
280  if (NumHomogeneousDir == 1)
281  {
283 
284  // Define Homogeneous expansion
285  int nplanes;
286  NekDouble lz;
288 
289  if(fldfilegiven)
290  {
291  nplanes = m_fielddef[0]->m_numModes[2];
292  lz = m_fielddef[0]->m_homogeneousLengths[0];
293  btype = m_fielddef[0]->m_basis[2];
294 
296  {
297  btype = LibUtilities::eFourier;
299  if (nplanes <= 2)
300  {
301  nplanes = 4;
302  }
303  }
304  }
305  else
306  {
307  m_session->LoadParameter("HomModesZ", nplanes);
308  m_session->LoadParameter("LZ",lz);
309  btype = LibUtilities::eFourier;
310  }
311 
312  // Choose points to be at evenly spaced points at
313  // nplanes points
314  const LibUtilities::PointsKey
315  Pkey(nplanes, LibUtilities::eFourierEvenlySpaced);
316 
317  const LibUtilities::BasisKey Bkey(btype, nplanes, Pkey);
318 
320  {
321  Exp3DH1 = MemoryManager<MultiRegions::
322  ContField3DHomogeneous1D>::
323  AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
324  dealiasing, m_graph,
325  m_session->GetVariable(0));
326  }
328  {
329  Exp3DH1 = MemoryManager<MultiRegions::
330  DisContField3DHomogeneous1D>::
331  AllocateSharedPtr(m_session,
332  Bkey, lz, m_useFFT,
333  dealiasing, m_graph,
334  m_session->GetVariable(0));
335  }
336  else
337  {
338  Exp3DH1 = MemoryManager<MultiRegions::
339  ExpList3DHomogeneous1D>::
340  AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
341  dealiasing, m_graph);
342  }
343  exp = Exp3DH1;
344  }
345  else
346  {
348 
350  {
353  m_session->GetVariable(0));
354  }
356  {
359  m_session->GetVariable(0));
360  }
361  else
362  {
365  }
366 
367  exp = Exp2D;
368  }
369  }
370  break;
371  case 3:
372  {
374 
376  {
379  m_session->GetVariable(0));
380  }
382  {
385  m_session->GetVariable(0));
386  }
387  else
388  {
391  }
392 
393  exp = Exp3D;
394  }
395  break;
396  default:
397  ASSERTL0(false, "Expansion dimension not recognised");
398  break;
399  }
400 
401  return exp;
402  };
#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:86
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:91
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
double NekDouble
SpatialDomains::MeshGraphSharedPtr m_graph
Definition: Field.hpp:99
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:98

Member Data Documentation

bool Nektar::Utilities::Field::m_addNormals

Definition at line 107 of file Field.hpp.

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

Definition at line 105 of file Field.hpp.

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

Definition at line 97 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_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 115 of file Field.hpp.

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

Definition at line 111 of file Field.hpp.

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

Definition at line 100 of file Field.hpp.

bool Nektar::Utilities::Field::m_fldToBnd

Definition at line 106 of file Field.hpp.

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

Definition at line 99 of file Field.hpp.

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

Definition at line 102 of file Field.hpp.

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

Definition at line 113 of file Field.hpp.

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

Definition at line 101 of file Field.hpp.

bool Nektar::Utilities::Field::m_requireBoundaryExpansion

Definition at line 93 of file Field.hpp.

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

Definition at line 98 of file Field.hpp.

bool Nektar::Utilities::Field::m_setUpEquiSpacedFields

Definition at line 109 of file Field.hpp.

bool Nektar::Utilities::Field::m_useFFT

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