Fem: add Support for loads and supports on edges to CalculiX file

This commit is contained in:
Bernd Hahnebach
2015-03-24 19:22:05 +01:00
committed by wmayer
parent 36a5014364
commit d2888e6c28
5 changed files with 96 additions and 19 deletions

View File

@@ -443,6 +443,46 @@ std::set<long> FemMesh::getSurfaceNodes(const TopoDS_Face &face)const
return result;
}
std::set<long> FemMesh::getSurfaceNodes(const TopoDS_Edge &edge)const
{
std::set<long> result;
Bnd_Box box;
BRepBndLib::Add(edge, box);
// limit where the mesh node belongs to the edge:
double limit = box.SquareExtent()/10000.0;
box.Enlarge(limit);
// get the actuall transform of the FemMesh
const Base::Matrix4D Mtrx(getTransform());
SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator();
while (aNodeIter->more()) {
const SMDS_MeshNode* aNode = aNodeIter->next();
Base::Vector3d vec(aNode->X(),aNode->Y(),aNode->Z());
// Apply the matrix to hold the BoundBox in absolute space.
vec = Mtrx * vec;
if(!box.IsOut(gp_Pnt(vec.x,vec.y,vec.z))){
// create a Vertex
BRepBuilderAPI_MakeVertex aBuilder(gp_Pnt(vec.x,vec.y,vec.z));
TopoDS_Shape s = aBuilder.Vertex();
// measure distance
BRepExtrema_DistShapeShape measure(edge,s);
measure.Perform();
if (!measure.IsDone() || measure.NbSolution() < 1)
continue;
if(measure.Value() < limit)
result.insert(aNode->GetID());
}
}
return result;
}
void FemMesh::readNastran(const std::string &Filename)
@@ -1058,7 +1098,7 @@ struct Fem::FemMesh::FemMeshInfo FemMesh::getInfo(void) const{
return rtrn;
}
}
// for(unsigned int i=0;i<all_elements.size();i++)
// {
// //Die Reihenfolge wie hier die Elemente hinzugefügt werden ist sehr wichtig.
@@ -1077,9 +1117,9 @@ struct Fem::FemMesh::FemMeshInfo FemMesh::getInfo(void) const{
// element_id[i]
// );
// }
Base::Quantity FemMesh::getVolume(void)const
{
Base::Quantity FemMesh::getVolume(void)const
{
SMDS_VolumeIteratorPtr aVolIter = myMesh->GetMeshDS()->volumesIterator();
//Calculate Mesh Volume
@@ -1156,8 +1196,8 @@ Base::Quantity FemMesh::getVolume(void)const
volume += 1.0/6.0 * fabs((a_b_product.x * c.x)+ (a_b_product.y * c.y)+(a_b_product.z * c.z));
}
return Base::Quantity(volume,Unit::Volume);
return Base::Quantity(volume,Unit::Volume);
}