FEM: modernize C++: use range-based for loop
This commit is contained in:
@@ -251,8 +251,8 @@ void FemMesh::copyMeshData(const FemMesh& mesh)
|
||||
SMESHDS_Group* newGroupDS = dynamic_cast<SMESHDS_Group*>(newGroupObj->GetGroupDS());
|
||||
if (newGroupDS) {
|
||||
SMDS_MeshGroup& smdsGroup = ((SMESHDS_Group*)newGroupDS)->SMDSGroup();
|
||||
for (unsigned i = 0; i < groupElems.size(); ++i)
|
||||
smdsGroup.Add(groupElems[i]);
|
||||
for (auto it : groupElems)
|
||||
smdsGroup.Add(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -808,8 +808,8 @@ std::map<int, int> FemMesh::getccxVolumesByFace(const TopoDS_Face &face) const
|
||||
std::map<int, std::vector<int> >::iterator it = elem_order.find(num_of_nodes);
|
||||
if (it != elem_order.end()) {
|
||||
const std::vector<int>& order = it->second;
|
||||
for (std::vector<int>::const_iterator jt = order.begin(); jt != order.end(); ++jt) {
|
||||
int vid = vol->GetNode(*jt)->GetID();
|
||||
for (int jt : order) {
|
||||
int vid = vol->GetNode(jt)->GetID();
|
||||
apair.second.push_back(vid);
|
||||
}
|
||||
}
|
||||
@@ -890,8 +890,7 @@ std::set<int> FemMesh::getNodesBySolid(const TopoDS_Solid &solid) const
|
||||
}
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (size_t i = 0; i < nodes.size(); ++i) {
|
||||
const SMDS_MeshNode* aNode = nodes[i];
|
||||
for (auto aNode : nodes) {
|
||||
double xyz[3];
|
||||
aNode->GetXYZ(xyz);
|
||||
Base::Vector3d vec(xyz[0], xyz[1], xyz[2]);
|
||||
@@ -942,8 +941,7 @@ std::set<int> FemMesh::getNodesByFace(const TopoDS_Face &face) const
|
||||
}
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (size_t i = 0; i < nodes.size(); ++i) {
|
||||
const SMDS_MeshNode* aNode = nodes[i];
|
||||
for (auto aNode : nodes) {
|
||||
double xyz[3];
|
||||
aNode->GetXYZ(xyz);
|
||||
Base::Vector3d vec(xyz[0], xyz[1], xyz[2]);
|
||||
@@ -992,8 +990,7 @@ std::set<int> FemMesh::getNodesByEdge(const TopoDS_Edge &edge) const
|
||||
}
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (size_t i = 0; i < nodes.size(); ++i) {
|
||||
const SMDS_MeshNode* aNode = nodes[i];
|
||||
for (auto aNode : nodes) {
|
||||
double xyz[3];
|
||||
aNode->GetXYZ(xyz);
|
||||
Base::Vector3d vec(xyz[0], xyz[1], xyz[2]);
|
||||
@@ -1041,8 +1038,7 @@ std::set<int> FemMesh::getNodesByVertex(const TopoDS_Vertex &vertex) const
|
||||
}
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
for (size_t i = 0; i < nodes.size(); ++i) {
|
||||
const SMDS_MeshNode* aNode = nodes[i];
|
||||
for (auto aNode : nodes) {
|
||||
double xyz[3];
|
||||
aNode->GetXYZ(xyz);
|
||||
Base::Vector3d vec(xyz[0], xyz[1], xyz[2]);
|
||||
@@ -2077,8 +2073,8 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
std::map<int, std::string>::iterator it = volTypeMap.find(numNodes);
|
||||
if (it != volTypeMap.end()) {
|
||||
const std::vector<int>& order = elemOrderMap[it->second];
|
||||
for (std::vector<int>::const_iterator jt = order.begin(); jt != order.end(); ++jt)
|
||||
apair.second.push_back(aVol->GetNode(*jt)->GetID());
|
||||
for (int jt : order)
|
||||
apair.second.push_back(aVol->GetNode(jt)->GetID());
|
||||
elementsMapVol[it->second].insert(apair);
|
||||
}
|
||||
}
|
||||
@@ -2098,8 +2094,8 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
std::map<int, std::string>::iterator it = faceTypeMap.find(numNodes);
|
||||
if (it != faceTypeMap.end()) {
|
||||
const std::vector<int>& order = elemOrderMap[it->second];
|
||||
for (std::vector<int>::const_iterator jt = order.begin(); jt != order.end(); ++jt)
|
||||
apair.second.push_back(aFace->GetNode(*jt)->GetID());
|
||||
for (int jt : order)
|
||||
apair.second.push_back(aFace->GetNode(jt)->GetID());
|
||||
elementsMapFac[it->second].insert(apair);
|
||||
}
|
||||
}
|
||||
@@ -2107,16 +2103,16 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
if (elemParam == 2) {
|
||||
// we're going to fill the elementsMapFac with the facesOnly
|
||||
std::set<int> facesOnly = getFacesOnly();
|
||||
for (std::set<int>::iterator itfa = facesOnly.begin(); itfa != facesOnly.end(); ++itfa) {
|
||||
for (int itfa : facesOnly) {
|
||||
std::pair<int, std::vector<int> > apair;
|
||||
apair.first = *itfa;
|
||||
const SMDS_MeshElement* aFace = myMesh->GetMeshDS()->FindElement(*itfa);
|
||||
apair.first = itfa;
|
||||
const SMDS_MeshElement* aFace = myMesh->GetMeshDS()->FindElement(itfa);
|
||||
int numNodes = aFace->NbNodes();
|
||||
std::map<int, std::string>::iterator it = faceTypeMap.find(numNodes);
|
||||
if (it != faceTypeMap.end()) {
|
||||
const std::vector<int>& order = elemOrderMap[it->second];
|
||||
for (std::vector<int>::const_iterator jt = order.begin(); jt != order.end(); ++jt)
|
||||
apair.second.push_back(aFace->GetNode(*jt)->GetID());
|
||||
for (int jt : order)
|
||||
apair.second.push_back(aFace->GetNode(jt)->GetID());
|
||||
elementsMapFac[it->second].insert(apair);
|
||||
}
|
||||
}
|
||||
@@ -2137,8 +2133,8 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
std::map<int, std::string>::iterator it = edgeTypeMap.find(numNodes);
|
||||
if (it != edgeTypeMap.end()) {
|
||||
const std::vector<int>& order = elemOrderMap[it->second];
|
||||
for (std::vector<int>::const_iterator jt = order.begin(); jt != order.end(); ++jt)
|
||||
apair.second.push_back(aEdge->GetNode(*jt)->GetID());
|
||||
for (int jt : order)
|
||||
apair.second.push_back(aEdge->GetNode(jt)->GetID());
|
||||
elementsMapEdg[it->second].insert(apair);
|
||||
}
|
||||
}
|
||||
@@ -2146,16 +2142,16 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
if (elemParam == 2) {
|
||||
// we're going to fill the elementsMapEdg with the edgesOnly
|
||||
std::set<int> edgesOnly = getEdgesOnly();
|
||||
for (std::set<int>::iterator ited = edgesOnly.begin(); ited != edgesOnly.end(); ++ited) {
|
||||
for (int ited : edgesOnly) {
|
||||
std::pair<int, std::vector<int> > apair;
|
||||
apair.first = *ited;
|
||||
const SMDS_MeshElement* aEdge = myMesh->GetMeshDS()->FindElement(*ited);
|
||||
apair.first = ited;
|
||||
const SMDS_MeshElement* aEdge = myMesh->GetMeshDS()->FindElement(ited);
|
||||
int numNodes = aEdge->NbNodes();
|
||||
std::map<int, std::string>::iterator it = edgeTypeMap.find(numNodes);
|
||||
if (it != edgeTypeMap.end()) {
|
||||
const std::vector<int>& order = elemOrderMap[it->second];
|
||||
for (std::vector<int>::const_iterator jt = order.begin(); jt != order.end(); ++jt)
|
||||
apair.second.push_back(aEdge->GetNode(*jt)->GetID());
|
||||
for (int jt : order)
|
||||
apair.second.push_back(aEdge->GetNode(jt)->GetID());
|
||||
elementsMapEdg[it->second].insert(apair);
|
||||
}
|
||||
}
|
||||
@@ -2197,11 +2193,11 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
anABAQUS_Output << "*Node, NSET=Nall" << std::endl;
|
||||
// This way we get sorted output.
|
||||
// See http://forum.freecad.org/viewtopic.php?f=18&t=12646&start=40#p103004
|
||||
for (VertexMap::iterator it = vertexMap.begin(); it != vertexMap.end(); ++it) {
|
||||
anABAQUS_Output << it->first << ", "
|
||||
<< it->second.x << ", "
|
||||
<< it->second.y << ", "
|
||||
<< it->second.z << std::endl;
|
||||
for (const auto& it : vertexMap) {
|
||||
anABAQUS_Output << it.first << ", "
|
||||
<< it.second.x << ", "
|
||||
<< it.second.y << ", "
|
||||
<< it.second.z << std::endl;
|
||||
}
|
||||
anABAQUS_Output << std::endl << std::endl;;
|
||||
|
||||
@@ -2209,16 +2205,15 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
// write volumes to file
|
||||
std::string elsetname;
|
||||
if (!elementsMapVol.empty()) {
|
||||
for (ElementsMap::iterator it = elementsMapVol.begin(); it != elementsMapVol.end(); ++it) {
|
||||
for (const auto& it : elementsMapVol) {
|
||||
anABAQUS_Output << "** Volume elements" << std::endl;
|
||||
anABAQUS_Output << "*Element, TYPE=" << it->first << ", ELSET=Evolumes" << std::endl;
|
||||
for (NodesMap::iterator jt = it->second.begin(); jt != it->second.end(); ++jt) {
|
||||
anABAQUS_Output << jt->first;
|
||||
anABAQUS_Output << "*Element, TYPE=" << it.first << ", ELSET=Evolumes" << std::endl;
|
||||
for (const auto& jt : it.second) {
|
||||
anABAQUS_Output << jt.first;
|
||||
// Calculix allows max 16 entries in one line, a hexa20 has more !
|
||||
int ct = 0; // counter
|
||||
bool first_line = true;
|
||||
for (std::vector<int>::iterator kt = jt->second.begin(); kt != jt->second.end();
|
||||
++kt, ++ct) {
|
||||
for (auto kt = jt.second.begin(); kt != jt.second.end(); ++kt, ++ct) {
|
||||
if (ct < 15) {
|
||||
anABAQUS_Output << ", " << *kt;
|
||||
}
|
||||
@@ -2239,14 +2234,13 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
|
||||
// write faces to file
|
||||
if (!elementsMapFac.empty()) {
|
||||
for (ElementsMap::iterator it = elementsMapFac.begin(); it != elementsMapFac.end(); ++it) {
|
||||
for (const auto& it : elementsMapFac) {
|
||||
anABAQUS_Output << "** Face elements" << std::endl;
|
||||
anABAQUS_Output << "*Element, TYPE=" << it->first << ", ELSET=Efaces" << std::endl;
|
||||
for (NodesMap::iterator jt = it->second.begin(); jt != it->second.end(); ++jt) {
|
||||
anABAQUS_Output << jt->first;
|
||||
for (std::vector<int>::iterator kt = jt->second.begin(); kt != jt->second.end();
|
||||
++kt) {
|
||||
anABAQUS_Output << ", " << *kt;
|
||||
anABAQUS_Output << "*Element, TYPE=" << it.first << ", ELSET=Efaces" << std::endl;
|
||||
for (const auto& jt : it.second) {
|
||||
anABAQUS_Output << jt.first;
|
||||
for (int kt : jt.second) {
|
||||
anABAQUS_Output << ", " << kt;
|
||||
}
|
||||
anABAQUS_Output << std::endl;
|
||||
}
|
||||
@@ -2260,14 +2254,13 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
|
||||
// write edges to file
|
||||
if (!elementsMapEdg.empty()) {
|
||||
for (ElementsMap::iterator it = elementsMapEdg.begin(); it != elementsMapEdg.end(); ++it) {
|
||||
for (const auto& it : elementsMapEdg) {
|
||||
anABAQUS_Output << "** Edge elements" << std::endl;
|
||||
anABAQUS_Output << "*Element, TYPE=" << it->first << ", ELSET=Eedges" << std::endl;
|
||||
for (NodesMap::iterator jt = it->second.begin(); jt != it->second.end(); ++jt) {
|
||||
anABAQUS_Output << jt->first;
|
||||
for (std::vector<int>::iterator kt = jt->second.begin(); kt != jt->second.end();
|
||||
++kt) {
|
||||
anABAQUS_Output << ", " << *kt;
|
||||
anABAQUS_Output << "*Element, TYPE=" << it.first << ", ELSET=Eedges" << std::endl;
|
||||
for (const auto& jt : it.second) {
|
||||
anABAQUS_Output << jt.first;
|
||||
for (int kt : jt.second) {
|
||||
anABAQUS_Output << ", " << kt;
|
||||
}
|
||||
anABAQUS_Output << std::endl;
|
||||
}
|
||||
@@ -2293,12 +2286,12 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
anABAQUS_Output << std::endl << "** Group data" << std::endl;
|
||||
|
||||
std::list<int> groupIDs = myMesh->GetGroupIds();
|
||||
for (std::list<int>::iterator it = groupIDs.begin(); it != groupIDs.end(); ++it) {
|
||||
for (int it : groupIDs) {
|
||||
|
||||
// get and write group info and group definition
|
||||
// TODO group element type code has duplicate code of
|
||||
// PyObject* FemMeshPy::getGroupElementType()
|
||||
SMDSAbs_ElementType aElementType = myMesh->GetGroup(*it)->GetGroupDS()->GetType();
|
||||
SMDSAbs_ElementType aElementType = myMesh->GetGroup(it)->GetGroupDS()->GetType();
|
||||
const char* groupElementType = "";
|
||||
switch(aElementType) {
|
||||
case SMDSAbs_All : groupElementType = "All"; break;
|
||||
@@ -2310,8 +2303,8 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
case SMDSAbs_Ball : groupElementType = "Ball"; break;
|
||||
default : groupElementType = "Unknown"; break;
|
||||
}
|
||||
const char* groupName = myMesh->GetGroup(*it)->GetName();
|
||||
anABAQUS_Output << "** GroupID: " << (*it) << " --> GroupName: " << groupName
|
||||
const char* groupName = myMesh->GetGroup(it)->GetName();
|
||||
anABAQUS_Output << "** GroupID: " << (it) << " --> GroupName: " << groupName
|
||||
<< " --> GroupElementType: " << groupElementType << std::endl;
|
||||
|
||||
if (aElementType == SMDSAbs_Node) {
|
||||
@@ -2323,13 +2316,13 @@ void FemMesh::writeABAQUS(const std::string &Filename, int elemParam, bool group
|
||||
|
||||
// get and write group elements
|
||||
std::set<int> ids;
|
||||
SMDS_ElemIteratorPtr aElemIter = myMesh->GetGroup(*it)->GetGroupDS()->GetElements();
|
||||
SMDS_ElemIteratorPtr aElemIter = myMesh->GetGroup(it)->GetGroupDS()->GetElements();
|
||||
while (aElemIter->more()) {
|
||||
const SMDS_MeshElement* aElement = aElemIter->next();
|
||||
ids.insert(aElement->GetID());
|
||||
}
|
||||
for (std::set<int>::iterator it = ids.begin(); it != ids.end(); ++it) {
|
||||
anABAQUS_Output << *it << std::endl;
|
||||
for (int it : ids) {
|
||||
anABAQUS_Output << it << std::endl;
|
||||
}
|
||||
|
||||
// write newline after each group
|
||||
|
||||
@@ -811,8 +811,8 @@ PyObject* FemMeshPy::getNodesBySolid(PyObject *args)
|
||||
}
|
||||
Py::List ret;
|
||||
std::set<int> resultSet = getFemMeshPtr()->getNodesBySolid(fc);
|
||||
for (std::set<int>::const_iterator it = resultSet.begin();it!=resultSet.end();++it)
|
||||
ret.append(Py::Long(*it));
|
||||
for (int it : resultSet)
|
||||
ret.append(Py::Long(it));
|
||||
|
||||
return Py::new_reference_to(ret);
|
||||
|
||||
@@ -838,8 +838,8 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args)
|
||||
}
|
||||
Py::List ret;
|
||||
std::set<int> resultSet = getFemMeshPtr()->getNodesByFace(fc);
|
||||
for (std::set<int>::const_iterator it = resultSet.begin();it!=resultSet.end();++it)
|
||||
ret.append(Py::Long(*it));
|
||||
for (int it : resultSet)
|
||||
ret.append(Py::Long(it));
|
||||
|
||||
return Py::new_reference_to(ret);
|
||||
|
||||
@@ -865,8 +865,8 @@ PyObject* FemMeshPy::getNodesByEdge(PyObject *args)
|
||||
}
|
||||
Py::List ret;
|
||||
std::set<int> resultSet = getFemMeshPtr()->getNodesByEdge(fc);
|
||||
for (std::set<int>::const_iterator it = resultSet.begin();it!=resultSet.end();++it)
|
||||
ret.append(Py::Long(*it));
|
||||
for (int it : resultSet)
|
||||
ret.append(Py::Long(it));
|
||||
|
||||
return Py::new_reference_to(ret);
|
||||
|
||||
@@ -892,8 +892,8 @@ PyObject* FemMeshPy::getNodesByVertex(PyObject *args)
|
||||
}
|
||||
Py::List ret;
|
||||
std::set<int> resultSet = getFemMeshPtr()->getNodesByVertex(fc);
|
||||
for (std::set<int>::const_iterator it = resultSet.begin();it!=resultSet.end();++it)
|
||||
ret.append(Py::Long(*it));
|
||||
for (int it : resultSet)
|
||||
ret.append(Py::Long(it));
|
||||
|
||||
return Py::new_reference_to(ret);
|
||||
|
||||
@@ -957,8 +957,8 @@ PyObject* FemMeshPy::getNodeElements(PyObject* args)
|
||||
std::list<int> elemList = getFemMeshPtr()->getNodeElements(id, elemType);
|
||||
Py::Tuple result(elemList.size());
|
||||
int index = 0;
|
||||
for (std::list<int>::iterator it = elemList.begin(); it != elemList.end(); ++it) {
|
||||
result.setItem(index++, Py::Long(*it));
|
||||
for (int it : elemList) {
|
||||
result.setItem(index++, Py::Long(it));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(result);
|
||||
@@ -1021,8 +1021,8 @@ PyObject* FemMeshPy::getGroupElements(PyObject *args)
|
||||
|
||||
Py::Tuple tuple(ids.size());
|
||||
int index = 0;
|
||||
for (std::set<int>::iterator it = ids.begin(); it != ids.end(); ++it) {
|
||||
tuple.setItem(index++, Py::Long(*it));
|
||||
for (int it : ids) {
|
||||
tuple.setItem(index++, Py::Long(it));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(tuple);
|
||||
@@ -1092,8 +1092,8 @@ PyObject* FemMeshPy::addGroupElements(PyObject *args)
|
||||
|
||||
// Downcast Py_ssize_t to int to be compatible with SMESH functions
|
||||
std::set<int> int_ids;
|
||||
for (std::set<Py_ssize_t>::iterator it = ids.begin(); it != ids.end(); ++it)
|
||||
int_ids.insert(Py_SAFE_DOWNCAST(*it, Py_ssize_t, int));
|
||||
for (Py_ssize_t it : ids)
|
||||
int_ids.insert(Py_SAFE_DOWNCAST(it, Py_ssize_t, int));
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1166,8 +1166,8 @@ PyObject* FemMeshPy::getIdByElementType(PyObject *args)
|
||||
|
||||
Py::Tuple tuple(ids.size());
|
||||
int index = 0;
|
||||
for (std::set<int>::iterator it = ids.begin(); it != ids.end(); ++it) {
|
||||
tuple.setItem(index++, Py::Long(*it));
|
||||
for (int it : ids) {
|
||||
tuple.setItem(index++, Py::Long(it));
|
||||
}
|
||||
|
||||
return Py::new_reference_to(tuple);
|
||||
@@ -1214,8 +1214,8 @@ Py::Tuple FemMeshPy::getEdges() const
|
||||
|
||||
Py::Tuple tuple(ids.size());
|
||||
int index = 0;
|
||||
for (std::set<int>::iterator it = ids.begin(); it != ids.end(); ++it) {
|
||||
tuple.setItem(index++, Py::Long(*it));
|
||||
for (int it : ids) {
|
||||
tuple.setItem(index++, Py::Long(it));
|
||||
}
|
||||
|
||||
return tuple;
|
||||
@@ -1226,8 +1226,8 @@ Py::Tuple FemMeshPy::getEdgesOnly() const
|
||||
std::set<int> resultSet = getFemMeshPtr()->getEdgesOnly();
|
||||
Py::Tuple tuple(resultSet.size());
|
||||
int index = 0;
|
||||
for (std::set<int>::iterator it = resultSet.begin(); it != resultSet.end(); ++it) {
|
||||
tuple.setItem(index++, Py::Long(*it));
|
||||
for (int it : resultSet) {
|
||||
tuple.setItem(index++, Py::Long(it));
|
||||
}
|
||||
|
||||
return tuple;
|
||||
@@ -1249,8 +1249,8 @@ Py::Tuple FemMeshPy::getFaces() const
|
||||
|
||||
Py::Tuple tuple(ids.size());
|
||||
int index = 0;
|
||||
for (std::set<int>::iterator it = ids.begin(); it != ids.end(); ++it) {
|
||||
tuple.setItem(index++, Py::Long(*it));
|
||||
for (int it : ids) {
|
||||
tuple.setItem(index++, Py::Long(it));
|
||||
}
|
||||
|
||||
return tuple;
|
||||
@@ -1261,8 +1261,8 @@ Py::Tuple FemMeshPy::getFacesOnly() const
|
||||
std::set<int> resultSet = getFemMeshPtr()->getFacesOnly();
|
||||
Py::Tuple tuple(resultSet.size());
|
||||
int index = 0;
|
||||
for (std::set<int>::iterator it = resultSet.begin(); it != resultSet.end(); ++it) {
|
||||
tuple.setItem(index++, Py::Long(*it));
|
||||
for (int it : resultSet) {
|
||||
tuple.setItem(index++, Py::Long(it));
|
||||
}
|
||||
|
||||
return tuple;
|
||||
@@ -1299,8 +1299,8 @@ Py::Tuple FemMeshPy::getVolumes() const
|
||||
|
||||
Py::Tuple tuple(ids.size());
|
||||
int index = 0;
|
||||
for (std::set<int>::iterator it = ids.begin(); it != ids.end(); ++it) {
|
||||
tuple.setItem(index++, Py::Long(*it));
|
||||
for (int it : ids) {
|
||||
tuple.setItem(index++, Py::Long(it));
|
||||
}
|
||||
|
||||
return tuple;
|
||||
@@ -1352,8 +1352,8 @@ Py::Tuple FemMeshPy::getGroups() const
|
||||
|
||||
Py::Tuple tuple(groupIDs.size());
|
||||
int index = 0;
|
||||
for (std::list<int>::iterator it = groupIDs.begin(); it != groupIDs.end(); ++it) {
|
||||
tuple.setItem(index++, Py::Long(*it));
|
||||
for (int it : groupIDs) {
|
||||
tuple.setItem(index++, Py::Long(it));
|
||||
}
|
||||
|
||||
return tuple;
|
||||
|
||||
@@ -101,10 +101,9 @@ vtkDataObject* FemPostFilter::getInputData()
|
||||
//get the pipeline and use the pipelinedata
|
||||
std::vector<App::DocumentObject*> objs =
|
||||
getDocument()->getObjectsOfType(FemPostPipeline::getClassTypeId());
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it != objs.end();
|
||||
++it) {
|
||||
if (static_cast<FemPostPipeline*>(*it)->holdsPostObject(this))
|
||||
return static_cast<FemPostObject*>(*it)->Data.getValue();
|
||||
for (auto it : objs) {
|
||||
if (static_cast<FemPostPipeline*>(it)->holdsPostObject(this))
|
||||
return static_cast<FemPostObject*>(it)->Data.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -589,9 +589,9 @@ App::DocumentObject* getObjectByType(const Base::Type type)
|
||||
}
|
||||
if (obj->getTypeId() == FemAnalysis::getClassTypeId()) {
|
||||
std::vector<App::DocumentObject*> fem = (static_cast<FemAnalysis*>(obj))->Group.getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = fem.begin(); it != fem.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(type))
|
||||
return static_cast<App::DocumentObject*>(*it);// return the first of that type
|
||||
for (const auto & it : fem) {
|
||||
if (it->getTypeId().isDerivedFrom(type))
|
||||
return static_cast<App::DocumentObject*>(it);// return the first of that type
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@@ -833,14 +833,13 @@ void FemVTKTools::importFreeCADResult(vtkSmartPointer<vtkDataSet> dataset,
|
||||
Base::Console().Log(" NodeNumbers have been filled with values.\n");
|
||||
|
||||
// vectors
|
||||
for (std::map<std::string, std::string>::iterator it = vectors.begin(); it != vectors.end();
|
||||
++it) {
|
||||
for (const auto & it : vectors) {
|
||||
int dim = 3;// Fixme: currently 3D only, here we could run into trouble,
|
||||
// FreeCAD only supports dim 3D, I do not know about VTK
|
||||
vtkDataArray* vector_field = vtkDataArray::SafeDownCast(pd->GetArray(it->second.c_str()));
|
||||
vtkDataArray* vector_field = vtkDataArray::SafeDownCast(pd->GetArray(it.second.c_str()));
|
||||
if (vector_field && vector_field->GetNumberOfComponents() == dim) {
|
||||
App::PropertyVectorList* vector_list =
|
||||
static_cast<App::PropertyVectorList*>(result->getPropertyByName(it->first.c_str()));
|
||||
static_cast<App::PropertyVectorList*>(result->getPropertyByName(it.first.c_str()));
|
||||
if (vector_list) {
|
||||
std::vector<Base::Vector3d> vec(nPoints);
|
||||
for (vtkIdType i = 0; i < nPoints; ++i) {
|
||||
@@ -851,31 +850,30 @@ void FemVTKTools::importFreeCADResult(vtkSmartPointer<vtkDataSet> dataset,
|
||||
// PropertyVectorList will not show up in PropertyEditor
|
||||
vector_list->setValues(vec);
|
||||
Base::Console().Log(" A PropertyVectorList has been filled with values: %s\n",
|
||||
it->first.c_str());
|
||||
it.first.c_str());
|
||||
}
|
||||
else {
|
||||
Base::Console().Error("static_cast<App::PropertyVectorList*>((result->"
|
||||
"getPropertyByName(\"%s\")) failed.\n",
|
||||
it->first.c_str());
|
||||
it.first.c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
Base::Console().Message(" PropertyVectorList NOT found in vkt file data: %s\n",
|
||||
it->first.c_str());
|
||||
it.first.c_str());
|
||||
}
|
||||
|
||||
// scalars
|
||||
for (std::map<std::string, std::string>::iterator it = scalars.begin(); it != scalars.end();
|
||||
++it) {
|
||||
vtkDataArray* vec = vtkDataArray::SafeDownCast(pd->GetArray(it->second.c_str()));
|
||||
for (const auto & scalar : scalars) {
|
||||
vtkDataArray* vec = vtkDataArray::SafeDownCast(pd->GetArray(scalar.second.c_str()));
|
||||
if (nPoints && vec && vec->GetNumberOfComponents() == 1) {
|
||||
App::PropertyFloatList* field =
|
||||
static_cast<App::PropertyFloatList*>(result->getPropertyByName(it->first.c_str()));
|
||||
static_cast<App::PropertyFloatList*>(result->getPropertyByName(scalar.first.c_str()));
|
||||
if (!field) {
|
||||
Base::Console().Error("static_cast<App::PropertyFloatList*>((result->"
|
||||
"getPropertyByName(\"%s\")) failed.\n",
|
||||
it->first.c_str());
|
||||
scalar.first.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -891,11 +889,11 @@ void FemVTKTools::importFreeCADResult(vtkSmartPointer<vtkDataSet> dataset,
|
||||
}
|
||||
field->setValues(values);
|
||||
Base::Console().Log(" A PropertyFloatList has been filled with vales: %s\n",
|
||||
it->first.c_str());
|
||||
scalar.first.c_str());
|
||||
}
|
||||
else
|
||||
Base::Console().Message(" PropertyFloatList NOT found in vkt file data %s\n",
|
||||
it->first.c_str());
|
||||
scalar.first.c_str());
|
||||
}
|
||||
|
||||
// stats
|
||||
@@ -933,15 +931,14 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result,
|
||||
double factor = 1.0;
|
||||
|
||||
// vectors
|
||||
for (std::map<std::string, std::string>::iterator it = vectors.begin(); it != vectors.end();
|
||||
++it) {
|
||||
for (const auto & it : vectors) {
|
||||
const int dim = 3;//Fixme, detect dim, but FreeCAD PropertyVectorList ATM only has DIM of 3
|
||||
App::PropertyVectorList* field = nullptr;
|
||||
if (res->getPropertyByName(it->first.c_str()))
|
||||
if (res->getPropertyByName(it.first.c_str()))
|
||||
field =
|
||||
static_cast<App::PropertyVectorList*>(res->getPropertyByName(it->first.c_str()));
|
||||
static_cast<App::PropertyVectorList*>(res->getPropertyByName(it.first.c_str()));
|
||||
else
|
||||
Base::Console().Error(" PropertyVectorList not found: %s\n", it->first.c_str());
|
||||
Base::Console().Error(" PropertyVectorList not found: %s\n", it.first.c_str());
|
||||
|
||||
if (field && field->getSize() > 0) {
|
||||
//if (nPoints != field->getSize())
|
||||
@@ -951,7 +948,7 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result,
|
||||
vtkSmartPointer<vtkDoubleArray> data = vtkSmartPointer<vtkDoubleArray>::New();
|
||||
data->SetNumberOfComponents(dim);
|
||||
data->SetNumberOfTuples(nPoints);
|
||||
data->SetName(it->second.c_str());
|
||||
data->SetName(it.second.c_str());
|
||||
|
||||
// we need to set values for the unused points.
|
||||
// TODO: ensure that the result bar does not include the used 0 if it is not
|
||||
@@ -963,39 +960,37 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result,
|
||||
}
|
||||
}
|
||||
|
||||
if (it->first.compare("DisplacementVectors") == 0)
|
||||
if (it.first.compare("DisplacementVectors") == 0)
|
||||
factor = 0.001;// to get meter
|
||||
else
|
||||
factor = 1.0;
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = meshDS->nodesIterator();
|
||||
for (std::vector<Base::Vector3d>::const_iterator jt = vel.begin(); jt != vel.end();
|
||||
++jt) {
|
||||
for (const auto & jt : vel) {
|
||||
const SMDS_MeshNode* node = aNodeIter->next();
|
||||
double tuple[] = {jt->x * factor, jt->y * factor, jt->z * factor};
|
||||
double tuple[] = {jt.x * factor, jt.y * factor, jt.z * factor};
|
||||
data->SetTuple(node->GetID() - 1, tuple);
|
||||
}
|
||||
grid->GetPointData()->AddArray(data);
|
||||
Base::Console().Log(
|
||||
" The PropertyVectorList %s was exported to VTK vector list: %s\n",
|
||||
it->first.c_str(),
|
||||
it->second.c_str());
|
||||
it.first.c_str(),
|
||||
it.second.c_str());
|
||||
}
|
||||
else if (field) {
|
||||
Base::Console().Log(" PropertyVectorList NOT exported to vtk: %s size is: %i\n",
|
||||
it->first.c_str(),
|
||||
it.first.c_str(),
|
||||
field->getSize());
|
||||
}
|
||||
}
|
||||
|
||||
// scalars
|
||||
for (std::map<std::string, std::string>::iterator it = scalars.begin(); it != scalars.end();
|
||||
++it) {
|
||||
for (const auto & scalar : scalars) {
|
||||
App::PropertyFloatList* field = nullptr;
|
||||
if (res->getPropertyByName(it->first.c_str()))
|
||||
field = static_cast<App::PropertyFloatList*>(res->getPropertyByName(it->first.c_str()));
|
||||
if (res->getPropertyByName(scalar.first.c_str()))
|
||||
field = static_cast<App::PropertyFloatList*>(res->getPropertyByName(scalar.first.c_str()));
|
||||
else
|
||||
Base::Console().Error("PropertyFloatList %s not found \n", it->first.c_str());
|
||||
Base::Console().Error("PropertyFloatList %s not found \n", scalar.first.c_str());
|
||||
|
||||
if (field && field->getSize() > 0) {
|
||||
//if (nPoints != field->getSize())
|
||||
@@ -1004,7 +999,7 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result,
|
||||
const std::vector<double>& vec = field->getValues();
|
||||
vtkSmartPointer<vtkDoubleArray> data = vtkSmartPointer<vtkDoubleArray>::New();
|
||||
data->SetNumberOfValues(nPoints);
|
||||
data->SetName(it->second.c_str());
|
||||
data->SetName(scalar.second.c_str());
|
||||
|
||||
// we need to set values for the unused points.
|
||||
// TODO: ensure that the result bar does not include the used 0 if it is not part
|
||||
@@ -1015,41 +1010,41 @@ void FemVTKTools::exportFreeCADResult(const App::DocumentObject* result,
|
||||
}
|
||||
}
|
||||
|
||||
if ((it->first.compare("MaxShear") == 0)
|
||||
|| (it->first.compare("NodeStressXX") == 0)
|
||||
|| (it->first.compare("NodeStressXY") == 0)
|
||||
|| (it->first.compare("NodeStressXZ") == 0)
|
||||
|| (it->first.compare("NodeStressYY") == 0)
|
||||
|| (it->first.compare("NodeStressYZ") == 0)
|
||||
|| (it->first.compare("NodeStressZZ") == 0)
|
||||
|| (it->first.compare("PrincipalMax") == 0)
|
||||
|| (it->first.compare("PrincipalMed") == 0)
|
||||
|| (it->first.compare("PrincipalMin") == 0)
|
||||
|| (it->first.compare("vonMises") == 0)
|
||||
|| (it->first.compare("NetworkPressure") == 0) )
|
||||
if ((scalar.first.compare("MaxShear") == 0)
|
||||
|| (scalar.first.compare("NodeStressXX") == 0)
|
||||
|| (scalar.first.compare("NodeStressXY") == 0)
|
||||
|| (scalar.first.compare("NodeStressXZ") == 0)
|
||||
|| (scalar.first.compare("NodeStressYY") == 0)
|
||||
|| (scalar.first.compare("NodeStressYZ") == 0)
|
||||
|| (scalar.first.compare("NodeStressZZ") == 0)
|
||||
|| (scalar.first.compare("PrincipalMax") == 0)
|
||||
|| (scalar.first.compare("PrincipalMed") == 0)
|
||||
|| (scalar.first.compare("PrincipalMin") == 0)
|
||||
|| (scalar.first.compare("vonMises") == 0)
|
||||
|| (scalar.first.compare("NetworkPressure") == 0) )
|
||||
factor = 1e6; // to get Pascal
|
||||
else if (it->first.compare("DisplacementLengths") == 0)
|
||||
else if (scalar.first.compare("DisplacementLengths") == 0)
|
||||
factor = 0.001; // to get meter
|
||||
else
|
||||
factor = 1.0;
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = meshDS->nodesIterator();
|
||||
for (size_t i = 0; i < vec.size(); ++i) {
|
||||
for (double i : vec) {
|
||||
const SMDS_MeshNode* node = aNodeIter->next();
|
||||
// for the MassFlowRate the last vec entries can be a nullptr, thus check this
|
||||
if (node)
|
||||
data->SetValue(node->GetID() - 1, vec[i] * factor);
|
||||
data->SetValue(node->GetID() - 1, i * factor);
|
||||
}
|
||||
|
||||
grid->GetPointData()->AddArray(data);
|
||||
Base::Console().Log(
|
||||
" The PropertyFloatList %s was exported to VTK scalar list: %s\n",
|
||||
it->first.c_str(),
|
||||
it->second.c_str());
|
||||
scalar.first.c_str(),
|
||||
scalar.second.c_str());
|
||||
}
|
||||
else if (field) {
|
||||
Base::Console().Log(" PropertyFloatList NOT exported to vtk: %s size is: %i\n",
|
||||
it->first.c_str(),
|
||||
scalar.first.c_str(),
|
||||
field->getSize());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ void PropertyPostDataObject::scaleDataObject(vtkDataObject *dataObject, double s
|
||||
for (vtkIdType i = 0; i < points->GetNumberOfPoints(); i++) {
|
||||
double xyz[3];
|
||||
points->GetPoint(i, xyz);
|
||||
for (int j = 0; j < 3; j++)
|
||||
xyz[j] *= s;
|
||||
for (double & j : xyz)
|
||||
j *= s;
|
||||
points->SetPoint(i, xyz);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -118,9 +118,9 @@ private:
|
||||
fi.setFile(fileName);
|
||||
QString ext = fi.completeSuffix().toLower();
|
||||
QList<Gui::EditorView*> views = Gui::getMainWindow()->findChildren<Gui::EditorView*>();
|
||||
for (QList<Gui::EditorView*>::Iterator it = views.begin(); it != views.end(); ++it) {
|
||||
if ((*it)->fileName() == fileName) {
|
||||
(*it)->setFocus();
|
||||
for (auto view : views) {
|
||||
if (view->fileName() == fileName) {
|
||||
view->setFocus();
|
||||
return Py::None();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -950,8 +950,8 @@ void DefineNodesCallback(void* ud, SoEventCallback* n)
|
||||
SbViewVolume vv = cam->getViewVolume();
|
||||
Gui::ViewVolumeProjection proj(vv);
|
||||
Base::Polygon2d polygon;
|
||||
for (std::vector<SbVec2f>::const_iterator it = clPoly.begin(); it != clPoly.end(); ++it)
|
||||
polygon.Add(Base::Vector2d((*it)[0], (*it)[1]));
|
||||
for (auto it : clPoly)
|
||||
polygon.Add(Base::Vector2d(it[0], it[1]));
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> docObj =
|
||||
@@ -2364,12 +2364,11 @@ void CmdFemPostPipelineFromResult::activated(int)
|
||||
const std::vector<App::DocumentObject*> obj =
|
||||
app->getObjectsOfType(App::DocumentObject::getClassTypeId());
|
||||
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = obj.begin(); it != obj.end();
|
||||
++it) {
|
||||
for (auto it : obj) {
|
||||
doCommand(Gui,
|
||||
"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=False",
|
||||
app->getName(),
|
||||
(*it)->getNameInDocument());
|
||||
it->getNameInDocument());
|
||||
}
|
||||
|
||||
// we need single result object to attach the pipeline to
|
||||
|
||||
@@ -92,8 +92,8 @@ QVariant PropertyFemMeshItem::value(const App::Property*) const
|
||||
int ctG = 0;
|
||||
|
||||
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);
|
||||
for (auto pt : props) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(pt);
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctN += mesh->NbNodes();
|
||||
ctE += mesh->NbEdges();
|
||||
@@ -152,8 +152,8 @@ int PropertyFemMeshItem::countNodes() const
|
||||
{
|
||||
int ctN = 0;
|
||||
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);
|
||||
for (auto pt : props) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(pt);
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctN += mesh->NbNodes();
|
||||
}
|
||||
@@ -165,8 +165,8 @@ int PropertyFemMeshItem::countEdges() const
|
||||
{
|
||||
int ctE = 0;
|
||||
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);
|
||||
for (auto pt : props) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(pt);
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctE += mesh->NbEdges();
|
||||
}
|
||||
@@ -178,8 +178,8 @@ int PropertyFemMeshItem::countFaces() const
|
||||
{
|
||||
int ctF = 0;
|
||||
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);
|
||||
for (auto pt : props) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(pt);
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctF += mesh->NbFaces();
|
||||
}
|
||||
@@ -191,8 +191,8 @@ int PropertyFemMeshItem::countPolygons() const
|
||||
{
|
||||
int ctP = 0;
|
||||
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);
|
||||
for (auto pt : props) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(pt);
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctP += mesh->NbPolygons();
|
||||
}
|
||||
@@ -204,8 +204,8 @@ int PropertyFemMeshItem::countVolumes() const
|
||||
{
|
||||
int ctV = 0;
|
||||
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);
|
||||
for (auto pt : props) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(pt);
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctV += mesh->NbVolumes();
|
||||
}
|
||||
@@ -217,8 +217,8 @@ int PropertyFemMeshItem::countPolyhedrons() const
|
||||
{
|
||||
int ctH = 0;
|
||||
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);
|
||||
for (auto pt : props) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(pt);
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctH += mesh->NbPolyhedrons();
|
||||
}
|
||||
@@ -230,8 +230,8 @@ int PropertyFemMeshItem::countGroups() const
|
||||
{
|
||||
int ctG = 0;
|
||||
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);
|
||||
for (auto pt : props) {
|
||||
Fem::PropertyFemMesh* prop = static_cast<Fem::PropertyFemMesh*>(pt);
|
||||
const SMESH_Mesh* mesh = prop->getValue().getSMesh();
|
||||
ctG += mesh->NbGroup();
|
||||
}
|
||||
|
||||
@@ -148,8 +148,8 @@ void TaskCreateNodeSet::DefineNodesCallback(void* ud, SoEventCallback* n)
|
||||
SbViewVolume vv = cam->getViewVolume();
|
||||
Gui::ViewVolumeProjection proj(vv);
|
||||
Base::Polygon2d polygon;
|
||||
for (std::vector<SbVec2f>::const_iterator it = clPoly.begin(); it != clPoly.end(); ++it)
|
||||
polygon.Add(Base::Vector2d((*it)[0], (*it)[1]));
|
||||
for (auto it : clPoly)
|
||||
polygon.Add(Base::Vector2d(it[0], it[1]));
|
||||
|
||||
taskBox->DefineNodes(polygon, proj, role == Gui::SelectionRole::Inner ? true : false);
|
||||
}
|
||||
|
||||
@@ -166,14 +166,13 @@ void TaskFemConstraintContact::addToSelectionSlave()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
|
||||
if (subNames.size() != 1) {
|
||||
QMessageBox::warning(
|
||||
@@ -181,19 +180,18 @@ void TaskFemConstraintContact::addToSelectionSlave()
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
if (subNames[subIt].substr(0, 4) != "Face") {
|
||||
if (subName.substr(0, 4) != "Face") {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -206,8 +204,8 @@ void TaskFemConstraintContact::addToSelectionSlave()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->lw_referencesSlave);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_referencesSlave->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_referencesSlave->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,23 +227,21 @@ void TaskFemConstraintContact::removeFromSelectionSlave()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -300,33 +296,31 @@ void TaskFemConstraintContact::addToSelectionMaster()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
if (subNames.size() != 1) {
|
||||
QMessageBox::warning(
|
||||
this, tr("Selection error"), tr("Only one master face for a contact constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
if (subNames[subIt].substr(0, 4) != "Face") {
|
||||
if (subName.substr(0, 4) != "Face") {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -339,8 +333,8 @@ void TaskFemConstraintContact::addToSelectionMaster()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->lw_referencesMaster);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_referencesMaster->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_referencesMaster->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -362,23 +356,21 @@ void TaskFemConstraintContact::removeFromSelectionMaster()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -308,23 +308,21 @@ void TaskFemConstraintDisplacement::addToSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -337,14 +335,14 @@ void TaskFemConstraintDisplacement::addToSelection()
|
||||
// limit constraint such that only vertexes or faces or edges can be used depending on
|
||||
// what was selected first
|
||||
std::string searchStr;
|
||||
if (subNames[subIt].find("Vertex") != std::string::npos)
|
||||
if (subName.find("Vertex") != std::string::npos)
|
||||
searchStr = "Vertex";
|
||||
else if (subNames[subIt].find("Edge") != std::string::npos)
|
||||
else if (subName.find("Edge") != std::string::npos)
|
||||
searchStr = "Edge";
|
||||
else
|
||||
searchStr = "Face";
|
||||
for (size_t iStr = 0; iStr < (SubElements.size()); ++iStr) {
|
||||
if (SubElements[iStr].find(searchStr) == std::string::npos) {
|
||||
for (const auto & SubElement : SubElements) {
|
||||
if (SubElement.find(searchStr) == std::string::npos) {
|
||||
QString msg = tr(
|
||||
"Only one type of selection (vertex,face or edge) per constraint allowed!");
|
||||
QMessageBox::warning(this, tr("Selection error"), msg);
|
||||
@@ -355,8 +353,8 @@ void TaskFemConstraintDisplacement::addToSelection()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->lw_references);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_references->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_references->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -378,23 +376,21 @@ void TaskFemConstraintDisplacement::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -113,24 +113,22 @@ void TaskFemConstraintFixed::addToSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
std::vector<std::string> subNames = it->getSubNames();
|
||||
std::vector<std::string> subNames = it.getSubNames();
|
||||
App::DocumentObject* obj =
|
||||
ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
ConstraintView->getObject()->getDocument()->getObject(it.getFeatName());
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -143,14 +141,14 @@ void TaskFemConstraintFixed::addToSelection()
|
||||
// limit constraint such that only vertexes or faces or edges can be used depending
|
||||
// on what was selected first
|
||||
std::string searchStr;
|
||||
if (subNames[subIt].find("Vertex") != std::string::npos)
|
||||
if (subName.find("Vertex") != std::string::npos)
|
||||
searchStr = "Vertex";
|
||||
else if (subNames[subIt].find("Edge") != std::string::npos)
|
||||
else if (subName.find("Edge") != std::string::npos)
|
||||
searchStr = "Edge";
|
||||
else
|
||||
searchStr = "Face";
|
||||
for (size_t iStr = 0; iStr < (SubElements.size()); ++iStr) {
|
||||
if (SubElements[iStr].find(searchStr) == std::string::npos) {
|
||||
for (const auto & SubElement : SubElements) {
|
||||
if (SubElement.find(searchStr) == std::string::npos) {
|
||||
QString msg = tr(
|
||||
"Only one type of selection (vertex,face or edge) per constraint allowed!");
|
||||
QMessageBox::warning(this, tr("Selection error"), msg);
|
||||
@@ -161,8 +159,8 @@ void TaskFemConstraintFixed::addToSelection()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->lw_references);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_references->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_references->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,23 +182,21 @@ void TaskFemConstraintFixed::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -205,9 +205,9 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(
|
||||
Fem::FemMeshObject* pcMesh = nullptr;
|
||||
if (pcAnalysis) {
|
||||
std::vector<App::DocumentObject*> fem = pcAnalysis->Group.getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = fem.begin(); it != fem.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(Fem::FemMeshObject::getClassTypeId()))
|
||||
pcMesh = static_cast<Fem::FemMeshObject*>(*it);
|
||||
for (auto it : fem) {
|
||||
if (it->getTypeId().isDerivedFrom(Fem::FemMeshObject::getClassTypeId()))
|
||||
pcMesh = static_cast<Fem::FemMeshObject*>(it);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -241,9 +241,9 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(
|
||||
pcSolver = nullptr; // this is an private object of type Fem::FemSolverObject*
|
||||
if (pcAnalysis) {
|
||||
std::vector<App::DocumentObject*> fem = pcAnalysis->Group.getValues();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = fem.begin(); it != fem.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(Fem::FemSolverObject::getClassTypeId()))
|
||||
pcSolver = static_cast<Fem::FemSolverObject*>(*it);
|
||||
for (auto it : fem) {
|
||||
if (it->getTypeId().isDerivedFrom(Fem::FemSolverObject::getClassTypeId()))
|
||||
pcSolver = static_cast<Fem::FemSolverObject*>(it);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,22 +790,21 @@ void TaskFemConstraintFluidBoundary::addToSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
for (size_t subIt = 0; subIt < subNames.size(); ++subIt) {// for every selected sub element
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -818,15 +817,15 @@ void TaskFemConstraintFluidBoundary::addToSelection()
|
||||
// limit constraint such that only vertexes or faces or edges can be used depending on
|
||||
// what was selected first
|
||||
std::string searchStr;
|
||||
if (subNames[subIt].find("Vertex") != std::string::npos)
|
||||
if (subName.find("Vertex") != std::string::npos)
|
||||
searchStr = "Vertex";
|
||||
else if (subNames[subIt].find("Edge") != std::string::npos)
|
||||
else if (subName.find("Edge") != std::string::npos)
|
||||
searchStr = "Edge";
|
||||
else
|
||||
searchStr = "Face";
|
||||
|
||||
for (size_t iStr = 0; iStr < (SubElements.size()); ++iStr) {
|
||||
if (SubElements[iStr].find(searchStr) == std::string::npos) {
|
||||
for (const auto & SubElement : SubElements) {
|
||||
if (SubElement.find(searchStr) == std::string::npos) {
|
||||
QString msg = tr(
|
||||
"Only one type of selection (vertex,face or edge) per constraint allowed!");
|
||||
QMessageBox::warning(this, tr("Selection error"), msg);
|
||||
@@ -837,8 +836,8 @@ void TaskFemConstraintFluidBoundary::addToSelection()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->listReferences);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->listReferences->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->listReferences->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -860,23 +859,21 @@ void TaskFemConstraintFluidBoundary::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -136,23 +136,21 @@ void TaskFemConstraintForce::addToSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -165,15 +163,15 @@ void TaskFemConstraintForce::addToSelection()
|
||||
// limit constraint such that only vertexes or faces or edges can be used depending on
|
||||
// what was selected first
|
||||
std::string searchStr;
|
||||
if (subNames[subIt].find("Vertex") != std::string::npos)
|
||||
if (subName.find("Vertex") != std::string::npos)
|
||||
searchStr = "Vertex";
|
||||
else if (subNames[subIt].find("Edge") != std::string::npos)
|
||||
else if (subName.find("Edge") != std::string::npos)
|
||||
searchStr = "Edge";
|
||||
else
|
||||
searchStr = "Face";
|
||||
|
||||
for (size_t iStr = 0; iStr < (SubElements.size()); ++iStr) {
|
||||
if (SubElements[iStr].find(searchStr) == std::string::npos) {
|
||||
for (const auto & SubElement : SubElements) {
|
||||
if (SubElement.find(searchStr) == std::string::npos) {
|
||||
QString msg = tr(
|
||||
"Only one type of selection (vertex,face or edge) per constraint allowed!");
|
||||
QMessageBox::warning(this, tr("Selection error"), msg);
|
||||
@@ -184,8 +182,8 @@ void TaskFemConstraintForce::addToSelection()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->listReferences);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->listReferences->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->listReferences->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,23 +205,21 @@ void TaskFemConstraintForce::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -214,18 +214,17 @@ void TaskFemConstraintHeatflux::addToSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
|
||||
if (!subNames.empty()) {
|
||||
for (size_t subIt = 0; subIt < (subNames.size()); ++subIt) {
|
||||
if (subNames[subIt].substr(0, 4) != "Face") {
|
||||
for (const auto & subName : subNames) {
|
||||
if (subName.substr(0, 4) != "Face") {
|
||||
QMessageBox::warning(
|
||||
this, tr("Selection error"), tr("Selection must only consist of faces!"));
|
||||
return;
|
||||
@@ -236,15 +235,14 @@ void TaskFemConstraintHeatflux::addToSelection()
|
||||
// fix me, if an object is selected completely, getSelectionEx does not return any
|
||||
// SubElements
|
||||
}
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -257,8 +255,8 @@ void TaskFemConstraintHeatflux::addToSelection()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->lw_references);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_references->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_references->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,18 +279,17 @@ void TaskFemConstraintHeatflux::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
if (!subNames.empty()) {
|
||||
for (size_t subIt = 0; subIt < (subNames.size()); ++subIt) {
|
||||
if (subNames[subIt].substr(0, 4) != "Face") {
|
||||
for (const auto & subName : subNames) {
|
||||
if (subName.substr(0, 4) != "Face") {
|
||||
QMessageBox::warning(
|
||||
this, tr("Selection error"), tr("Selection must only consist of faces!"));
|
||||
return;
|
||||
@@ -303,14 +300,13 @@ void TaskFemConstraintHeatflux::removeFromSelection()
|
||||
// fix me, if an object is selected completely, getSelectionEx does not return any
|
||||
// SubElements
|
||||
}
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -130,29 +130,26 @@ void TaskFemConstraintPlaneRotation::addToSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin();
|
||||
it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(
|
||||
this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
|
||||
if (subNames.size() == 1) {
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
if ((subNames[subIt].substr(0, 4) != "Face")) {
|
||||
if ((subName.substr(0, 4) != "Face")) {
|
||||
QMessageBox::warning(
|
||||
this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
}
|
||||
Part::Feature* feat = static_cast<Part::Feature*>(obj);
|
||||
TopoDS_Shape ref = feat->Shape.getShape().getSubShape(subNames[subIt].c_str());
|
||||
if ((subNames[subIt].substr(0, 4) == "Face")) {
|
||||
TopoDS_Shape ref = feat->Shape.getShape().getSubShape(subName.c_str());
|
||||
if ((subName.substr(0, 4) == "Face")) {
|
||||
if (!Fem::Tools::isPlanar(TopoDS::Face(ref))) {
|
||||
QMessageBox::warning(
|
||||
this, tr("Selection error"), tr("Only planar faces can be picked"));
|
||||
@@ -160,11 +157,11 @@ void TaskFemConstraintPlaneRotation::addToSelection()
|
||||
}
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection
|
||||
subName)) {// for every sub element in selection
|
||||
// that matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -177,8 +174,8 @@ void TaskFemConstraintPlaneRotation::addToSelection()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->lw_references);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_references->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_references->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,23 +207,21 @@ void TaskFemConstraintPlaneRotation::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -130,28 +130,26 @@ void TaskFemConstraintPressure::addToSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
if (subNames[subIt].substr(0, 4) != "Face") {
|
||||
if (subName.substr(0, 4) != "Face") {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -164,8 +162,8 @@ void TaskFemConstraintPressure::addToSelection()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->lw_references);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_references->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_references->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,23 +185,21 @@ void TaskFemConstraintPressure::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -137,28 +137,26 @@ void TaskFemConstraintSpring::addToSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
if (subNames[subIt].substr(0, 4) != "Face") {
|
||||
if (subName.substr(0, 4) != "Face") {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -171,8 +169,8 @@ void TaskFemConstraintSpring::addToSelection()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->lw_references);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_references->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_references->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,23 +192,21 @@ void TaskFemConstraintSpring::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -156,24 +156,22 @@ void TaskFemConstraintTemperature::addToSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
std::vector<std::string> subNames = it->getSubNames();
|
||||
std::vector<std::string> subNames = it.getSubNames();
|
||||
App::DocumentObject* obj =
|
||||
ConstraintView->getObject()->getDocument()->getObject(it->getFeatName());
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
ConstraintView->getObject()->getDocument()->getObject(it.getFeatName());
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -186,8 +184,8 @@ void TaskFemConstraintTemperature::addToSelection()
|
||||
if (addMe) {
|
||||
QSignalBlocker block(ui->lw_references);
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_references->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_references->addItem(makeRefText(obj, subName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,23 +207,21 @@ void TaskFemConstraintTemperature::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -124,9 +124,9 @@ TaskFemConstraintTransform::TaskFemConstraintTransform(
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> nDispl = pcConstraint->NameDispl.getValues();
|
||||
for (std::size_t i = 0; i < nDispl.size(); i++) {
|
||||
ui->lw_dis_rect->addItem(makeText(nDispl[i]));
|
||||
ui->lw_dis_cylin->addItem(makeText(nDispl[i]));
|
||||
for (auto i : nDispl) {
|
||||
ui->lw_dis_rect->addItem(makeText(i));
|
||||
ui->lw_dis_cylin->addItem(makeText(i));
|
||||
}
|
||||
|
||||
if (!Objects.empty()) {
|
||||
@@ -290,31 +290,29 @@ void TaskFemConstraintTransform::addToSelection()
|
||||
|
||||
std::vector<App::DocumentObject*> ObjDispl = pcConstraint->RefDispl.getValues();
|
||||
std::vector<std::string> SubElemDispl = pcConstraint->RefDispl.getSubValues();
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
App::DocumentObject* obj = it.getObject();
|
||||
if (subNames.size() != 1) {
|
||||
QMessageBox::warning(
|
||||
this, tr("Selection error"), tr("Only one face for transform constraint!"));
|
||||
Gui::Selection().clearSelection();
|
||||
return;
|
||||
}
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto & subName : subNames) {// for every selected sub element
|
||||
bool addMe = true;
|
||||
if (subNames[subIt].substr(0, 4) != "Face") {
|
||||
if (subName.substr(0, 4) != "Face") {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked"));
|
||||
return;
|
||||
}
|
||||
if (subNames[subIt].substr(0, 4) == "Face") {
|
||||
if (subName.substr(0, 4) == "Face") {
|
||||
if (ui->rb_cylin->isChecked()) {
|
||||
Part::Feature* feat = static_cast<Part::Feature*>(obj);
|
||||
TopoDS_Shape ref = feat->Shape.getShape().getSubShape(subNames[subIt].c_str());
|
||||
TopoDS_Shape ref = feat->Shape.getShape().getSubShape(subName.c_str());
|
||||
BRepAdaptor_Surface surface(TopoDS::Face(ref));
|
||||
if (surface.GetType() != GeomAbs_Cylinder) {
|
||||
QMessageBox::warning(this,
|
||||
@@ -325,11 +323,11 @@ void TaskFemConstraintTransform::addToSelection()
|
||||
}
|
||||
}
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
@@ -346,10 +344,10 @@ void TaskFemConstraintTransform::addToSelection()
|
||||
&TaskFemConstraintTransform::setSelection);
|
||||
for (std::size_t i = 0; i < ObjDispl.size(); i++) {
|
||||
if ((makeRefText(ObjDispl[i], SubElemDispl[i]))
|
||||
== (makeRefText(obj, subNames[subIt]))) {
|
||||
== (makeRefText(obj, subName))) {
|
||||
Objects.push_back(obj);
|
||||
SubElements.push_back(subNames[subIt]);
|
||||
ui->lw_Rect->addItem(makeRefText(obj, subNames[subIt]));
|
||||
SubElements.push_back(subName);
|
||||
ui->lw_Rect->addItem(makeRefText(obj, subName));
|
||||
connect(ui->lw_Rect,
|
||||
&QListWidget::currentItemChanged,
|
||||
this,
|
||||
@@ -418,23 +416,21 @@ void TaskFemConstraintTransform::removeFromSelection()
|
||||
std::vector<App::DocumentObject*> Objects = pcConstraint->References.getValues();
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
std::vector<size_t> itemsToDel;
|
||||
for (std::vector<Gui::SelectionObject>::iterator it = selection.begin(); it != selection.end();
|
||||
++it) {// for every selected object
|
||||
if (!it->isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
for (const auto & it : selection) {// for every selected object
|
||||
if (!it.isObjectTypeOf(Part::Feature::getClassTypeId())) {
|
||||
QMessageBox::warning(this, tr("Selection error"), tr("Selected object is not a part!"));
|
||||
return;
|
||||
}
|
||||
const std::vector<std::string>& subNames = it->getSubNames();
|
||||
App::DocumentObject* obj = it->getObject();
|
||||
const std::vector<std::string>& subNames = it.getSubNames();
|
||||
const App::DocumentObject* obj = it.getObject();
|
||||
|
||||
for (size_t subIt = 0; subIt < (subNames.size());
|
||||
++subIt) {// for every selected sub element
|
||||
for (const auto& subName : subNames) {// for every selected sub element
|
||||
for (std::vector<std::string>::iterator itr =
|
||||
std::find(SubElements.begin(), SubElements.end(), subNames[subIt]);
|
||||
std::find(SubElements.begin(), SubElements.end(), subName);
|
||||
itr != SubElements.end();
|
||||
itr = std::find(++itr,
|
||||
SubElements.end(),
|
||||
subNames[subIt])) {// for every sub element in selection that
|
||||
subName)) {// for every sub element in selection that
|
||||
// matches one in old list
|
||||
if (obj
|
||||
== Objects[std::distance(
|
||||
|
||||
@@ -268,8 +268,8 @@ void TaskPostBox::updateEnumerationList(App::PropertyEnumeration& prop, QComboBo
|
||||
{
|
||||
QStringList list;
|
||||
std::vector<std::string> vec = prop.getEnumVector();
|
||||
for (std::vector<std::string>::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
list.push_back(QString::fromStdString(*it));
|
||||
for (auto it : vec) {
|
||||
list.push_back(QString::fromStdString(it));
|
||||
}
|
||||
|
||||
int index = prop.getValue();
|
||||
@@ -299,8 +299,8 @@ QDialogButtonBox::StandardButtons TaskDlgPost::getStandardButtons() const
|
||||
|
||||
//check if we only have gui task boxes
|
||||
bool guionly = true;
|
||||
for (std::vector<TaskPostBox*>::const_iterator it = m_boxes.begin(); it != m_boxes.end(); ++it)
|
||||
guionly = guionly && (*it)->isGuiTaskOnly();
|
||||
for (auto it : m_boxes)
|
||||
guionly = guionly && it->isGuiTaskOnly();
|
||||
|
||||
if (!guionly)
|
||||
return QDialogButtonBox::Apply | QDialogButtonBox::Ok | QDialogButtonBox::Cancel;
|
||||
|
||||
@@ -511,12 +511,11 @@ void ViewProviderFemConstraint::updateRotation(const SoNode *node, const int idx
|
||||
|
||||
QObject *ViewProviderFemConstraint::findChildByName(const QObject *parent, const QString &name)
|
||||
{
|
||||
for (QObjectList::const_iterator o = parent->children().begin(); o != parent->children().end();
|
||||
o++) {
|
||||
if ((*o)->objectName() == name)
|
||||
return *o;
|
||||
if (!(*o)->children().empty()) {
|
||||
QObject *result = findChildByName(*o, name);
|
||||
for (auto o : parent->children()) {
|
||||
if (o->objectName() == name)
|
||||
return o;
|
||||
if (!o->children().empty()) {
|
||||
QObject *result = findChildByName(o, name);
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -114,9 +114,9 @@ void ViewProviderFemConstraintContact::updateData(const App::Property* prop)
|
||||
// Points and Normals are always updated together
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end(); p++) {
|
||||
for (const auto & point : points) {
|
||||
//Define base and normal directions
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);//normal
|
||||
|
||||
///Visual indication
|
||||
|
||||
@@ -190,9 +190,8 @@ void ViewProviderFemConstraintDisplacement::updateData(const App::Property* prop
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
#endif
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dirx(1, 0, 0); //OvG: Make relevant to global axes
|
||||
SbVec3f diry(0, 1, 0); //OvG: Make relevant to global axes
|
||||
SbVec3f dirz(0, 0, 1); //OvG: Make relevant to global axes
|
||||
|
||||
@@ -141,9 +141,8 @@ void ViewProviderFemConstraintFixed::updateData(const App::Property* prop)
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
#endif
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);
|
||||
SbRotation rot(SbVec3f(0, -1, 0), dir);
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
|
||||
@@ -170,9 +170,8 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro
|
||||
SbVec3f dir(forceDirection.x, forceDirection.y, forceDirection.z);
|
||||
SbRotation rot(SbVec3f(0, 1, 0), dir);
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
if (forceDirection.GetAngle(normal) < M_PI_2) // Move arrow so it doesn't disappear inside the solid
|
||||
base = base + dir * scaledlength; //OvG: Scaling
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
@@ -214,9 +213,8 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro
|
||||
#endif
|
||||
int idx = 0;
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
if (forceDirection.GetAngle(normal) < M_PI_2)
|
||||
base = base + dir * scaledlength; //OvG: Scaling
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
@@ -265,8 +263,8 @@ void ViewProviderFemConstraintFluidBoundary::updateData(const App::Property* pro
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
#endif
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end(); p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);
|
||||
SbRotation rot(SbVec3f(0, -1, 0), dir);
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
|
||||
@@ -149,9 +149,8 @@ void ViewProviderFemConstraintForce::updateData(const App::Property* prop)
|
||||
SbVec3f dir(forceDirection.x, forceDirection.y, forceDirection.z);
|
||||
SbRotation rot(SbVec3f(0,1,0), dir);
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
if (forceDirection.GetAngle(normal)
|
||||
< M_PI_2)// Move arrow so it doesn't disappear inside the solid
|
||||
base = base + dir * scaledlength; //OvG: Scaling
|
||||
@@ -191,9 +190,8 @@ void ViewProviderFemConstraintForce::updateData(const App::Property* prop)
|
||||
#endif
|
||||
int idx = 0;
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
if (forceDirection.GetAngle(normal) < M_PI_2)
|
||||
base = base + dir * scaledlength; //OvG: Scaling
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
|
||||
@@ -115,9 +115,9 @@ void ViewProviderFemConstraintHeatflux::updateData(const App::Property* prop)
|
||||
// Note: Points and Normals are always updated together
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end(); p++) {
|
||||
for (const auto & point : points) {
|
||||
//Define base and normal directions
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);//normal
|
||||
|
||||
///Temperature indication
|
||||
|
||||
@@ -115,10 +115,9 @@ void ViewProviderFemConstraintPlaneRotation::updateData(const App::Property* pro
|
||||
// Points and Normals are always updated together
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
for (const auto & point : points) {
|
||||
//Define base and normal directions
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);//normal
|
||||
|
||||
/* Note:
|
||||
|
||||
@@ -128,8 +128,8 @@ void ViewProviderFemConstraintPressure::updateData(const App::Property* prop)
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
#endif
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end(); p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);
|
||||
double rev;
|
||||
if (pcConstraint->Reversed.getValue()) {
|
||||
|
||||
@@ -128,8 +128,8 @@ void ViewProviderFemConstraintSpring::updateData(const App::Property* prop)
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
#endif
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end(); p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);
|
||||
SbRotation rot(SbVec3f(0, -1.0, 0), dir);
|
||||
#ifdef USE_MULTIPLE_COPY
|
||||
|
||||
@@ -114,10 +114,9 @@ void ViewProviderFemConstraintTemperature::updateData(const App::Property* prop)
|
||||
// Note: Points and Normals are always updated together
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
for (const auto & point : points) {
|
||||
//Define base and normal directions
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);//normal
|
||||
|
||||
///Temperature indication
|
||||
|
||||
@@ -120,11 +120,10 @@ void ViewProviderFemConstraintTransform::updateData(const App::Property* prop)
|
||||
// Points and Normals are always updated together
|
||||
Gui::coinRemoveAllChildren(pShapeSep);
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
SbVec3f basex(p->x, p->y, p->z);
|
||||
SbVec3f basey(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f basex(point.x, point.y, point.z);
|
||||
SbVec3f basey(point.x, point.y, point.z);
|
||||
|
||||
double x_axis_x = 1;
|
||||
double x_axis_y = 0;
|
||||
@@ -280,9 +279,8 @@ void ViewProviderFemConstraintTransform::updateData(const App::Property* prop)
|
||||
pShapeSep->addChild(sepAx);
|
||||
}
|
||||
|
||||
for (std::vector<Base::Vector3d>::const_iterator p = points.begin(); p != points.end();
|
||||
p++) {
|
||||
SbVec3f base(p->x, p->y, p->z);
|
||||
for (const auto & point : points) {
|
||||
SbVec3f base(point.x, point.y, point.z);
|
||||
SbVec3f dir(n->x, n->y, n->z);
|
||||
base = base + dir * scaledlengthA; //OvG: Scaling
|
||||
SbRotation rot(SbVec3f(0, 1, 0), dir);
|
||||
|
||||
@@ -513,8 +513,8 @@ void ViewProviderFemMesh::setColorByNodeId(const std::map<long,App::Color> &Node
|
||||
long endId = (--NodeColorMap.end())->first;
|
||||
|
||||
std::vector<App::Color> colorVec(endId+1,App::Color(0,1,0));
|
||||
for(std::map<long,App::Color>::const_iterator it=NodeColorMap.begin();it!=NodeColorMap.end();++it)
|
||||
colorVec[it->first] = it->second;
|
||||
for(const auto & it : NodeColorMap)
|
||||
colorVec[it.first] = it.second;
|
||||
|
||||
setColorByNodeIdHelper(colorVec);
|
||||
|
||||
@@ -566,8 +566,8 @@ void ViewProviderFemMesh::setDisplacementByNodeId(const std::map<long,Base::Vect
|
||||
|
||||
std::vector<Base::Vector3d> vecVec(endId-startId+2,Base::Vector3d());
|
||||
|
||||
for(std::map<long,Base::Vector3d>::const_iterator it=NodeDispMap.begin();it!=NodeDispMap.end();++it)
|
||||
vecVec[it->first-startId] = it->second;
|
||||
for(const auto & it : NodeDispMap)
|
||||
vecVec[it.first-startId] = it.second;
|
||||
|
||||
setDisplacementByNodeIdHelper(vecVec,startId);
|
||||
}
|
||||
@@ -983,18 +983,18 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop,
|
||||
}
|
||||
|
||||
unsigned int max =0, avg = 0;
|
||||
for(std::vector<FemFaceGridItem>::iterator it=Grid.begin();it!=Grid.end();++it){
|
||||
for(unsigned int l=0; l< it->size();l++){
|
||||
if(! it->operator[](l)->hide){
|
||||
for(unsigned int i=l+1; i<it->size(); i++){
|
||||
if(it->operator[](l)->isSameFace(*(it->operator[](i))) ){
|
||||
for(const auto& it : Grid){
|
||||
for(size_t l=0; l< it.size();l++){
|
||||
if(! it[l]->hide){
|
||||
for(size_t i=l+1; i<it.size(); i++){
|
||||
if(it[l]->isSameFace(*(it[i])) ){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(it->size() > max)max=it->size();
|
||||
avg += it->size();
|
||||
if(it.size() > max)max=it.size();
|
||||
avg += it.size();
|
||||
}
|
||||
avg = avg/Grid.size();
|
||||
|
||||
@@ -1024,9 +1024,9 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop,
|
||||
|
||||
for (int l = 0; l < FaceSize; l++) {
|
||||
if (!facesHelper[l].hide) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (facesHelper[l].Nodes[i])
|
||||
mapNodeIndex[facesHelper[l].Nodes[i]] = 0;
|
||||
for (auto Node : facesHelper[l].Nodes) {
|
||||
if (Node)
|
||||
mapNodeIndex[Node] = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -287,16 +287,16 @@ Py::List ViewProviderFemMeshPy::getVisibleElementFaces() const
|
||||
|
||||
// sorting out double faces through higher order elements and null entries
|
||||
long elementOld = 0, faceOld = 0;
|
||||
for (std::vector<unsigned long>::const_iterator it = visElmFc.begin(); it != visElmFc.end(); ++it) {
|
||||
if (*it == 0)
|
||||
for (unsigned long it : visElmFc) {
|
||||
if (it == 0)
|
||||
continue;
|
||||
|
||||
long element = *it >> 3;
|
||||
long face = (*it & 7) + 1;
|
||||
long element = it >> 3;
|
||||
long face = (it & 7) + 1;
|
||||
if (element == elementOld && face == faceOld)
|
||||
continue;
|
||||
|
||||
trans.push_back(*it);
|
||||
trans.push_back(it);
|
||||
elementOld = element;
|
||||
faceOld = face;
|
||||
}
|
||||
|
||||
@@ -123,13 +123,12 @@ void ViewProviderFemPostFunctionProvider::updateData(const App::Property* prop)
|
||||
void ViewProviderFemPostFunctionProvider::updateSize()
|
||||
{
|
||||
std::vector<App::DocumentObject*> vec = claimChildren();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = vec.begin(); it != vec.end(); ++it) {
|
||||
|
||||
if (!(*it)->isDerivedFrom(Fem::FemPostFunction::getClassTypeId()))
|
||||
for (auto it : vec) {
|
||||
if (!it->isDerivedFrom(Fem::FemPostFunction::getClassTypeId()))
|
||||
continue;
|
||||
|
||||
ViewProviderFemPostFunction* vp = static_cast<FemGui::ViewProviderFemPostFunction*>(
|
||||
Gui::Application::Instance->getViewProvider(*it));
|
||||
Gui::Application::Instance->getViewProvider(it));
|
||||
vp->AutoScaleFactorX.setValue(SizeX.getValue());
|
||||
vp->AutoScaleFactorY.setValue(SizeY.getValue());
|
||||
vp->AutoScaleFactorZ.setValue(SizeZ.getValue());
|
||||
|
||||
@@ -873,11 +873,11 @@ void ViewProviderFemPostObject::hide()
|
||||
std::vector<App::DocumentObject *> ObjectsList = doc->getObjects();
|
||||
App::DocumentObject *firstVisiblePostObject = nullptr;
|
||||
// step through the objects
|
||||
for (auto it = ObjectsList.begin(); it != ObjectsList.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
|
||||
if (!firstVisiblePostObject && (*it)->Visibility.getValue()
|
||||
&& !(*it)->isDerivedFrom(Fem::FemPostDataAtPointFilter::getClassTypeId())) {
|
||||
firstVisiblePostObject = *it;
|
||||
for (auto it : ObjectsList) {
|
||||
if (it->getTypeId().isDerivedFrom(Fem::FemPostObject::getClassTypeId())) {
|
||||
if (!firstVisiblePostObject && it->Visibility.getValue()
|
||||
&& !it->isDerivedFrom(Fem::FemPostDataAtPointFilter::getClassTypeId())) {
|
||||
firstVisiblePostObject = it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user