Nektar++
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:
[legend]

Public Member Functions

 ProcessScalar (NekMeshUtils::MeshSharedPtr m)
 
virtual ~ProcessScalar ()
 
virtual void Process ()
 Write mesh to output file. More...
 
- Public Member Functions inherited from Nektar::NekMeshUtils::ProcessModule
NEKMESHUTILS_EXPORT ProcessModule (MeshSharedPtr p_m)
 
- Public Member Functions inherited from Nektar::NekMeshUtils::Module
NEKMESHUTILS_EXPORT Module (MeshSharedPtr p_m)
 
NEKMESHUTILS_EXPORT void RegisterConfig (std::string key, std::string value=std::string())
 Register a configuration option with a module. More...
 
NEKMESHUTILS_EXPORT void PrintConfig ()
 Print out all configuration options for a module. More...
 
NEKMESHUTILS_EXPORT void SetDefaults ()
 Sets default configuration options for those which have not been set. More...
 
NEKMESHUTILS_EXPORT MeshSharedPtr GetMesh ()
 
virtual NEKMESHUTILS_EXPORT void ProcessVertices ()
 Extract element vertices. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessEdges (bool ReprocessEdges=true)
 Extract element edges. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessFaces (bool ReprocessFaces=true)
 Extract element faces. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessElements ()
 Generate element IDs. More...
 
virtual NEKMESHUTILS_EXPORT void ProcessComposites ()
 Generate composites. More...
 
virtual NEKMESHUTILS_EXPORT void ClearElementLinks ()
 

Static Public Member Functions

static std::shared_ptr< Modulecreate (NekMeshUtils::MeshSharedPtr m)
 Creates an instance of this class. More...
 

Static Public Attributes

static NekMeshUtils::ModuleKey className
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::NekMeshUtils::Module
NEKMESHUTILS_EXPORT void ReorderPrisms (PerMap &perFaces)
 Reorder node IDs so that prisms and tetrahedra are aligned correctly. More...
 
NEKMESHUTILS_EXPORT void PrismLines (int prism, PerMap &perFaces, std::set< int > &prismsDone, std::vector< ElementSharedPtr > &line)
 
- Protected Attributes inherited from Nektar::NekMeshUtils::Module
MeshSharedPtr m_mesh
 Mesh object. More...
 
std::map< std::string, ConfigOptionm_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 51 of file ProcessScalar.h.

Constructor & Destructor Documentation

◆ ProcessScalar()

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

Definition at line 54 of file ProcessScalar.cpp.

References Nektar::NekMeshUtils::Module::m_config.

54  : ProcessModule(m)
55 {
56  m_config["surf"] = ConfigOption(
57  false, "-1", "Tag identifying surface/composite to process.");
58  m_config["nq"] =
59  ConfigOption(false, "-1", "Number of quadrature points to generate.");
60  m_config["scalar"] = ConfigOption(false, "", "Expression to evaluate.");
61 }
Represents a command-line configuration option.
NEKMESHUTILS_EXPORT ProcessModule(MeshSharedPtr p_m)
std::map< std::string, ConfigOption > m_config
List of configuration values.

◆ ~ProcessScalar()

Nektar::Utilities::ProcessScalar::~ProcessScalar ( )
virtual

Definition at line 63 of file ProcessScalar.cpp.

64 {
65 }

Member Function Documentation

◆ create()

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

Creates an instance of this class.

Definition at line 55 of file ProcessScalar.h.

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

56  {
58  }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ Process()

void Nektar::Utilities::ProcessScalar::Process ( )
virtual

Write mesh to output file.

Implements Nektar::NekMeshUtils::Module.

Definition at line 67 of file ProcessScalar.cpp.

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

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

Member Data Documentation

◆ className

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

Definition at line 59 of file ProcessScalar.h.