Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 (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)
 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 boost::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,
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 ( NekMeshUtils::MeshSharedPtr  m)

Definition at line 55 of file ProcessScalar.cpp.

References Nektar::NekMeshUtils::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 }
Represents a command-line configuration option.
NEKMESHUTILS_EXPORT ProcessModule(MeshSharedPtr p_m)
std::map< std::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 ( NekMeshUtils::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::NekMeshUtils::Module.

Definition at line 68 of file ProcessScalar.cpp.

References Nektar::LibUtilities::AnalyticExpressionEvaluator::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.

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 }
NekDouble m_y
Y-coordinate.
Definition: Node.h:401
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
std::map< std::string, ConfigOption > m_config
List of configuration values.
NekDouble m_x
X-coordinate.
Definition: Node.h:399
boost::shared_ptr< Face > FaceSharedPtr
Definition: Face.h:153
NekDouble m_z
Z-coordinate.
Definition: Node.h:403

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.