DOLFIN
DOLFIN C++ interface
TopologyComputation.h
1 // Copyright (C) 2006-2010 Anders Logg
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 // Modified by Garth N. Wells 2012.
19 //
20 // First added: 2006-06-02
21 // Last changed: 2012-02-14
22 
23 #ifndef __TOPOLOGY_COMPUTATION_H
24 #define __TOPOLOGY_COMPUTATION_H
25 
26 #include <vector>
27 
28 namespace dolfin
29 {
30 
31  class Mesh;
32 
35 
37  {
38  public:
39 
42  static std::size_t compute_entities(Mesh& mesh, std::size_t dim);
43 
48  static std::size_t compute_entities_old(Mesh& mesh, std::size_t dim);
49 
51  static void compute_connectivity(Mesh& mesh, std::size_t d0,
52  std::size_t d1);
53 
54  private:
55 
56  // cell-to-enity (tdim, dim). Ths functions builds a list of all entities of
57  // Compute mesh entities of given topological dimension, and connectivity
58  // dimension dim for every cell, keyed by the sorted lists of vertex indices
59  // that make up the entity. Also attached is whether or nor the entity is a
60  // ghost, the local entity index (relative to the generating cell) and the
61  // generating cell index. This list is then sorted, with matching keys
62  // corresponding to a single enity. The entities are numbered such that ghost
63  // entities come after al regular enrities.
64  //
65  // Returns the number of entities
66  //
67  //The function is templated over the number of vertices that make up an
68  //entity of dimension dim. This avoid dynamic memoryt allocations, yielding
69  //significant performance improvements
70  template<int N>
71  static std::int32_t compute_entities_by_key_matching(Mesh& mesh, int dim);
72 
73  // Compute connectivity from transpose
74  static void compute_from_transpose(Mesh& mesh, std::size_t d0,
75  std::size_t d1);
76 
77  // Direct lookup of entity from vertices in a map
78  static void compute_from_map(Mesh& mesh,
79  std::size_t d0,
80  std::size_t d1);
81 
82  // Compute connectivity from intersection
83  static void compute_from_intersection(Mesh& mesh, std::size_t d0,
84  std::size_t d1, std::size_t d);
85 
86  };
87 
88 }
89 
90 #endif
static void compute_connectivity(Mesh &mesh, std::size_t d0, std::size_t d1)
Compute connectivity for given pair of topological dimensions.
Definition: TopologyComputation.cpp:84
Definition: adapt.h:29
Definition: TopologyComputation.h:36
static std::size_t compute_entities_old(Mesh &mesh, std::size_t dim)
static std::size_t compute_entities(Mesh &mesh, std::size_t dim)
Definition: TopologyComputation.cpp:42
Definition: Mesh.h:82