~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to dolfin/mesh/Mesh.h

  • Committer: Garth N. Wells
  • Date: 2008-03-29 09:34:25 UTC
  • Revision ID: gnw20@cam.ac.uk-20080329093425-3ea2vhjvccq56zvi
Add some basic build & install instructions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
// Modified by Garth N. Wells 2007.
7
7
//
8
8
// First added:  2006-05-08
9
 
// Last changed: 2008-05-28
 
9
// Last changed: 2008-03-10
10
10
 
11
11
#ifndef __MESH_H
12
12
#define __MESH_H
13
13
 
14
14
#include <string>
15
 
#include <dolfin/common/types.h>
 
15
#include <dolfin/main/constants.h>
16
16
#include <dolfin/common/Variable.h>
17
 
#include "ALEType.h"
18
 
#include "MeshTopology.h"
19
 
#include "MeshGeometry.h"
20
 
#include "CellType.h"
 
17
#include "MeshData.h"
21
18
 
22
19
namespace dolfin
23
20
{
24
21
  
 
22
  class MeshTopology;
 
23
  class MeshGeometry;
 
24
  class CellType;
25
25
  template <class T> class MeshFunction;
26
 
  class MeshData;
27
26
 
28
27
  /// A Mesh consists of a set of connected and numbered mesh entities.
29
28
  ///
72
71
    const Mesh& operator=(const Mesh& mesh);
73
72
 
74
73
    /// Return number of vertices
75
 
    inline uint numVertices() const { return _topology.size(0); }
 
74
    inline uint numVertices() const { return data.topology.size(0); }
76
75
 
77
76
    /// Return number of edges
78
 
    inline uint numEdges() const { return _topology.size(1); }
 
77
    inline uint numEdges() const { return data.topology.size(1); }
79
78
 
80
79
    /// Return number of faces
81
 
    inline uint numFaces() const { return _topology.size(2); }
 
80
    inline uint numFaces() const { return data.topology.size(2); }
82
81
 
83
82
    /// Return number of facets
84
 
    inline uint numFacets() const { return _topology.size(_topology.dim() - 1); }
 
83
    inline uint numFacets() const { return data.topology.size(data.topology.dim() - 1); }
85
84
 
86
85
    /// Return number of cells
87
 
    inline uint numCells() const { return _topology.size(_topology.dim()); }
88
 
 
89
 
    /// Return coordinates of all vertices
90
 
    inline real* coordinates() { return _geometry.x(); }
91
 
 
92
 
    /// Return coordinates of all vertices
93
 
    inline const real* coordinates() const { return _geometry.x(); }
94
 
 
95
 
    /// Return connectivity for all cells
96
 
    inline uint* cells() { return _topology(_topology.dim(), 0)(); }
97
 
 
98
 
    /// Return connectivity for all cells
99
 
    inline const uint* cells() const { return _topology(_topology.dim(), 0)(); }
 
86
    inline uint numCells() const { return data.topology.size(data.topology.dim()); }
 
87
 
 
88
    /// Return coordinates of all vertices
 
89
    inline real* coordinates() { return data.geometry.x(); }
 
90
 
 
91
    /// Return coordinates of all vertices
 
92
    inline const real* coordinates() const { return data.geometry.x(); }
 
93
 
 
94
    /// Return connectivity for all cells
 
95
    inline uint* cells() { return data.topology(data.topology.dim(), 0)(); }
 
96
 
 
97
    /// Return connectivity for all cells
 
98
    inline const uint* cells() const { return data.topology(data.topology.dim(), 0)(); }
100
99
 
101
100
    /// Return number of entities of given topological dimension
102
 
    inline uint size(uint dim) const { return _topology.size(dim); }
 
101
    inline uint size(uint dim) const { return data.topology.size(dim); }
103
102
    
104
 
    /// Return mesh topology (non-const version)
105
 
    inline MeshTopology& topology() { return _topology; }
106
 
 
107
 
    /// Return mesh topology (const version)
108
 
    inline const MeshTopology& topology() const { return _topology; }
109
 
 
110
 
    /// Return mesh geometry (non-const version)
111
 
    inline MeshGeometry& geometry() { return _geometry; }
112
 
 
113
 
    /// Return mesh geometry (const version)
114
 
    inline const MeshGeometry& geometry() const { return _geometry; }
115
 
 
116
 
    /// Return mesh data
117
 
    MeshData& data();
118
 
 
119
 
    /// Return mesh cell type
120
 
    inline CellType& type() { dolfin_assert(_cell_type); return *_cell_type; }
121
 
 
122
 
    /// Return mesh cell type
123
 
    inline const CellType& type() const { dolfin_assert(_cell_type); return *_cell_type; }
 
103
    /// Return mesh topology
 
104
    inline MeshTopology& topology() { return data.topology; }
 
105
 
 
106
    /// Return mesh topology
 
107
    inline const MeshTopology& topology() const { return data.topology; }
 
108
 
 
109
    /// Return mesh geometry
 
110
    inline MeshGeometry& geometry() { return data.geometry; }
 
111
 
 
112
    /// Return mesh geometry
 
113
    inline const MeshGeometry& geometry() const { return data.geometry; }
 
114
 
 
115
    /// Return mesh cell type
 
116
    inline CellType& type() { dolfin_assert(data.cell_type); return *data.cell_type; }
 
117
 
 
118
    /// Return mesh cell type
 
119
    inline const CellType& type() const { dolfin_assert(data.cell_type); return *data.cell_type; }
124
120
 
125
121
    /// Compute entities of given topological dimension and return number of entities
126
122
    uint init(uint dim);
131
127
    /// Compute all entities and connectivity
132
128
    void init();
133
129
 
134
 
    /// Clear all mesh data
135
 
    void clear();
136
 
 
137
130
    /// Order all mesh entities (not needed if "mesh order entities" is set)
138
131
    void order();
139
132
 
148
141
 
149
142
    /// Coarsen mesh according to cells marked for coarsening
150
143
    void coarsen(MeshFunction<bool>& cell_markers, bool coarsen_boundary = false);
151
 
 
152
 
    /// Move coordinates of mesh according to new boundary coordinates
153
 
    void move(Mesh& boundary, ALEType method=lagrange);
154
144
    
155
145
    /// Smooth mesh using Lagrangian mesh smoothing 
156
146
    void smooth();
176
166
    friend class MeshEditor;
177
167
    friend class MPIMeshCommunicator;
178
168
 
179
 
    // Mesh topology
180
 
    MeshTopology _topology;
181
 
 
182
 
    // Mesh geometry
183
 
    MeshGeometry _geometry;
184
 
 
185
 
    // Auxiliary mesh data
186
 
    MeshData* _data;
187
 
 
188
 
    // Cell type
189
 
    CellType* _cell_type;
190
 
 
 
169
    // Mesh data
 
170
    MeshData data;
 
171
    
191
172
  };
192
173
 
193
174
}