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::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
 
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 ProcessJac.h.

Constructor & Destructor Documentation

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

Definition at line 52 of file ProcessJac.cpp.

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

52  : ProcessModule(m)
53 {
54  m_config["extract"] =
55  ConfigOption(true, "0", "Extract non-valid elements from mesh.");
56  m_config["list"] = ConfigOption(
57  true, "0", "Print list of elements having negative Jacobian.");
58 }
map< string, ConfigOption > m_config
List of configuration values.
Nektar::Utilities::ProcessJac::~ProcessJac ( )
virtual

Definition at line 60 of file ProcessJac.cpp.

61 {
62 }

Member Function Documentation

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

Creates an instance of this class.

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

Write mesh to output file.

Implements Nektar::Utilities::Module.

Definition at line 64 of file ProcessJac.cpp.

References 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(), Nektar::Utilities::Module::ProcessVertices(), and Nektar::LibUtilities::ShapeTypeMap.

65 {
66  if (m_mesh->m_verbose)
67  {
68  cout << "ProcessJac: Calculating Jacobians... " << endl;
69  }
70 
71  bool extract = m_config["extract"].as<bool>();
72  bool printList = m_config["list"].as<bool>();
73 
74  vector<ElementSharedPtr> el = m_mesh->m_element[m_mesh->m_expDim];
75 
76  if (extract)
77  {
78  m_mesh->m_element[m_mesh->m_expDim].clear();
79  }
80 
81  if (printList)
82  {
83  cout << "Elements with negative Jacobian:" << endl;
84  }
85 
86  int nNeg = 0;
87 
88  Array<OneD, int> bin(20, 0);
89 
90  // Iterate over list of elements of expansion dimension.
91  for (int i = 0; i < el.size(); ++i)
92  {
93  // Create elemental geometry.
95  el[i]->GetGeom(m_mesh->m_spaceDim);
96 
97  // Generate geometric factors.
98  SpatialDomains::GeomFactorsSharedPtr gfac = geom->GetGeomFactors();
99 
100  // Get the Jacobian and, if it is negative, print a warning
101  // message.
102  if (!gfac->IsValid())
103  {
104  nNeg++;
105 
106  if (printList)
107  {
108  cout << " - " << el[i]->GetId() << " ("
109  << LibUtilities::ShapeTypeMap[el[i]->GetConf().m_e] << ")"
110  << endl;
111  }
112 
113  if (extract)
114  {
115  m_mesh->m_element[m_mesh->m_expDim].push_back(el[i]);
116  }
117  }
118  }
119 
120  if (extract)
121  {
122  m_mesh->m_element[m_mesh->m_expDim - 1].clear();
123  ProcessVertices();
124  ProcessEdges();
125  ProcessFaces();
126  ProcessElements();
128  }
129 
130  if (printList || m_mesh->m_verbose)
131  {
132  cout << "Total negative Jacobians: " << nNeg << endl;
133  }
134  else if (nNeg > 0)
135  {
136  cout << "WARNING: Detected " << nNeg << " element"
137  << (nNeg == 1 ? "" : "s") << " with negative Jacobian." << endl;
138  }
139 }
map< string, ConfigOption > m_config
List of configuration values.
MeshSharedPtr m_mesh
Mesh object.
const char *const ShapeTypeMap[]
Definition: ShapeType.hpp:66
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.
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 60 of file ProcessJac.h.