15
15
#include "GRegion.h"
17
GEntity::GEntity(GModel *m, int t)
18
: _model(m), _tag(t), _meshMaster(t), _visible(1), _selection(0),
17
GEntity::GEntity(GModel *m,int t)
18
: _model(m), _tag(t),_meshMaster(this),_visible(1), _selection(0),
19
19
_allElementsVisible(1), _obb(0), va_lines(0), va_triangles(0)
21
21
_color = CTX::instance()->packColor(0, 0, 255, 0);
70
70
GRegion *GEntity::cast2Region() { return dynamic_cast<GRegion*>(this); }
72
72
// sets the entity m from which the mesh will be copied
73
void GEntity::setMeshMaster(int m_signed)
75
if(m_signed == tag()){ _meshMaster = m_signed; return; }
78
int m = abs(m_signed);
80
case 0 : gMaster = model()->getVertexByTag(m); break;
81
case 1 : gMaster = model()->getEdgeByTag(m); break;
82
case 2 : gMaster = model()->getFaceByTag(m); break;
83
case 3 : gMaster = model()->getRegionByTag(m); break;
86
Msg::Error("Model entity %d of dimension %d cannot be the mesh master of entity %d",
90
int masterOfMaster = gMaster->meshMaster();
92
if (masterOfMaster == gMaster->tag()){
93
_meshMaster = m_signed;
96
setMeshMaster ( masterOfMaster * ((m_signed > 0) ? 1 : -1));
73
void GEntity::setMeshMaster(GEntity* gMaster)
75
if (gMaster->dim() != dim()){
76
Msg::Error("Model entity %d of dimension %d cannot"
77
"be the mesh master of entity %d of dimension %d",
78
gMaster->tag(),gMaster->dim(),tag(),dim());
81
_meshMaster = gMaster;
84
void GEntity::setMeshMaster(GEntity* gMaster,const std::vector<double>& tfo)
86
if (gMaster->dim() != dim()){
87
Msg::Error("Model entity %d of dimension %d cannot"
88
"be the mesh master of entity %d of dimension %d",
89
gMaster->tag(),gMaster->dim(),tag(),dim());
93
if (tfo.size() != 16) {
94
Msg::Error("Periodicity transformation from entity %d to %d (dim %d) has %d components"
95
", while 16 are required",
96
gMaster->tag(),tag(),gMaster->dim(),tfo.size());
100
affineTransform = tfo;
101
_meshMaster = gMaster;
100
104
// gets the entity from which the mesh will be copied
101
int GEntity::meshMaster() const
103
if (_meshMaster == tag()) return tag();
105
GEntity *gMaster = 0;
107
case 0 : gMaster = model()->getVertexByTag(abs(_meshMaster)); break;
108
case 1 : gMaster = model()->getEdgeByTag(abs(_meshMaster)); break;
109
case 2 : gMaster = model()->getFaceByTag(abs(_meshMaster)); break;
110
case 3 : gMaster = model()->getRegionByTag(abs(_meshMaster)); break;
113
Msg::Error("Could not find mesh master entity %d",_meshMaster);
116
int masterOfMaster = gMaster->meshMaster();
118
if (masterOfMaster == gMaster->tag()){
122
return gMaster->meshMaster() * ((_meshMaster > 0) ? 1 : -1);
105
GEntity* GEntity::meshMaster() const { return _meshMaster; }