Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Nektar::Utilities::ProcessJac 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 <ProcessJac.h>

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

Public Member Functions

 ProcessJac (MeshSharedPtr m)
 
virtual ~ProcessJac ()
 
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 ProcessJac.h.

Constructor & Destructor Documentation

Nektar::Utilities::ProcessJac::ProcessJac ( MeshSharedPtr  m)

Definition at line 54 of file ProcessJac.cpp.

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

54  : ProcessModule(m)
55  {
56  m_config["extract"] = ConfigOption(
57  true, "0", "Extract non-valid elements from mesh.");
58  m_config["removecurveifsingular"] = ConfigOption(
59  true, "0", "remove curve nodes if element is singular.");
60  m_config["list"] = ConfigOption(
61  true, "0", "Print list of elements having negative Jacobian.");
62  }
map< string, ConfigOption > m_config
List of configuration values.
Nektar::Utilities::ProcessJac::~ProcessJac ( )
virtual

Definition at line 64 of file ProcessJac.cpp.

65  {
66 
67  }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 55 of file ProcessJac.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::ProcessJac::Process ( )
virtual

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 69 of file ProcessJac.cpp.

References Nektar::StdRegions::ElementTypeMap, Nektar::iterator, Nektar::Utilities::Module::m_config, Nektar::Utilities::Module::m_mesh, Nektar::Utilities::Module::ProcessComposites(), Nektar::Utilities::Module::ProcessEdges(), Nektar::Utilities::Module::ProcessElements(), Nektar::Utilities::Module::ProcessFaces(), and Nektar::Utilities::Module::ProcessVertices().

70  {
71  if (m_mesh->m_verbose)
72  {
73  cout << "ProcessJac: Calculating Jacobians... " << endl;
74  }
75 
76  bool extract = m_config["extract"].as<bool>();
77  bool printList = m_config["list"].as<bool>();
78  bool RemoveCurveIfSingular = m_config["removecurveifsingular"].as<bool>();
79  vector<ElementSharedPtr> el = m_mesh->m_element[m_mesh->m_expDim];
80 
81  if (extract)
82  {
83  m_mesh->m_element[m_mesh->m_expDim].clear();
84  }
85 
86  if (printList)
87  {
88  cout << "Elements with negative Jacobian:" << endl;
89  }
90 
91  int nNeg = 0;
92 
93  // Iterate over list of elements of expansion dimension.
94  for (int i = 0; i < el.size(); ++i)
95  {
96  // Create elemental geometry.
98  el[i]->GetGeom(m_mesh->m_spaceDim);
99 
100  // Generate geometric factors.
102  geom->GetGeomFactors();
103 
104  // Get the Jacobian and, if it is negative, print a warning
105  // message.
106  if (!gfac->IsValid())
107  {
108  nNeg++;
109 
110  if (printList)
111  {
112  cout << " - " << el[i]->GetId() << " ("
113  << StdRegions::ElementTypeMap[el[i]->GetConf().m_e]
114  << ")" << endl;
115  }
116 
117  if(RemoveCurveIfSingular)
118  {
119  int nSurf = el[i]->GetFaceCount();
120  if(nSurf == 5) // prism mesh
121  {
122  // find edges ndoes and blend to far side.
123  for(int e = 0; e < el[i]->GetEdgeCount(); ++e)
124  {
125  EdgeSharedPtr ed = el[i]->GetEdge(e);
126  EdgeSet::iterator it;
127  // find edge in m_edgeSet;
128  if((it = m_mesh->m_edgeSet.find(ed)) != m_mesh->m_edgeSet.end())
129  {
130  if((*it)->m_edgeNodes.size())
131  {
132  vector<NodeSharedPtr> zeroNodes;
133  (*it)->m_edgeNodes = zeroNodes;
134  }
135  }
136  }
137  }
138  }
139 
140  if (extract)
141  {
142  m_mesh->m_element[m_mesh->m_expDim].push_back(el[i]);
143  }
144  }
145  }
146 
147  if (extract)
148  {
149  m_mesh->m_element[m_mesh->m_expDim-1].clear();
150  ProcessVertices();
151  ProcessEdges();
152  ProcessFaces();
153  ProcessElements();
155  }
156 
157  if (printList || m_mesh->m_verbose)
158  {
159  cout << "Total negative Jacobians: " << nNeg << endl;
160  }
161  else if (nNeg > 0)
162  {
163  cout << "WARNING: Detected " << nNeg << " element"
164  << (nNeg == 1 ? "" : "s") << " with negative Jacobian."
165  << endl;
166  }
167  }
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
Definition: MeshElements.h:318
map< string, ConfigOption > m_config
List of configuration values.
MeshSharedPtr m_mesh
Mesh object.
virtual void ProcessEdges(bool ReprocessEdges=true)
Extract element edges.
virtual void ProcessVertices()
Extract element vertices.
virtual void ProcessElements()
Generate element IDs.
virtual void ProcessComposites()
Generate composites.
const char *const ElementTypeMap[]
Definition: StdRegions.hpp:76
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
virtual void ProcessFaces(bool ReprocessFaces=true)
Extract element faces.
boost::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:53

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessJac::className
static
Initial value:
=
"Process elements based on values of Jacobian.")

Definition at line 58 of file ProcessJac.h.