/usr/include/dolfin/mesh/MeshEditor.h is in libdolfin1.0-dev 1.0.0-1.
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 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | // Copyright (C) 2006-2009 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: 2011-07-18
#ifndef __MESH_EDITOR_H
#define __MESH_EDITOR_H
#include <vector>
#include <dolfin/common/types.h>
#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 (uint)
/// The topological dimension.
/// gdim (uint)
/// The geometrical dimension.
///
/// *Example*
/// .. code-block:: c++
///
/// Mesh mesh;
/// MeshEditor editor;
/// editor.open(mesh, 2, 2);
///
void open(Mesh& mesh, uint tdim, uint gdim);
/// Open mesh of given cell type, topological and geometrical dimension
///
/// *Arguments*
/// mesh (_Mesh_)
/// The mesh to open.
/// type (CellType::Type)
/// Cell type.
/// tdim (uint)
/// The topological dimension.
/// gdim (uint)
/// The geometrical dimension.
void open(Mesh& mesh, CellType::Type type, uint tdim, uint gdim);
/// Open mesh of given cell type, topological and geometrical dimension
///
/// *Arguments*
/// mesh (_Mesh_)
/// The mesh to open.
/// type (std::string)
/// Cell type.
/// tdim (uint)
/// The topological dimension.
/// gdim (uint)
/// The geometrical dimension.
void open(Mesh& mesh, std::string type, uint tdim, uint gdim);
/// Specify number of vertices
///
/// *Arguments*
/// num_vertices (uint)
/// The number of vertices.
///
/// *Example*
/// .. code-block:: c++
///
/// Mesh mesh;
/// MeshEditor editor;
/// editor.open(mesh, 2, 2);
/// editor.init_vertices(4);
///
void init_vertices(uint num_vertices);
/// Specify number of vertices
///
/// *Arguments*
/// num_higher_order_vertices (uint)
/// The number of higher order vertices.
void init_higher_order_vertices(uint num_higher_order_vertices);
/// Specify number of cells
///
/// *Arguments*
/// num_cells (uint)
/// The number of cells.
///
/// *Example*
/// .. code-block:: c++
///
/// Mesh mesh;
/// MeshEditor editor;
/// editor.open(mesh, 2, 2);
/// editor.init_cells(2);
///
void init_cells(uint num_cells);
/// Specify number of cells
///
/// *Arguments*
/// num_higher_order_cells (uint)
/// The number of higher order cells.
/// num_higher_order_cell_dof (uint)
/// The number of cell dofs.
void init_higher_order_cells(uint num_higher_order_cells, uint num_higher_order_cell_dof);
/// Set boolean indicator inside MeshGeometry
void set_affine_cell_indicator(uint c, const std::string affine_str);
/// Add vertex v at given point p
///
/// *Arguments*
/// v (uint)
/// The vertex (index).
/// p (_Point_)
/// The point.
void add_vertex(uint v, const Point& p);
/// Add vertex v at given coordinate x
///
/// *Arguments*
/// v (uint)
/// The vertex (index).
/// x (double)
/// The x-coordinate.
void add_vertex(uint v, double x);
/// Add vertex v at given coordinate (x, y)
///
/// *Arguments*
/// v (uint)
/// The vertex (index).
/// x (double)
/// The x-coordinate.
/// y (double)
/// The y-coordinate.
///
/// *Example*
/// .. code-block:: c++
///
/// MeshEditor editor;
/// editor.add_vertex(0, 0.0, 0.0);
///
void add_vertex(uint v, double x, double y);
/// Add vertex v at given coordinate (x, y, z)
///
/// *Arguments*
/// v (uint)
/// The vertex (index).
/// x (double)
/// The x-coordinate.
/// y (double)
/// The y-coordinate.
/// z (double)
/// The z-coordinate.
void add_vertex(uint v, double x, double y, double z);
/// Add vertex v at given point p
///
/// *Arguments*
/// v (uint)
/// The vertex (index).
/// p (_Point_)
/// The point.
void add_higher_order_vertex(uint v, const Point& p);
/// Add vertex v at given coordinate x
///
/// *Arguments*
/// v (uint)
/// The vertex (index).
/// x (double)
/// The x-coordinate.
void add_higher_order_vertex(uint v, double x);
/// Add vertex v at given coordinate (x, y)
///
/// *Arguments*
/// v (uint)
/// The vertex (index).
/// x (double)
/// The x-coordinate.
/// y (double)
/// The y-coordinate.
void add_higher_order_vertex(uint v, double x, double y);
/// Add vertex v at given coordinate (x, y, z)
///
/// *Arguments*
/// v (uint)
/// The vertex (index).
/// x (double)
/// The x-coordinate.
/// y (double)
/// The y-coordinate.
/// z (double)
/// The z-coordinate.
void add_higher_order_vertex(uint v, double x, double y, double z);
/// Add cell with given vertices
///
/// *Arguments*
/// c (uint)
/// The cell (index).
/// v (std::vector<uint>)
/// The vertex indices
void add_cell(uint c, const std::vector<uint>& v);
/// Add cell (interval) with given vertices
///
/// *Arguments*
/// c (uint)
/// The cell (index).
/// v0 (uint)
/// Index of the first vertex.
/// v1 (uint)
/// Index of the second vertex.
void add_cell(uint c, uint v0, uint v1);
/// Add cell (triangle) with given vertices
///
/// *Arguments*
/// c (uint)
/// The cell (index).
/// v0 (uint)
/// Index of the first vertex.
/// v1 (uint)
/// Index of the second vertex.
/// v2 (uint)
/// Index of the third vertex.
///
/// *Example*
/// .. code-block:: c++
///
/// MeshEditor editor;
/// editor.add_cell(0, 0, 1, 2);
///
void add_cell(uint c, uint v0, uint v1, uint v2);
/// Add cell (tetrahedron) with given vertices
///
/// *Arguments*
/// c (uint)
/// The cell (index).
/// v0 (uint)
/// Index of the first vertex.
/// v1 (uint)
/// Index of the second vertex.
/// v2 (uint)
/// Index of the third vertex.
/// v3 (uint)
/// Index of the fourth vertex.
void add_cell(uint c, uint v0, uint v1, uint v2, uint v3);
/// Add higher order cell data (assume P2 triangle for now)
///
/// *Arguments*
/// c (uint)
/// The cell (index).
/// v0 (uint)
/// Index of the first vertex.
/// v1 (uint)
/// Index of the second vertex.
/// v2 (uint)
/// Index of the third vertex.
/// v3 (uint)
/// Index of the fourth vertex.
/// v4 (uint)
/// Index of the fifth vertex.
/// v5 (uint)
/// Index of the sixth vertex.
void add_higher_order_cell_data(uint c, uint v0, uint v1, uint v2, uint v3, uint v4, uint v5);
/// 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(uint v, uint dim);
// Add higher order vertex, common part
void add_higher_order_vertex_common(uint v, uint dim);
// Add cell, common part
void add_cell_common(uint v, uint dim);
// Add higher order cell, common part
void add_higher_order_cell_common(uint v, uint dim);
// Compute boundary indicators (exterior facets)
void compute_boundary_indicators();
// Clear all data
void clear();
// Check that vertex is in range
void check_vertex(uint v);
// The mesh
Mesh* mesh;
// Topological dimension
uint tdim;
// Geometrical (Euclidean) dimension
uint gdim;
// Number of vertices
uint num_vertices;
// Number of cells
uint num_cells;
// Next available vertex
uint next_vertex;
// Next available cell
uint next_cell;
// Temporary storage for local cell data
std::vector<uint> vertices;
// NEW HIGHER ORDER MESH STUFF
// Number of higher order vertices
uint num_higher_order_vertices;
// Number of higher order cells <--- should be the same as num_cells! good for error checking
uint num_higher_order_cells;
// Next available higher order vertex
uint next_higher_order_vertex;
// Next available higher order cell
uint next_higher_order_cell;
// Temporary storage for local higher order cell data
std::vector<uint> higher_order_cell_data;
};
}
#endif
|