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
|
// -------------------------------------------------------------------
// 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: Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------
#include "ModelConstraintManager.h"
namespace MAd {
// -------------------------------------------------------------------
void ModelConstraintManager::initialize(pGModel _model)
{
model = _model;
}
// -------------------------------------------------------------------
void ModelConstraintManager::finalize()
{
}
// -------------------------------------------------------------------
void ModelConstraintManager::setModel(pGModel _model)
{
model = _model;
}
// -------------------------------------------------------------------
void ModelConstraintManager::clear()
{
constrEntities.clear();
}
// -------------------------------------------------------------------
void ModelConstraintManager::constrain(int type, int id)
{
pGEntity pGE = GM_entityByTag(model, type, id);
constrain(pGE);
}
// -------------------------------------------------------------------
void ModelConstraintManager::constrain(pGEntity pGE)
{
// constrain entity
constrEntities.insert(pGE);
#ifdef _HAVE_GMSH_
// constrain lower geometrical levels
std::list<pGEntity> subGE = GEN_closure(pGE);
std::list<pGEntity>::const_iterator subIter = subGE.begin();
for (; subIter != subGE.end(); subIter++) constrain(*subIter);
#endif
}
// -------------------------------------------------------------------
void ModelConstraintManager::unconstrain(int type, int id)
{
pGEntity pGE = GM_entityByTag(model, type, id);
unconstrain(pGE);
}
// -------------------------------------------------------------------
void ModelConstraintManager::unconstrain(pGEntity pGE)
{
std::set<pGEntity>::iterator eIter = constrEntities.find(pGE);
if ( eIter != constrEntities.end() ) constrEntities.erase(eIter);
}
// -------------------------------------------------------------------
bool ModelConstraintManager::constrained(pGEntity pGE)
{
//GCTODO: check upper-level geometric entities: need model with connectivity
if ( constrEntities.find(pGE) != constrEntities.end() ) return true;
return false;
}
// -------------------------------------------------------------------
}
|