File: NullEntities.h

package info (click to toggle)
madlib 1.3.0-2.2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 6,912 kB
  • sloc: cpp: 39,850; sh: 10,088; makefile: 476
file content (106 lines) | stat: -rw-r--r-- 3,276 bytes parent folder | download | duplicates (3)
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
// -*- C++ -*-
// -------------------------------------------------------------------
// MAdLib - Copyright (C) 2008-2009 Universite catholique de Louvain
//
// See the Copyright.txt and License.txt files for license information. 
// You should have received a copy of these files along with MAdLib. 
// If not, see <http://www.madlib.be/license/>
//
// Please report all bugs and problems to <contrib@madlib.be>
//
// Authors: Jean-Francois Remacle, Gaetan Compere
// -------------------------------------------------------------------

#ifndef _H_NULLENTITIES
#define _H_NULLENTITIES

#ifndef _HAVE_GMSH_

#include "Physical.h"
#include <stdlib.h>

namespace MAd {

  class NullModel;

  // -------------------------------------------------------------------
  class NullGEntity {

  public:
    NullGEntity(int tag, NullModel *m, Physical *_p=NULL): _tag(tag),model(m),phys(_p) {}
    NullGEntity(const NullGEntity& ge): _tag(ge._tag),model(ge.model),phys(ge.phys) {}
    virtual ~NullGEntity() {}

    void setPhysical(int d, int t);

    virtual int dim() const=0;
    virtual int tag() const { return _tag; }
    int pDim() const { if(phys) {return phys->dim();} else {return -1;} }
    int pTag() const { if(phys) {return phys->tag();} else {return  0;} }

  private:
    int _tag;
    Physical * phys;
    NullModel * model;
  };

  // -------------------------------------------------------------------
  class NullGEntityLessThan {
  public:
    bool operator()(const NullGEntity *ent1, const NullGEntity *ent2) const
    { return ent1->tag() < ent2->tag(); }
  };

  // -------------------------------------------------------------------
  class NullGRegion : public NullGEntity {

  public:
    NullGRegion(int tag, NullModel *m, Physical *_p=NULL) : NullGEntity(tag, m, _p) {}
    NullGRegion(const NullGRegion& gr) : NullGEntity(gr) {}
    virtual ~NullGRegion() {}
    int dim() const { return 3; }
  };

  // -------------------------------------------------------------------
  class NullGFace : public NullGEntity {

  public:
    NullGFace(int tag, NullModel *m, Physical *_p=NULL) : NullGEntity(tag, m, _p) {}
    NullGFace(const NullGFace& gf) : NullGEntity(gf) {}
    virtual ~NullGFace() {}
    int dim() const { return 2; }
  };

  // -------------------------------------------------------------------
  class NullGEdge : public NullGEntity {

  public:
    NullGEdge(int tag, NullModel *m, Physical *_p=NULL) : NullGEntity(tag, m, _p) {}
    NullGEdge(const NullGEdge& ge) : NullGEntity(ge) {}
    virtual ~NullGEdge() {}
    int dim() const { return 1; }
  };

  // -------------------------------------------------------------------
  class NullGVertex : public NullGEntity {

  public:
    NullGVertex(int tag, NullModel *m, Physical *_p=NULL) : NullGEntity(tag, m, _p) {}
    NullGVertex(const NullGVertex& gv) : NullGEntity(gv) {}
    virtual ~NullGVertex() {}
    int dim() const { return 0; }
  };

  typedef class NullGEntity MAdGEntity;
  typedef class NullGEntityLessThan MAdGEntityLessThan;
  typedef class NullGRegion MAdGRegion;
  typedef class NullGFace   MAdGFace;
  typedef class NullGEdge   MAdGEdge;
  typedef class NullGVertex MAdGVertex;
  // -------------------------------------------------------------------
}

#endif

#endif