Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProcessCurvedEdges.cpp
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: ProcessCurvedEdges.cpp
4 //
5 // For more information, please see: http://www.nektar.info/
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Abstract base class for creating curved edges on boundaries.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #include <LocalRegions/SegExp.h>
37 #include <LocalRegions/QuadExp.h>
38 #include <LocalRegions/TriExp.h>
40 
42 
44 
45 #include "ProcessCurvedEdges.h"
46 
47 using namespace std;
48 using namespace Nektar::NekMeshUtils;
49 
50 namespace Nektar
51 {
52 namespace Utilities
53 {
54 /**
55  * @brief Default constructor.
56  */
57 ProcessCurvedEdges::ProcessCurvedEdges(MeshSharedPtr m) : ProcessModule(m)
58 {
59  m_config["surf"] =
60  ConfigOption(false, "-1", "Tag identifying surface to process.");
61  m_config["N"] = ConfigOption(false, "7", "Number of points along edge.");
62 }
63 
64 /**
65  * @brief Destructor.
66  */
68 {
69 }
70 
72 {
73  int surfTag = m_config["surf"].as<int>();
74  int prismedge[2][3] = {{0, 5, 4}, {2, 6, 7}};
75  int dim = m_mesh->m_expDim;
76 
77  for (int i = 0; i < m_mesh->m_element[dim].size(); ++i)
78  {
79  ElementSharedPtr el = m_mesh->m_element[dim][i];
80  int nSurf = dim == 3 ? el->GetFaceCount() : el->GetEdgeCount();
81 
82  for (int j = 0; j < nSurf; ++j)
83  {
84  int bl = el->GetBoundaryLink(j);
85  if (bl == -1)
86  {
87  continue;
88  }
89 
90  ElementSharedPtr bEl = m_mesh->m_element[dim - 1][bl];
91  vector<int> tags = bEl->GetTagList();
92 
93  if (find(tags.begin(), tags.end(), surfTag) == tags.end())
94  {
95  continue;
96  }
97 
98  switch (dim)
99  {
100  case 2:
101  {
102  EdgeSharedPtr edge = el->GetEdge(j);
103  GenerateEdgeNodes(edge);
104  }
105  break;
106 
107  case 3:
108  {
109  ASSERTL0(j == 1 || j == 3,
110  "Curved edge needs to be on prism triangular face");
111  // Check all edge interior points.
112  for (int k = 0; k < 3; ++k)
113  {
114  EdgeSharedPtr edge =
115  el->GetEdge(prismedge[(j - 1) / 2][k]);
116  GenerateEdgeNodes(edge);
117  }
118  }
119  break;
120 
121  default:
122  ASSERTL0(0,"Dimension not supported");
123  break;
124  }
125  }
126  }
127 }
128 }
129 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
void GenerateEdgeNodes(NekMeshUtils::EdgeSharedPtr edge)
virtual void Process()
Write mesh to output file.
STL namespace.
Represents a command-line configuration option.
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
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:147
Abstract base class for processing modules.
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:316
boost::shared_ptr< Element > ElementSharedPtr
Definition: Edge.h:49