1
// Copyright (C) 2006 Anders Logg.
2
// Licensed under the GNU LGPL Version 2.1.
4
// First added: 2006-05-19
5
// Last changed: 2006-10-19
7
#include <dolfin/dolfin_log.h>
8
#include <dolfin/MeshGeometry.h>
10
using namespace dolfin;
12
//-----------------------------------------------------------------------------
13
MeshGeometry::MeshGeometry() : _dim(0), _size(0), coordinates(0)
17
//-----------------------------------------------------------------------------
18
MeshGeometry::MeshGeometry(const MeshGeometry& geometry)
19
: _dim(0), _size(0), coordinates(0)
23
//-----------------------------------------------------------------------------
24
MeshGeometry::~MeshGeometry()
28
//-----------------------------------------------------------------------------
29
const MeshGeometry& MeshGeometry::operator= (const MeshGeometry& geometry)
31
// Clear old data if any
36
_size = geometry._size;
37
const uint n = _dim*_size;
38
coordinates = new real[n];
41
for (uint i = 0; i < n; i++)
42
coordinates[i] = geometry.coordinates[i];
46
//-----------------------------------------------------------------------------
47
Point MeshGeometry::point(uint n) const
63
//-----------------------------------------------------------------------------
64
void MeshGeometry::clear()
69
delete [] coordinates;
72
//-----------------------------------------------------------------------------
73
void MeshGeometry::init(uint dim, uint size)
75
// Delete old data if any
79
coordinates = new real[dim*size];
81
// Save dimension and size
85
//-----------------------------------------------------------------------------
86
void MeshGeometry::set(uint n, uint i, real x)
88
coordinates[n*_dim + i] = x;
90
//-----------------------------------------------------------------------------
91
void MeshGeometry::disp() const
93
cout << "Mesh geometry" << endl;
94
cout << "-------------" << endl << endl;
102
cout << "empty" << endl << endl;
107
// Display coordinates for all vertices
108
for (uint i = 0; i < _size; i++)
111
for (uint d = 0; d < _dim; d++)
112
cout << " " << x(i, d);
120
//-----------------------------------------------------------------------------