/usr/include/dolfin/mesh/MeshEditor.h is in libdolfin1.3-dev 1.3.0+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | // Copyright (C) 2006-2012 Anders Logg
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// First added: 2006-05-16
// Last changed: 2012-09-27
#ifndef __MESH_EDITOR_H
#define __MESH_EDITOR_H
#include <vector>
#include "CellType.h"
namespace dolfin
{
class CellType;
class Mesh;
class Point;
/// A simple mesh editor for creating simplicial meshes in 1D, 2D
/// and 3D.
class MeshEditor
{
public:
/// Constructor
MeshEditor();
/// Destructor
~MeshEditor();
/// Open mesh of given topological and geometrical dimension
///
/// *Arguments*
/// mesh (_Mesh_)
/// The mesh to open.
/// tdim (std::size_t)
/// The topological dimension.
/// gdim (std::size_t)
/// The geometrical dimension.
///
/// *Example*
/// .. code-block:: c++
///
/// Mesh mesh;
/// MeshEditor editor;
/// editor.open(mesh, 2, 2);
///
void open(Mesh& mesh, std::size_t tdim, std::size_t gdim);
/// Open mesh of given cell type, topological and geometrical dimension
///
/// *Arguments*
/// mesh (_Mesh_)
/// The mesh to open.
/// type (CellType::Type)
/// Cell type.
/// tdim (std::size_t)
/// The topological dimension.
/// gdim (std::size_t)
/// The geometrical dimension.
void open(Mesh& mesh, CellType::Type type, std::size_t tdim, std::size_t gdim);
/// Open mesh of given cell type, topological and geometrical dimension
///
/// *Arguments*
/// mesh (_Mesh_)
/// The mesh to open.
/// type (std::string)
/// Cell type.
/// tdim (std::size_t)
/// The topological dimension.
/// gdim (std::size_t)
/// The geometrical dimension.
void open(Mesh& mesh, std::string type, std::size_t tdim, std::size_t gdim);
/// Specify number of vertices
///
/// *Arguments*
/// num_vertices (std::size_t)
/// The number of vertices.
///
/// *Example*
/// .. code-block:: c++
///
/// Mesh mesh;
/// MeshEditor editor;
/// editor.open(mesh, 2, 2);
/// editor.init_vertices(4);
///
void init_vertices(std::size_t num_vertices);
/// Specify number of cells
///
/// *Arguments*
/// num_cells (std::size_t)
/// The number of cells.
///
/// *Example*
/// .. code-block:: c++
///
/// Mesh mesh;
/// MeshEditor editor;
/// editor.open(mesh, 2, 2);
/// editor.init_cells(2);
///
void init_cells(std::size_t num_cells);
/// Add vertex v at given point p
///
/// *Arguments*
/// index (std::size_t)
/// The vertex (index).
/// p (_Point_)
/// The point.
void add_vertex(std::size_t index, const Point& p);
/// Add vertex v at given coordinate x
///
/// *Arguments*
/// index (std::size_t)
/// The vertex (index).
/// x (std::vector<double>)
/// The x-coordinates.
void add_vertex(std::size_t index, const std::vector<double>& x);
/// Add vertex v at given point x (for a 1D mesh)
///
/// *Arguments*
/// index (std::size_t)
/// The vertex (index).
/// x (double)
/// The x-coordinate.
void add_vertex(std::size_t index, double x);
/// Add vertex v at given point (x, y) (for a 2D mesh)
///
/// *Arguments*
/// index (std::size_t)
/// The vertex (index).
/// x (double)
/// The x-coordinate.
/// y (double)
/// The y-coordinate.
void add_vertex(std::size_t index, double x, double y);
/// Add vertex v at given point (x, y, z) (for a 3D mesh)
///
/// *Arguments*
/// index (std::size_t)
/// The vertex (index).
/// x (double)
/// The x-coordinate.
/// y (double)
/// The y-coordinate.
/// z (double)
/// The z-coordinate.
void add_vertex(std::size_t index, double x, double y, double z);
/// Add vertex v at given point p
///
/// *Arguments*
/// local_index (std::size_t)
/// The vertex (local index).
/// global_index (std::size_t)
/// The vertex (global_index).
/// p (_Point_)
/// The point.
void add_vertex_global(std::size_t local_index, std::size_t global_index,
const Point& p);
/// Add vertex v at given coordinate x
///
/// *Arguments*
/// local_index (std::size_t)
/// The vertex (local index).
/// global_index (std::size_t)
/// The vertex (global_index).
/// x (std::vector<double>)
/// The x-coordinates.
void add_vertex_global(std::size_t local_index, std::size_t global_index,
const std::vector<double>& x);
/// Add cell with given vertices (1D)
///
/// *Arguments*
/// c (std::size_t)
/// The cell (index).
/// v0 (std::vector<std::size_t>)
/// The first vertex (local index).
/// v1 (std::vector<std::size_t>)
/// The second vertex (local index).
void add_cell(std::size_t c, std::size_t v0, std::size_t v1);
/// Add cell with given vertices (2D)
///
/// *Arguments*
/// c (std::size_t)
/// The cell (index).
/// v0 (std::vector<std::size_t>)
/// The first vertex (local index).
/// v1 (std::vector<std::size_t>)
/// The second vertex (local index).
/// v2 (std::vector<std::size_t>)
/// The third vertex (local index).
void add_cell(std::size_t c, std::size_t v0, std::size_t v1, std::size_t v2);
/// Add cell with given vertices (3D)
///
/// *Arguments*
/// c (std::size_t)
/// The cell (index).
/// v0 (std::vector<std::size_t>)
/// The first vertex (local index).
/// v1 (std::vector<std::size_t>)
/// The second vertex (local index).
/// v2 (std::vector<std::size_t>)
/// The third vertex (local index).
/// v3 (std::vector<std::size_t>)
/// The fourth vertex (local index).
void add_cell(std::size_t c, std::size_t v0, std::size_t v1,
std::size_t v2, std::size_t v3);
/// Add cell with given vertices
///
/// *Arguments*
/// c (std::size_t)
/// The cell (index).
/// v (std::vector<std::size_t>)
/// The vertex indices (local indices)
void add_cell(std::size_t c, const std::vector<std::size_t>& v);
/// Add cell with given vertices
///
/// *Arguments*
/// local_index (std::size_t)
/// The cell (index).
/// global_index (std::size_t)
/// The global (user) cell index.
/// v (std::vector<std::size_t>)
/// The vertex indices (local indices)
void add_cell(std::size_t local_index, std::size_t global_index,
const std::vector<std::size_t>& v);
/// Close mesh, finish editing, and order entities locally
///
/// *Arguments*
/// order (bool)
/// Order entities locally if true. Default values is true.
///
/// *Example*
/// .. code-block:: c++
///
/// MeshEditor editor;
/// editor.open(mesh, 2, 2);
/// ...
/// editor.close()
///
void close(bool order=true);
private:
// Friends
friend class TetrahedronCell;
// Add vertex, common part
void add_vertex_common(std::size_t v, std::size_t dim);
// Add cell, common part
void add_cell_common(std::size_t v, std::size_t dim);
// Compute boundary indicators (exterior facets)
void compute_boundary_indicators();
// Clear all data
void clear();
// Check that vertices are in range
void check_vertices(const std::vector<std::size_t>& v) const;
// The mesh
Mesh* _mesh;
// Topological dimension
std::size_t _tdim;
// Geometrical (Euclidean) dimension
std::size_t _gdim;
// Number of vertices
std::size_t _num_vertices;
// Number of cells
std::size_t _num_cells;
// Next available vertex
std::size_t next_vertex;
// Next available cell
std::size_t next_cell;
// Temporary storage for local cell data
std::vector<std::size_t> _vertices;
};
}
#endif
|