Re: Help for delete beam between two SetOfs.
Posted by
Damien André on
URL: http://granoo.326.s1.nabble.com/Help-for-delete-beam-between-two-SetOfs-tp142p150.html
And this ?
void
CreateDomains::DeleteBeamsBetweenFiberAndMatrix()
{
SetOfDE & demFiber = SetOfDE::Get("Fiber");
SetOfDE & demMatrix = SetOfDE::Get("Matrix");
SetOfBO * beamToBeDeleted = new SetOfBO("BeamToBeDeleted");
for (unsigned int i=0; i < demFiber.GetTotItemNumber(); ++i)
{
Core::SetOfBase<DEM::Bond > & bondSet = demFiber[i]->GetBondSet();
for (unsigned int j=0; j < bondSet.GetTotItemNumber(); ++j)
{
const DEM::Element & de1 = bondSet[j]->GetElement1();
const DEM::Element & de2 = bondSet[j]->GetElement2();
// choose the discrete element at the other end of the beam:
const DEM::Element * de = &de1;
if (&de1 == demFiber[i] )
{
de = & de2;
}
// look if de is in fiber or matrix... iy yes, append the beam to BeamToBeDeleted:
if (demMatrix.Contain(dynamic_cast<const DEM::DiscreteElement *>(de)))
{
beamToBeDeleted->AddItem(bondSet[j]);
}
}
}
// destroy all the beams in beamToBeDeleted:
beamToBeDeleted->ClearAndDelete();
}