Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::ProcessScalar Class Reference

This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian. More...

#include <ProcessScalar.h>

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

Public Member Functions

 ProcessScalar (MeshSharedPtr m)
 
virtual ~ProcessScalar ()
 
virtual void Process ()
 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)
 
virtual void Process (po::variables_map &vm)=0
 
virtual std::string GetModuleName ()=0
 
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)
 
void RegisterConfig (std::string key, std::string value)
 
void PrintConfig ()
 
void SetDefaults ()
 
MeshSharedPtr GetMesh ()
 
virtual void ProcessVertices ()
 Extract element vertices. More...
 
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...
 
virtual void ClearElementLinks ()
 

Static Public Member Functions

static boost::shared_ptr< Modulecreate (MeshSharedPtr m)
 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 ()
 
void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
void PrismLines (int prism, PerMap &perFaces, std::set< int > &prismsDone, std::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...
 
std::map< std::string,
ConfigOption
m_config
 List of configuration values. More...
 

Detailed Description

This processing module calculates the Jacobian of elements using SpatialDomains::GeomFactors and the Element::GetGeom method. For now it simply prints a list of elements which have negative Jacobian.

Definition at line 52 of file ProcessScalar.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessScalar::ProcessScalar ( MeshSharedPtr  m)

Definition at line 55 of file ProcessScalar.cpp.

References Nektar::Utilities::Module::m_config.

55  : ProcessModule(m)
56 {
57  m_config["surf"] = ConfigOption(
58  false, "-1", "Tag identifying surface/composite to process.");
59  m_config["nq"] =
60  ConfigOption(false, "-1", "Number of quadrature points to generate.");
61  m_config["scalar"] = ConfigOption(false, "", "Expression to evaluate.");
62 }
map< string, ConfigOption > m_config
List of configuration values.
Nektar::Utilities::ProcessScalar::~ProcessScalar ( )
virtual

Definition at line 64 of file ProcessScalar.cpp.

65 {
66 }

Member Function Documentation

static boost::shared_ptr<Module> Nektar::Utilities::ProcessScalar::create ( MeshSharedPtr  m)
inlinestatic

Creates an instance of this class.

Definition at line 56 of file ProcessScalar.h.

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

57  {
59  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::ProcessScalar::Process ( )
virtual

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 68 of file ProcessScalar.cpp.

References Nektar::LibUtilities::AnalyticExpressionEvaluator::DefineFunction(), Nektar::ParseUtils::GenerateSeqVector(), Nektar::Utilities::Module::m_config, Nektar::Utilities::Module::m_mesh, Nektar::NekMeshUtils::Node::m_x, Nektar::NekMeshUtils::Node::m_y, Nektar::NekMeshUtils::Node::m_z, and Nektar::NekMeshUtils::surf.

69 {
70  int i, j, k;
71  string surf = m_config["surf"].as<string>();
72 
73  // Obtain vector of surface IDs from string.
74  vector<unsigned int> surfs;
75  ParseUtils::GenerateSeqVector(surf.c_str(), surfs);
76  sort(surfs.begin(), surfs.end());
77 
78  // If we're running in verbose mode print out a list of surfaces.
79  if (m_mesh->m_verbose)
80  {
81  cout << "ProcessScalar: extracting surface"
82  << (surfs.size() > 1 ? "s" : "") << " " << surf << endl;
83  }
84 
85  const int nq = m_config["nq"].as<int>();
86  string expr = m_config["scalar"].as<string>();
87 
88  LibUtilities::AnalyticExpressionEvaluator rEval;
89  int rExprId = rEval.DefineFunction("x y z", expr);
90 
91  // Make a copy of all existing elements of one dimension lower.
92  vector<ElementSharedPtr> el = m_mesh->m_element[m_mesh->m_expDim - 1];
93 
94  // Iterate over list of surface elements.
95  for (i = 0; i < el.size(); ++i)
96  {
97  // Work out whether this lies on our surface of interest.
98  vector<int> inter, tags = el[i]->GetTagList();
99 
100  sort(tags.begin(), tags.end());
101  set_intersection(surfs.begin(),
102  surfs.end(),
103  tags.begin(),
104  tags.end(),
105  back_inserter(inter));
106 
107  // It doesn't continue to next element.
108  if (inter.size() != 1)
109  {
110  continue;
111  }
112 
113  // Grab face link.
114  FaceSharedPtr f = el[i]->GetFaceLink();
115 
116  // Update vertices
117  for (j = 0; j < 4; ++j)
118  {
119  NodeSharedPtr n = f->m_vertexList[j];
120  n->m_z = rEval.Evaluate(rExprId, n->m_x, n->m_y, 0.0, 0.0);
121 
122  if (n->m_z < 1e-32)
123  {
124  n->m_z = 0;
125  }
126  }
127 
128  // Put curvature into edges
129  for (j = 0; j < f->m_edgeList.size(); ++j)
130  {
131  NodeSharedPtr n1 = f->m_edgeList[j]->m_n1;
132  NodeSharedPtr n2 = f->m_edgeList[j]->m_n2;
133  Node disp = *n2 - *n1;
134 
135  f->m_edgeList[j]->m_edgeNodes.clear();
136 
137  for (k = 1; k < nq - 1; ++k)
138  {
139  Node n = *n1 + disp * k / (nq - 1.0);
140  n.m_z = rEval.Evaluate(rExprId, n.m_x, n.m_y, 0.0, 0.0);
141  if (n.m_z < 1e-32)
142  {
143  n.m_z = 0;
144  }
145 
146  f->m_edgeList[j]->m_edgeNodes.push_back(
147  NodeSharedPtr(new Node(n)));
148  }
149  }
150  }
151 }
map< string, ConfigOption > m_config
List of configuration values.
MeshSharedPtr m_mesh
Mesh object.
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
static bool GenerateSeqVector(const char *const str, std::vector< unsigned int > &vec)
Definition: ParseUtils.hpp:79
Represents a point in the domain.
Definition: Node.h:60
boost::shared_ptr< Node > NodeSharedPtr
Definition: Node.h:50
NekDouble m_x
X-coordinate.
Definition: Node.h:312
boost::shared_ptr< Face > FaceSharedPtr
Shared pointer to a face.
Definition: Face.h:378
NekDouble m_z
Z-coordinate.
Definition: Node.h:316

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessScalar::className
static
Initial value:
"Impose a scalar function z=f(x,y) on a surface.")

Definition at line 60 of file ProcessScalar.h.