~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to src/kernel/mesh/MeshData.cpp

  • Committer: Johannes Ring
  • Date: 2008-03-05 22:43:06 UTC
  • Revision ID: johannr@simula.no-20080305224306-2npsdyhfdpl2esji
The BIG commit!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (C) 2006 Anders Logg.
2
 
// Licensed under the GNU LGPL Version 2.1.
3
 
//
4
 
// First added:  2006-05-08
5
 
// Last changed: 2006-06-22
6
 
 
7
 
#include <dolfin/MeshData.h>
8
 
 
9
 
using namespace dolfin;
10
 
 
11
 
//-----------------------------------------------------------------------------
12
 
MeshData::MeshData() : cell_type(0)
13
 
{
14
 
  // Do nothing
15
 
}
16
 
//-----------------------------------------------------------------------------
17
 
MeshData::MeshData(const MeshData& data) : cell_type(0)
18
 
{
19
 
  *this = data;
20
 
}
21
 
//-----------------------------------------------------------------------------
22
 
MeshData::~MeshData()
23
 
{
24
 
  clear();
25
 
}
26
 
//-----------------------------------------------------------------------------
27
 
const MeshData& MeshData::operator= (const MeshData& data)
28
 
{
29
 
  // Clear old data if any
30
 
  clear();
31
 
 
32
 
  // Assign data
33
 
  topology = data.topology;
34
 
  geometry = data.geometry;
35
 
 
36
 
  // Create new cell type
37
 
  if ( data.cell_type )
38
 
    cell_type = CellType::create(data.cell_type->cellType());
39
 
  else
40
 
    cell_type = 0;
41
 
 
42
 
  return *this;
43
 
}
44
 
//-----------------------------------------------------------------------------
45
 
void MeshData::clear()
46
 
47
 
  // Clear mesh topology
48
 
  topology.clear();
49
 
 
50
 
  // Clear mesh geometry
51
 
  geometry.clear();
52
 
 
53
 
  // Clear cell type
54
 
  if ( cell_type )
55
 
    delete cell_type;
56
 
  cell_type = 0;
57
 
}
58
 
//-----------------------------------------------------------------------------
59
 
void MeshData::disp() const
60
 
{
61
 
  cout << "Mesh data" << endl;
62
 
  cout << "---------" << endl << endl;
63
 
  
64
 
  // Begin indentation
65
 
  begin("");
66
 
 
67
 
  // Display topology and geometry
68
 
  topology.disp();
69
 
  geometry.disp();
70
 
 
71
 
  // Display cell type
72
 
  cout << "Cell type" << endl;
73
 
  cout << "---------" << endl << endl;
74
 
  begin("");
75
 
  if ( cell_type )
76
 
    cout << cell_type->description() << endl;
77
 
  else
78
 
    cout << "undefined" << endl;
79
 
  end();
80
 
  cout << endl;
81
 
  
82
 
  // End indentation
83
 
  end();
84
 
}
85
 
//-----------------------------------------------------------------------------