DOLFIN
DOLFIN C++ interface
LocalMeshCoarsening.h
1 // Copyright (C) 2006 Johan Hoffman
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 // First added: 2006-11-01
19 
20 #ifndef __LOCAL_MESH_COARSENING_H
21 #define __LOCAL_MESH_COARSENING_H
22 
23 #include <vector>
24 
25 namespace dolfin
26 {
27 
28  class Mesh;
29  class Edge;
30  class Vertex;
31  class MeshEditor;
32  template <typename T> class MeshFunction;
33 
35 
37  {
38  public:
39 
41  static void coarsen_mesh_by_edge_collapse(Mesh& mesh,
42  MeshFunction<bool>& cell_marker,
43  bool coarsen_boundary = false);
44 
45  private:
46 
48  static bool coarsen_mesh_ok(Mesh& mesh, std::size_t edge_index, std::size_t* edge_vertex,
49  MeshFunction<bool>& vertex_forbidden);
50 
52  static void collapse_edge(Mesh& mesh, Edge& edge,
53  Vertex& vertex_to_remove,
54  MeshFunction<bool>& cell_to_remove,
55  std::vector<int>& old2new_vertex,
56  std::vector<int>& old2new_cell,
57  MeshEditor& editor,
58  std::size_t& current_cell);
59 
61  static bool coarsen_cell(Mesh& mesh, Mesh& coarse_mesh,
62  int cell_id,
63  std::vector<int>& old2new_vertex,
64  std::vector<int>& old2new_cell,
65  bool coarsen_boundary = false);
66 
67  };
68 
69 }
70 
71 #endif
Definition: adapt.h:41
A Vertex is a MeshEntity of topological dimension 0.
Definition: Vertex.h:37
Definition: adapt.h:29
static void coarsen_mesh_by_edge_collapse(Mesh &mesh, MeshFunction< bool > &cell_marker, bool coarsen_boundary=false)
Coarsen simplicial mesh locally by edge collapse.
Definition: LocalMeshCoarsening.cpp:45
An Edge is a MeshEntity of topological dimension 1.
Definition: Edge.h:39
Definition: MeshEditor.h:36
This class implements local mesh coarsening for different mesh types.
Definition: LocalMeshCoarsening.h:36
Definition: Mesh.h:82