DOLFIN
DOLFIN C++ interface
PlazaRefinementND.h
1 // Copyright (C) 2014 Chris Richardson
2 //
3 // This file is part of DOLFIN.
4 //
5 // DOLFIN is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // DOLFIN is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17 //
18 
19 #ifndef __PLAZA_REFINEMENT_ND_H
20 #define __PLAZA_REFINEMENT_ND_H
21 
22 namespace dolfin
23 {
24  class Mesh;
25  class MeshRelation;
26  class ParallelRefinement;
27 
34  {
35  public:
36 
49  static void refine(Mesh& new_mesh, const Mesh& mesh, bool redistribute,
50  bool calculate_parent_facets);
51 
66  static void refine(Mesh& new_mesh, const Mesh& mesh,
67  const MeshFunction<bool>& refinement_marker,
68  bool redistribute,
69  bool calculate_parent_facets);
70 
84  static void refine(Mesh& new_mesh, const Mesh& mesh,
85  const MeshFunction<bool>& refinement_marker,
86  bool calculate_parent_facets,
87  MeshRelation& mesh_relation);
88 
89 
105  static void get_simplices
106  (std::vector<std::size_t>& simplex_set,
107  const std::vector<bool>& marked_edges,
108  const std::vector<std::size_t>& longest_edge,
109  std::size_t tdim, bool uniform);
110 
111  private:
112 
113  // Get the longest edge of each face (using local mesh index)
114  static void face_long_edge(std::vector<unsigned int>& long_edge,
115  std::vector<bool>& edge_ratio_ok,
116  const Mesh& mesh);
117 
118  // 2D version of subdivision allowing for uniform subdivision (flag)
119  static void get_triangles
120  (std::vector<std::size_t>& tri_set,
121  const std::vector<bool>& marked_edges,
122  const std::size_t longest_edge,
123  bool uniform);
124 
125  // 3D version of subdivision
126  static void get_tetrahedra
127  (std::vector<std::size_t>& tet_set,
128  const std::vector<bool>& marked_edges,
129  const std::vector<std::size_t>& longest_edge);
130 
131  // Convenient interface for both uniform and marker refinement
132  static void do_refine(Mesh& new_mesh, const Mesh& mesh,
133  ParallelRefinement& p_ref,
134  const std::vector<unsigned int>& long_edge,
135  const std::vector<bool>& edge_ratio_ok,
136  bool redistribute,
137  bool calculate_parent_facets,
138  MeshRelation& mesh_relation);
139 
140  // Propagate edge markers according to rules (longest edge
141  // of each face must be marked, if any edge of face is marked)
142  static void enforce_rules(ParallelRefinement& p_ref,
143  const Mesh& mesh,
144  const std::vector<unsigned int>& long_edge);
145 
146  // Add parent facet markers to new mesh, based on new vertices
147  // Only works in 2D at present
148  static void set_parent_facet_markers(const Mesh& mesh, Mesh& new_mesh,
149  const std::map<std::size_t, std::size_t>& new_vertex_map);
150 
151 
152  };
153 
154 }
155 
156 #endif
Definition: adapt.h:41
Definition: MeshRelation.h:34
static void get_simplices(std::vector< std::size_t > &simplex_set, const std::vector< bool > &marked_edges, const std::vector< std::size_t > &longest_edge, std::size_t tdim, bool uniform)
Definition: PlazaRefinementND.cpp:43
Definition: adapt.h:29
Data structure and methods for refining meshes in parallel.
Definition: ParallelRefinement.h:42
Definition: PlazaRefinementND.h:33
static void refine(Mesh &new_mesh, const Mesh &mesh, bool redistribute, bool calculate_parent_facets)
Definition: PlazaRefinementND.cpp:311
Definition: Mesh.h:82