Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::ProcessSurfDistance Class Reference

This processing module calculates the height of an element connected to a surface and adds it as an extra-field to the output file. More...

#include <ProcessSurfDistance.h>

Inheritance diagram for Nektar::Utilities::ProcessSurfDistance:
Inheritance graph
[legend]
Collaboration diagram for Nektar::Utilities::ProcessSurfDistance:
Collaboration graph
[legend]

Public Member Functions

 ProcessSurfDistance (FieldSharedPtr f)
 
virtual ~ProcessSurfDistance ()
 
virtual void Process (po::variables_map &vm)
 Write mesh to output file. More...
 
- Public Member Functions inherited from Nektar::Utilities::ProcessModule
 ProcessModule ()
 
 ProcessModule (FieldSharedPtr p_f)
 
 ProcessModule (MeshSharedPtr p_m)
 
- Public Member Functions inherited from Nektar::Utilities::Module
 Module (FieldSharedPtr p_f)
 
void RegisterConfig (string key, string value)
 Register a configuration option with a module. More...
 
void PrintConfig ()
 Print out all configuration options for a module. More...
 
void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
bool GetRequireEquiSpaced (void)
 
void SetRequireEquiSpaced (bool pVal)
 
void EvaluateTriFieldAtEquiSpacedPts (LocalRegions::ExpansionSharedPtr &exp, const Array< OneD, const NekDouble > &infield, Array< OneD, NekDouble > &outfield)
 
 Module (MeshSharedPtr p_m)
 
virtual void Process ()=0
 
void RegisterConfig (string key, string value)
 
void PrintConfig ()
 
void SetDefaults ()
 
MeshSharedPtr GetMesh ()
 
virtual void ProcessVertices ()
 Extract element vertices. More...
 

Static Public Member Functions

static boost::shared_ptr< Modulecreate (FieldSharedPtr f)
 Creates an instance of this class. More...
 

Static Public Attributes

static ModuleKey className
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::Utilities::Module
 Module ()
 
virtual void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges. More...
 
virtual void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces. More...
 
virtual void ProcessElements ()
 Generate element IDs. More...
 
virtual void ProcessComposites ()
 Generate composites. More...
 
void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
void PrismLines (int prism, PerMap &perFaces, set< int > &prismsDone, vector< ElementSharedPtr > &line)
 
- Protected Attributes inherited from Nektar::Utilities::Module
FieldSharedPtr m_f
 Field object. More...
 
map< string, ConfigOptionm_config
 List of configuration values. More...
 
bool m_requireEquiSpaced
 
MeshSharedPtr m_mesh
 Mesh object. More...
 

Detailed Description

This processing module calculates the height of an element connected to a surface and adds it as an extra-field to the output file.

Definition at line 50 of file ProcessSurfDistance.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessSurfDistance::ProcessSurfDistance ( FieldSharedPtr  f)

Definition at line 53 of file ProcessSurfDistance.cpp.

References Nektar::Utilities::Module::m_config, and Nektar::Utilities::Module::m_f.

54  : ProcessModule(f)
55 {
56  m_config["bnd"] = ConfigOption(false,"-1","Boundary region to calculate height");
57  f->m_writeBndFld = true;
58  f->m_declareExpansionAsContField = true;
59  m_f->m_fldToBnd = false;
60 }
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
Nektar::Utilities::ProcessSurfDistance::~ProcessSurfDistance ( )
virtual

Definition at line 62 of file ProcessSurfDistance.cpp.

63 {
64 }

Member Function Documentation

static boost::shared_ptr<Module> Nektar::Utilities::ProcessSurfDistance::create ( FieldSharedPtr  f)
inlinestatic

Creates an instance of this class.

Definition at line 54 of file ProcessSurfDistance.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

54  {
56  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::ProcessSurfDistance::Process ( po::variables_map &  vm)
virtual

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 66 of file ProcessSurfDistance.cpp.

References ASSERTL0, Nektar::LibUtilities::ePrism, Nektar::Utilities::Module::m_config, Nektar::Utilities::Module::m_f, Vmath::Vsub(), Vmath::Vvtvp(), and Vmath::Zero().

67 {
68  int i, j, k, cnt;
69  int surf = m_config["bnd"].as<int>();
70 
71  ASSERTL0(surf >= 0, "Invalid surface "+boost::lexical_cast<string>(surf));
72 
73  // Add this boundary region to the list that we will output.
74  m_f->m_bndRegionsToWrite.push_back(surf);
75 
76  // Remove existing fields.
77  m_f->m_exp.resize(1);
78 
79  // Grab boundary expansions.
81  m_f->m_exp[0]->GetBndCondExpansions();
82 
83  // Get map that takes us from boundary element to element.
84  Array<OneD, int> BoundarytoElmtID, BoundarytoTraceID;
85  m_f->m_exp[0]->GetBoundaryToElmtMap(BoundarytoElmtID, BoundarytoTraceID);
86 
87  if (m_f->m_fielddef.size() == 0)
88  {
89  m_f->m_fielddef = m_f->m_exp[0]->GetFieldDefinitions();
90  m_f->m_fielddef[0]->m_fields.push_back("dist");
91  }
92  else
93  {
94  // Override field variable
95  m_f->m_fielddef[0]->m_fields[0] = "dist";
96  }
97 
98  for (i = cnt = 0; i < BndExp.num_elements(); ++i)
99  {
100  if (i != surf)
101  {
102  cnt += BndExp[i]->GetExpSize();
103  continue;
104  }
105 
106  for (j = 0; j < BndExp[i]->GetExpSize(); ++j, ++cnt)
107  {
108  int elmtNum = BoundarytoElmtID [cnt];
109  int facetNum = BoundarytoTraceID[cnt];
110 
111  // Get boundary and element expansions.
112  LocalRegions::ExpansionSharedPtr bndElmt = BndExp[i]->GetExp(j);
114  m_f->m_exp[0]->GetExp(elmtNum);
115 
116  ASSERTL0(elmt->DetShapeType() == LibUtilities::ePrism,
117  "Only prisms supported for now!");
118 
119  ASSERTL0(facetNum == 1 || facetNum == 3,
120  "Surface must be on a triangular face of the prism.");
121 
122  int nq = elmt ->GetTotPoints();
123  int nqBnd = bndElmt->GetTotPoints();
124 
126  x[0] = Array<OneD, NekDouble>(nq);
127  x[1] = Array<OneD, NekDouble>(nq);
128  x[2] = Array<OneD, NekDouble>(nq);
129  elmt->GetCoords(x[0], x[1], x[2]);
130 
131  Array<OneD, NekDouble> face1(nqBnd), face3(nqBnd);
133  BndExp[i]->UpdatePhys() + BndExp[i]->GetPhys_Offset(j);
134 
135  // Zero existing value.
136  Vmath::Zero(nqBnd, dist, 1);
137 
138  // Calculate distance between two faces of prism.
139  for (k = 0; k < 3; ++k)
140  {
141  elmt->GetFacePhysVals(1, bndElmt, x[k], face1);
142  elmt->GetFacePhysVals(3, bndElmt, x[k], face3);
143  Vmath::Vsub (nqBnd, face1, 1, face3, 1, face1, 1);
144  Vmath::Vvtvp(nqBnd, face1, 1, face1, 1, dist, 1, dist, 1);
145  }
146  }
147 
148  BndExp[i]->FwdTrans(BndExp[i]->GetPhys(), BndExp[i]->UpdateCoeffs());
149  }
150 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:428
map< string, ConfigOption > m_config
List of configuration values.
FieldSharedPtr m_f
Field object.
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:329
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:359

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessSurfDistance::className
static
Initial value:
=
ModuleKey(eProcessModule, "surfdistance"),
"Computes height of element connected to a surface.")

Definition at line 57 of file ProcessSurfDistance.h.