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:
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
 
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 (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 (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 ()
 
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 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

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

Definition at line 56 of file ProcessScalar.cpp.

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

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

Definition at line 66 of file ProcessScalar.cpp.

67  {
68  }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 55 of file ProcessScalar.h.

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

55  {
57  }
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 70 of file ProcessScalar.cpp.

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

71  {
72  int i, j, k;
73  string surf = m_config["surf"].as<string>();
74 
75  // Obtain vector of surface IDs from string.
76  vector<unsigned int> surfs;
77  ParseUtils::GenerateSeqVector(surf.c_str(), surfs);
78  sort(surfs.begin(), surfs.end());
79 
80  // If we're running in verbose mode print out a list of surfaces.
81  if (m_mesh->m_verbose)
82  {
83  cout << "ProcessScalar: extracting surface"
84  << (surfs.size() > 1 ? "s" : "") << " " << surf << endl;
85  }
86 
87  const int nq = m_config["nq"].as<int>();
88  string expr = m_config["scalar"].as<string>();
89 
90  LibUtilities::AnalyticExpressionEvaluator rEval;
91  int rExprId = rEval.DefineFunction("x y z", expr);
92 
93  // Make a copy of all existing elements of one dimension lower.
94  vector<ElementSharedPtr> el = m_mesh->m_element[m_mesh->m_expDim-1];
95 
96  // Iterate over list of surface elements.
97  for (i = 0; i < el.size(); ++i)
98  {
99  // Work out whether this lies on our surface of interest.
100  vector<int> inter, tags = el[i]->GetTagList();
101 
102  sort(tags.begin(), tags.end());
103  set_intersection(surfs.begin(), surfs.end(),
104  tags .begin(), 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.
boost::shared_ptr< Face > FaceSharedPtr
Shared pointer to a face.
Definition: MeshElements.h:550
boost::shared_ptr< Node > NodeSharedPtr
Shared pointer to a Node.
Definition: MeshElements.h:195
static bool GenerateSeqVector(const char *const str, std::vector< unsigned int > &vec)
Definition: ParseUtils.hpp:78

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 58 of file ProcessScalar.h.