~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to dolfin/mesh/MeshData.h

  • Committer: Anders Logg
  • Date: 2008-05-21 22:42:48 UTC
  • mfrom: (2668.6.1 trunk)
  • mto: (2668.8.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 2670.
  • Revision ID: logg@simula.no-20080521224248-7baydkw3uy323fur
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// Licensed under the GNU LGPL Version 2.1.
3
3
//
4
4
// First added:  2008-05-19
5
 
// Last changed: 2008-05-19
 
5
// Last changed: 2008-05-21
6
6
 
7
7
#ifndef __MESH_DATA_H
8
8
#define __MESH_DATA_H
10
10
#include <map>
11
11
 
12
12
#include <dolfin/common/types.h>
 
13
#include <dolfin/common/Array.h>
13
14
#include "MeshFunction.h"
14
15
 
15
16
namespace dolfin
18
19
  class Mesh;
19
20
 
20
21
  /// The class MeshData is a container for auxiliary mesh data,
21
 
  /// represented as MeshFunctions over topological mesh entities.
22
 
  /// Each MeshFunction is identified by a unique user-specified
23
 
  /// string.
 
22
  /// represented either as MeshFunctions over topological mesh
 
23
  /// entities or Arrays. Each dataset is identified by a unique
 
24
  /// user-specified string.
24
25
  ///
25
 
  /// Currently, only uint-valued MeshFunctions are supported.
 
26
  /// Currently, only uint-valued data is supported.
26
27
 
27
28
  class MeshData
28
29
  {
37
38
    /// Clear all data
38
39
    void clear();
39
40
 
40
 
    /// Create data with given name on entities of given dimension
41
 
    MeshFunction<uint>* create(std::string name, uint dim);
42
 
 
43
 
    /// Return data for given name
44
 
    MeshFunction<uint>* operator[] (std::string name);
 
41
    /// Create MeshFunction with given name on entities of given dimension
 
42
    MeshFunction<uint>* createMeshFunction(std::string name, uint dim);
 
43
 
 
44
    /// Create Array with given name and size
 
45
    Array<uint>* createArray(std::string name, uint size);
 
46
    
 
47
    /// Return MeshFunction with given name (returning zero if data is not available)
 
48
    MeshFunction<uint>* meshfunction(std::string name);
 
49
 
 
50
    /// Return Array with given name (returning zero if data is not available)
 
51
    Array<uint>* array(std::string name);
45
52
 
46
53
    /// Display data
47
54
    void disp() const;
52
59
    Mesh& mesh;
53
60
 
54
61
    // A map from named mesh data to MeshFunctions
55
 
    std::map<std::string, MeshFunction<uint>*> data;
 
62
    std::map<std::string, MeshFunction<uint>*> meshfunctions;
 
63
 
 
64
    // A map from named mesh data to Arrays
 
65
    std::map<std::string, Array<uint>*> arrays;
56
66
 
57
67
  };
58
68