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::ProcessExtrude Class Reference

This processing module extrudes a 2d mesh in the z direction. More...

#include <ProcessExtrude.h>

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

Public Member Functions

 ProcessExtrude (NekMeshUtils::MeshSharedPtr m)
 
virtual ~ProcessExtrude ()
 
virtual void Process ()
 
- 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 extrudes a 2d mesh in the z direction.

Definition at line 48 of file ProcessExtrude.h.

Constructor & Destructor Documentation

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

Definition at line 50 of file ProcessExtrude.cpp.

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

50  : ProcessModule(m)
51 {
52  m_config["layers"] =
53  ConfigOption(false, "5", "Number of layers to extrude");
54  m_config["length"] = ConfigOption(false, "1.0", "Length of extrusion");
55 }
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::ProcessExtrude::~ProcessExtrude ( )
virtual

Definition at line 57 of file ProcessExtrude.cpp.

58 {
59 }

Member Function Documentation

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

Creates an instance of this class.

Definition at line 52 of file ProcessExtrude.h.

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

53  {
55  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::Utilities::ProcessExtrude::Process ( )
virtual

Implements Nektar::NekMeshUtils::Module.

Definition at line 61 of file ProcessExtrude.cpp.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Nektar::LibUtilities::eHexahedron, Nektar::LibUtilities::ePrism, Nektar::NekMeshUtils::GetElementFactory(), Nektar::iterator, Nektar::NekMeshUtils::Module::m_config, Nektar::NekMeshUtils::Module::m_mesh, class_topology::Node, Nektar::NekMeshUtils::Module::ProcessComposites(), Nektar::NekMeshUtils::Module::ProcessEdges(), Nektar::NekMeshUtils::Module::ProcessElements(), and Nektar::NekMeshUtils::Module::ProcessFaces().

62 {
63  int nLayers = m_config["layers"].as<int>();
64  NekDouble length = m_config["length"].as<NekDouble>();
65 
66  NekDouble dz = length / nLayers;
67 
68  ASSERTL0(m_mesh->m_spaceDim == 2,
69  "Extrude should only be called for a two dimensional mesh");
70 
71  // Increment space and expansion dimensions.
72  m_mesh->m_spaceDim++;
73  m_mesh->m_expDim++;
74 
75  // Grab a copy of the existing two-dimensional elements.
76  vector<ElementSharedPtr> el = m_mesh->m_element[2];
77 
78  // Reset mesh.
79  for (int d = 0; d <= 3; ++d)
80  {
81  m_mesh->m_element[d].clear();
82  }
83 
84  NodeSet nodes = m_mesh->m_vertexSet;
85 
86  map<int, NodeSharedPtr> id2node;
87 
89  for (it = nodes.begin(); it != nodes.end(); ++it)
90  {
91  id2node[(*it)->m_id] = *it;
92  }
93 
94  // Create vertices for subsequent layers.
95  for (int i = 1; i < nLayers + 1; ++i)
96  {
97  for (it = nodes.begin(); it != nodes.end(); ++it)
98  {
99  NodeSharedPtr n = *it;
100  NodeSharedPtr newNode(
101  new Node(i * nodes.size() + n->m_id, n->m_x, n->m_y, i * dz));
102  m_mesh->m_vertexSet.insert(newNode);
103  id2node[i * nodes.size() + n->m_id] = newNode;
104  }
105  }
106 
107  EdgeSet es = m_mesh->m_edgeSet; // copy edges for curvature
108 
109  for (int j = 0; j < nLayers; ++j)
110  {
111  for (int i = 0; i < el.size(); ++i)
112  {
113  vector<NodeSharedPtr> verts = el[i]->GetVertexList();
114  if (verts.size() == 4)
115  {
116  vector<NodeSharedPtr> nodeList(8);
117  nodeList[0] = id2node[verts[0]->m_id + j * nodes.size()];
118  nodeList[1] = id2node[verts[1]->m_id + j * nodes.size()];
119  nodeList[2] = id2node[verts[1]->m_id + (j + 1) * nodes.size()];
120  nodeList[3] = id2node[verts[0]->m_id + (j + 1) * nodes.size()];
121  nodeList[4] = id2node[verts[3]->m_id + j * nodes.size()];
122  nodeList[5] = id2node[verts[2]->m_id + j * nodes.size()];
123  nodeList[6] = id2node[verts[2]->m_id + (j + 1) * nodes.size()];
124  nodeList[7] = id2node[verts[3]->m_id + (j + 1) * nodes.size()];
125 
126  vector<int> tags(1);
127  tags[0] = 0;
128 
129  ElmtConfig conf(LibUtilities::eHexahedron, 1, false, false);
131  LibUtilities::eHexahedron, conf, nodeList, tags);
132 
133  m_mesh->m_element[3].push_back(E);
134  }
135  else
136  {
137  vector<NodeSharedPtr> nodeList(6);
138  nodeList[0] = id2node[verts[0]->m_id + (j + 1) * nodes.size()];
139  nodeList[1] = id2node[verts[1]->m_id + (j + 1) * nodes.size()];
140  nodeList[2] = id2node[verts[1]->m_id + j * nodes.size()];
141  nodeList[3] = id2node[verts[0]->m_id + j * nodes.size()];
142  nodeList[4] = id2node[verts[2]->m_id + (j + 1) * nodes.size()];
143  nodeList[5] = id2node[verts[2]->m_id + j * nodes.size()];
144 
145  vector<int> tags(1);
146  tags[0] = 1;
147 
148  ElmtConfig conf(LibUtilities::ePrism, 1, false, false);
150  LibUtilities::ePrism, conf, nodeList, tags);
151 
152  m_mesh->m_element[3].push_back(E);
153  }
154  }
155  }
156 
157  ProcessEdges();
158  ProcessFaces();
159  ProcessElements();
161 
162  EdgeSet::iterator eit;
163  for (eit = es.begin(); eit != es.end(); eit++)
164  {
165  if ((*eit)->m_edgeNodes.size() > 0)
166  {
167  for (int j = 0; j < nLayers + 1; ++j)
168  {
169  vector<NodeSharedPtr> ns((*eit)->m_edgeNodes.size());
170  for (int i = 0; i < ns.size(); i++)
171  {
172  NodeSharedPtr n = (*eit)->m_edgeNodes[i];
173  ns[i] = boost::shared_ptr<Node>(
174  new Node(0, n->m_x, n->m_y, j * dz));
175  }
176 
177  EdgeSharedPtr e = boost::shared_ptr<Edge>(
178  new Edge(id2node[(*eit)->m_n1->m_id + j * nodes.size()],
179  id2node[(*eit)->m_n2->m_id + j * nodes.size()]));
180 
181  EdgeSet::iterator f = m_mesh->m_edgeSet.find(e);
182  ASSERTL0(f != m_mesh->m_edgeSet.end(), "could not find edge");
183 
184  if ((*f)->m_n1 == e->m_n1)
185  {
186  (*f)->m_edgeNodes = ns;
187  }
188  else
189  {
190  reverse(ns.begin(), ns.end());
191  (*f)->m_edgeNodes = ns;
192  }
193  }
194  }
195  }
196 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
Basic information about an element.
Definition: ElementConfig.h:50
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
Represents an edge which joins two points.
Definition: Edge.h:58
ElementFactory & GetElementFactory()
Definition: Element.cpp:47
boost::unordered_set< NodeSharedPtr, NodeHash > NodeSet
Definition: Node.h:441
virtual NEKMESHUTILS_EXPORT void ProcessFaces(bool ReprocessFaces=true)
Extract element faces.
virtual NEKMESHUTILS_EXPORT void ProcessElements()
Generate element IDs.
boost::shared_ptr< Node > NodeSharedPtr
Definition: Node.h:50
double NekDouble
std::map< std::string, ConfigOption > m_config
List of configuration values.
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
Definition: Edge.h:135
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
virtual NEKMESHUTILS_EXPORT void ProcessEdges(bool ReprocessEdges=true)
Extract element edges.
boost::shared_ptr< Element > ElementSharedPtr
Definition: Edge.h:49
boost::unordered_set< EdgeSharedPtr, EdgeHash > EdgeSet
Definition: Edge.h:161
virtual NEKMESHUTILS_EXPORT void ProcessComposites()
Generate composites.

Member Data Documentation

ModuleKey Nektar::Utilities::ProcessExtrude::className
static
Initial value:

Definition at line 56 of file ProcessExtrude.h.