Fem: remove some superfluous const_cast
This commit is contained in:
@@ -2489,7 +2489,7 @@ Base::BoundBox3d FemMesh::getBoundBox(void) const
|
||||
{
|
||||
Base::BoundBox3d box;
|
||||
|
||||
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(getSMesh())->GetMeshDS();
|
||||
const SMESHDS_Mesh* data = getSMesh()->GetMeshDS();
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
|
||||
for (;aNodeIter->more();) {
|
||||
@@ -2533,7 +2533,7 @@ struct Fem::FemMesh::FemMeshInfo FemMesh::getInfo(void) const{
|
||||
|
||||
struct FemMeshInfo rtrn;
|
||||
|
||||
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(getSMesh())->GetMeshDS();
|
||||
const SMESHDS_Mesh* data = getSMesh()->GetMeshDS();
|
||||
const SMDS_MeshInfo& info = data->GetMeshInfo();
|
||||
rtrn.numFaces = data->NbFaces();
|
||||
rtrn.numNode = info.NbNodes();
|
||||
|
||||
@@ -230,21 +230,6 @@ App::DocumentObjectExecReturn *FemMeshShapeObject::execute(void)
|
||||
myNetGenMesher.Compute();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(newMesh.getSMesh())->GetMeshDS();
|
||||
//const SMDS_MeshInfo& info = data->GetMeshInfo();
|
||||
//int numNode = info.NbNodes();
|
||||
//int numTria = info.NbTriangles();
|
||||
//int numQuad = info.NbQuadrangles();
|
||||
//int numPoly = info.NbPolygons();
|
||||
//int numVolu = info.NbVolumes();
|
||||
//int numTetr = info.NbTetras();
|
||||
//int numHexa = info.NbHexas();
|
||||
//int numPyrd = info.NbPyramids();
|
||||
//int numPris = info.NbPrisms();
|
||||
//int numHedr = info.NbPolyhedrons();
|
||||
|
||||
// set the value to the object
|
||||
FemMesh.setValue(newMesh);
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ void FemVTKTools::importVTKMesh(vtkSmartPointer<vtkDataSet> dataset, FemMesh* me
|
||||
vtkSmartPointer<vtkIdList> idlist= vtkSmartPointer<vtkIdList>::New();
|
||||
|
||||
//Now fill the SMESH datastructure
|
||||
SMESH_Mesh* smesh = const_cast<SMESH_Mesh*>(mesh->getSMesh());
|
||||
SMESH_Mesh* smesh = mesh->getSMesh();
|
||||
SMESHDS_Mesh* meshds = smesh->GetMeshDS();
|
||||
meshds->ClearMesh();
|
||||
|
||||
@@ -446,8 +446,8 @@ void FemVTKTools::exportVTKMesh(const FemMesh* mesh, vtkSmartPointer<vtkUnstruct
|
||||
{
|
||||
|
||||
Base::Console().Log("Start: VTK mesh builder ======================\n");
|
||||
SMESH_Mesh* smesh = const_cast<SMESH_Mesh*>(mesh->getSMesh());
|
||||
SMESHDS_Mesh* meshDS = smesh->GetMeshDS();
|
||||
const SMESH_Mesh* smesh = mesh->getSMesh();
|
||||
const SMESHDS_Mesh* meshDS = smesh->GetMeshDS();
|
||||
|
||||
// nodes
|
||||
Base::Console().Log(" Start: VTK mesh builder nodes.\n");
|
||||
@@ -831,8 +831,8 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result, vtkSmar
|
||||
Base::Console().Error("Result object does not correctly link to mesh");
|
||||
return;
|
||||
}
|
||||
SMESH_Mesh* smesh = const_cast<SMESH_Mesh*>(static_cast<FemMeshObject*>(meshObj)->FemMesh.getValue().getSMesh());
|
||||
SMESHDS_Mesh* meshDS = smesh->GetMeshDS();
|
||||
const SMESH_Mesh* smesh = static_cast<FemMeshObject*>(meshObj)->FemMesh.getValue().getSMesh();
|
||||
const SMESHDS_Mesh* meshDS = smesh->GetMeshDS();
|
||||
|
||||
// all result object meshes are in mm therefore for e.g. length outputs like
|
||||
// displacement we must divide by 1000
|
||||
|
||||
@@ -975,7 +975,7 @@ void DefineNodesCallback(void* ud, SoEventCallback* n)
|
||||
if (docObj.size() != 1)
|
||||
return;
|
||||
|
||||
const SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(static_cast<Fem::FemMeshObject*>(docObj[0])->FemMesh.getValue().getSMesh())->GetMeshDS();
|
||||
const SMESHDS_Mesh* data = static_cast<Fem::FemMeshObject*>(docObj[0])->FemMesh.getValue().getSMesh()->GetMeshDS();
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
|
||||
Base::Vector3f pt2d;
|
||||
|
||||
@@ -94,7 +94,7 @@ QVariant PropertyFemMeshItem::value(const App::Property*) const
|
||||
const std::vector<App::Property*>& props = getPropertyData();
|
||||
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(*pt);
|
||||
SMESH_Mesh* mesh = const_cast<SMESH_Mesh*>(prop->getValue().getSMesh());
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctN += mesh->NbNodes();
|
||||
ctE += mesh->NbEdges();
|
||||
ctF += mesh->NbFaces();
|
||||
@@ -154,7 +154,7 @@ int PropertyFemMeshItem::countNodes() const
|
||||
const std::vector<App::Property*>& props = getPropertyData();
|
||||
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(*pt);
|
||||
SMESH_Mesh* mesh = const_cast<SMESH_Mesh*>(prop->getValue().getSMesh());
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctN += mesh->NbNodes();
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ int PropertyFemMeshItem::countEdges() const
|
||||
const std::vector<App::Property*>& props = getPropertyData();
|
||||
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(*pt);
|
||||
SMESH_Mesh* mesh = const_cast<SMESH_Mesh*>(prop->getValue().getSMesh());
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctE += mesh->NbEdges();
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ int PropertyFemMeshItem::countFaces() const
|
||||
const std::vector<App::Property*>& props = getPropertyData();
|
||||
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(*pt);
|
||||
SMESH_Mesh* mesh = const_cast<SMESH_Mesh*>(prop->getValue().getSMesh());
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctF += mesh->NbFaces();
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ int PropertyFemMeshItem::countPolygons() const
|
||||
const std::vector<App::Property*>& props = getPropertyData();
|
||||
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(*pt);
|
||||
SMESH_Mesh* mesh = const_cast<SMESH_Mesh*>(prop->getValue().getSMesh());
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctP += mesh->NbPolygons();
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ int PropertyFemMeshItem::countVolumes() const
|
||||
const std::vector<App::Property*>& props = getPropertyData();
|
||||
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(*pt);
|
||||
SMESH_Mesh* mesh = const_cast<SMESH_Mesh*>(prop->getValue().getSMesh());
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctV += mesh->NbVolumes();
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ int PropertyFemMeshItem::countPolyhedrons() const
|
||||
const std::vector<App::Property*>& props = getPropertyData();
|
||||
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(*pt);
|
||||
SMESH_Mesh* mesh = const_cast<SMESH_Mesh*>(prop->getValue().getSMesh());
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctH += mesh->NbPolyhedrons();
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ int PropertyFemMeshItem::countGroups() const
|
||||
const std::vector<App::Property*>& props = getPropertyData();
|
||||
for (std::vector<App::Property*>::const_iterator pt = props.begin(); pt != props.end(); ++pt) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(*pt);
|
||||
SMESH_Mesh* mesh = const_cast<SMESH_Mesh*>(prop->getValue().getSMesh());
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctG += mesh->NbGroup();
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ void TaskCreateNodeSet::DefineNodesCallback(void* ud, SoEventCallback* n)
|
||||
|
||||
void TaskCreateNodeSet::DefineNodes(const Base::Polygon2d& polygon, const Gui::ViewVolumeProjection& proj, bool inner)
|
||||
{
|
||||
const SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(pcObject->FemMesh.getValue<Fem::FemMeshObject*>()->FemMesh.getValue().getSMesh())->GetMeshDS();
|
||||
const SMESHDS_Mesh* data = pcObject->FemMesh.getValue<Fem::FemMeshObject*>()->FemMesh.getValue().getSMesh()->GetMeshDS();
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
|
||||
Base::Vector3f pt2d;
|
||||
|
||||
@@ -468,7 +468,7 @@ std::set<long> ViewProviderFemMesh::getHighlightNodes() const
|
||||
void ViewProviderFemMesh::setHighlightNodes(const std::set<long>& HighlightedNodes)
|
||||
{
|
||||
if (!HighlightedNodes.empty()) {
|
||||
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>((static_cast<Fem::FemMeshObject*>(this->pcObject)->FemMesh).getValue().getSMesh())->GetMeshDS();
|
||||
const SMESHDS_Mesh* data = static_cast<Fem::FemMeshObject*>(this->pcObject)->FemMesh.getValue().getSMesh()->GetMeshDS();
|
||||
|
||||
pcAnoCoords->point.setNum(HighlightedNodes.size());
|
||||
SbVec3f* verts = pcAnoCoords->point.startEditing();
|
||||
@@ -722,7 +722,7 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop,
|
||||
|
||||
const Fem::PropertyFemMesh* mesh = static_cast<const Fem::PropertyFemMesh*>(prop);
|
||||
|
||||
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(mesh->getValue().getSMesh())->GetMeshDS();
|
||||
const SMESHDS_Mesh* data = mesh->getValue().getSMesh()->GetMeshDS();
|
||||
|
||||
int numFaces = data->NbFaces();
|
||||
int numNodes = data->NbNodes();
|
||||
|
||||
@@ -257,8 +257,8 @@ Py::List ViewProviderFemMeshPy::getHighlightedNodes(void) const
|
||||
void ViewProviderFemMeshPy::setHighlightedNodes(Py::List arg)
|
||||
{
|
||||
ViewProviderFemMesh* vp = this->getViewProviderFemMeshPtr();
|
||||
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>((static_cast<Fem::FemMeshObject*>
|
||||
(vp->getObject())->FemMesh).getValue().getSMesh())->GetMeshDS();
|
||||
const SMESHDS_Mesh* data = static_cast<Fem::FemMeshObject*>
|
||||
(vp->getObject())->FemMesh.getValue().getSMesh()->GetMeshDS();
|
||||
|
||||
std::set<long> res;
|
||||
for (Py::List::iterator it = arg.begin(); it != arg.end(); ++it) {
|
||||
|
||||
Reference in New Issue
Block a user