From fe47ef78ab1aa94c8160977505f0b9e78f8acae9 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 15 Aug 2016 18:19:38 +0100 Subject: [PATCH] FEM: code formating, replace tabulator with spaces --- src/Mod/Fem/App/FemConstraintContact.cpp | 2 +- src/Mod/Fem/App/FemConstraintHeatflux.cpp | 2 +- .../App/FemConstraintInitialTemperature.cpp | 2 +- .../Fem/App/FemConstraintPlaneRotation.cpp | 2 +- src/Mod/Fem/App/FemConstraintTemperature.cpp | 2 +- src/Mod/Fem/App/FemMesh.cpp | 4 +- src/Mod/Fem/Gui/TaskFemConstraintContact.cpp | 52 ++++----- src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp | 2 +- .../Gui/TaskFemConstraintPlaneRotation.cpp | 109 +++++++++--------- src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp | 10 +- .../ViewProviderFemConstraintDisplacement.cpp | 2 +- src/Mod/Fem/Gui/ViewProviderFemMesh.cpp | 8 +- src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp | 6 +- 13 files changed, 101 insertions(+), 102 deletions(-) diff --git a/src/Mod/Fem/App/FemConstraintContact.cpp b/src/Mod/Fem/App/FemConstraintContact.cpp index d3f36ce3d06e..11c8361cdfa5 100644 --- a/src/Mod/Fem/App/FemConstraintContact.cpp +++ b/src/Mod/Fem/App/FemConstraintContact.cpp @@ -61,7 +61,7 @@ App::DocumentObjectExecReturn *ConstraintContact::execute(void) const char* ConstraintContact::getViewProviderName(void) const { - return "FemGui::ViewProviderFemConstraintContact"; + return "FemGui::ViewProviderFemConstraintContact"; } void ConstraintContact::onChanged(const App::Property* prop) diff --git a/src/Mod/Fem/App/FemConstraintHeatflux.cpp b/src/Mod/Fem/App/FemConstraintHeatflux.cpp index 97f566c72f56..02b4632d4c56 100644 --- a/src/Mod/Fem/App/FemConstraintHeatflux.cpp +++ b/src/Mod/Fem/App/FemConstraintHeatflux.cpp @@ -62,7 +62,7 @@ App::DocumentObjectExecReturn *ConstraintHeatflux::execute(void) const char* ConstraintHeatflux::getViewProviderName(void) const { - return "FemGui::ViewProviderFemConstraintHeatflux"; + return "FemGui::ViewProviderFemConstraintHeatflux"; } void ConstraintHeatflux::onChanged(const App::Property* prop) diff --git a/src/Mod/Fem/App/FemConstraintInitialTemperature.cpp b/src/Mod/Fem/App/FemConstraintInitialTemperature.cpp index 962605183d9a..0c5f1968bbee 100644 --- a/src/Mod/Fem/App/FemConstraintInitialTemperature.cpp +++ b/src/Mod/Fem/App/FemConstraintInitialTemperature.cpp @@ -61,7 +61,7 @@ App::DocumentObjectExecReturn *ConstraintInitialTemperature::execute(void) const char* ConstraintInitialTemperature::getViewProviderName(void) const { - return "FemGui::ViewProviderFemConstraintInitialTemperature"; + return "FemGui::ViewProviderFemConstraintInitialTemperature"; } void ConstraintInitialTemperature::onChanged(const App::Property* prop) diff --git a/src/Mod/Fem/App/FemConstraintPlaneRotation.cpp b/src/Mod/Fem/App/FemConstraintPlaneRotation.cpp index 4df30e1c7045..9f990993f8b1 100644 --- a/src/Mod/Fem/App/FemConstraintPlaneRotation.cpp +++ b/src/Mod/Fem/App/FemConstraintPlaneRotation.cpp @@ -57,7 +57,7 @@ App::DocumentObjectExecReturn *ConstraintPlaneRotation::execute(void) const char* ConstraintPlaneRotation::getViewProviderName(void) const { - return "FemGui::ViewProviderFemConstraintPlaneRotation"; + return "FemGui::ViewProviderFemConstraintPlaneRotation"; } void ConstraintPlaneRotation::onChanged(const App::Property* prop) diff --git a/src/Mod/Fem/App/FemConstraintTemperature.cpp b/src/Mod/Fem/App/FemConstraintTemperature.cpp index 7d5d5e75ad71..1d010ed3b38d 100644 --- a/src/Mod/Fem/App/FemConstraintTemperature.cpp +++ b/src/Mod/Fem/App/FemConstraintTemperature.cpp @@ -61,7 +61,7 @@ App::DocumentObjectExecReturn *ConstraintTemperature::execute(void) const char* ConstraintTemperature::getViewProviderName(void) const { - return "FemGui::ViewProviderFemConstraintTemperature"; + return "FemGui::ViewProviderFemConstraintTemperature"; } void ConstraintTemperature::onChanged(const App::Property* prop) diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index 7690d8730f31..586d3f3b79a8 100644 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -110,7 +110,7 @@ FemMesh::~FemMesh() FemMesh &FemMesh::operator=(const FemMesh& mesh) { if (this != &mesh) { - myMesh = getGenerator()->CreateMesh(0,true); + myMesh = getGenerator()->CreateMesh(0,true); copyMeshData(mesh); } return *this; @@ -892,7 +892,7 @@ void FemMesh::read(const char *FileName) } else if (File.hasExtension("dat") ) { // read brep-file - // vejmarie disable + // vejmarie disable myMesh->DATToMesh(File.filePath().c_str()); } else if (File.hasExtension("bdf") ) { diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp index 6b8cc5612da7..9b92c444258a 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp @@ -105,13 +105,13 @@ TaskFemConstraintContact::TaskFemConstraintContact(ViewProviderFemConstraintCont ui->lw_referencesMaster->clear(); ui->lw_referencesSlave->clear(); if (Objects.size() > 0){ - for (std::size_t i = 1; i < Objects.size(); i++) { + for (std::size_t i = 1; i < Objects.size(); i++) { ui->lw_referencesMaster->addItem(makeRefText(Objects[i], SubElements[i])); - } + } - for (std::size_t i = 0; i < (Objects.size()-1); i++) { + for (std::size_t i = 0; i < (Objects.size()-1); i++) { ui->lw_referencesSlave->addItem(makeRefText(Objects[i], SubElements[i])); - } + } } //Selection buttons @@ -149,7 +149,7 @@ void TaskFemConstraintContact::addToSelectionSlave() std::vector selection = Gui::Selection().getSelectionEx();//gets vector of selected objects of active document if (rows==1){ QMessageBox::warning(this, tr("Selection error"), tr("Only one master face and one slave face for a contact constraint!")); - Gui::Selection().clearSelection(); + Gui::Selection().clearSelection(); return; } @@ -160,7 +160,7 @@ void TaskFemConstraintContact::addToSelectionSlave() if ((rows==0) && (selection.size()>=2)){ QMessageBox::warning(this, tr("Selection error"), tr("Only one slave face for a contact constraint!")); - Gui::Selection().clearSelection(); + Gui::Selection().clearSelection(); return; } @@ -176,17 +176,17 @@ void TaskFemConstraintContact::addToSelectionSlave() std::vector subNames=it->getSubNames(); App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName()); - if (subNames.size()!=1){ - QMessageBox::warning(this, tr("Selection error"), tr("Only one slave face for a contact constraint!")); - Gui::Selection().clearSelection(); - return; - } + if (subNames.size()!=1){ + QMessageBox::warning(this, tr("Selection error"), tr("Only one slave face for a contact constraint!")); + Gui::Selection().clearSelection(); + return; + } for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element bool addMe=true; - if (subNames[subIt].substr(0,4) != "Face") { - QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked")); - return; - } + if (subNames[subIt].substr(0,4) != "Face") { + QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked")); + return; + } for (std::vector::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]); itr!= SubElements.end(); itr = std::find(++itr,SubElements.end(),subNames[subIt])) @@ -268,7 +268,7 @@ void TaskFemConstraintContact::addToSelectionMaster() std::vector selection = Gui::Selection().getSelectionEx();//gets vector of selected objects of active document if (rows==1){ QMessageBox::warning(this, tr("Selection error"), tr("Only one master face and one slave face for a contact constraint!")); - Gui::Selection().clearSelection(); + Gui::Selection().clearSelection(); return; } @@ -279,7 +279,7 @@ void TaskFemConstraintContact::addToSelectionMaster() if ((rows==0) && (selection.size()>=2)){ QMessageBox::warning(this, tr("Selection error"), tr("Only one master for a contact constraint!")); - Gui::Selection().clearSelection(); + Gui::Selection().clearSelection(); return; } @@ -295,17 +295,17 @@ void TaskFemConstraintContact::addToSelectionMaster() std::vector subNames=it->getSubNames(); App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName()); - if (subNames.size()!=1){ - QMessageBox::warning(this, tr("Selection error"), tr("Only one master face for a contact constraint!")); - Gui::Selection().clearSelection(); - return; - } + if (subNames.size()!=1){ + QMessageBox::warning(this, tr("Selection error"), tr("Only one master face for a contact constraint!")); + Gui::Selection().clearSelection(); + return; + } for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element bool addMe=true; - if (subNames[subIt].substr(0,4) != "Face") { - QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked")); - return; - } + if (subNames[subIt].substr(0,4) != "Face") { + QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked")); + return; + } for (std::vector::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]); itr!= SubElements.end(); itr = std::find(++itr,SubElements.end(),subNames[subIt])) diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp index ee00ce74f39c..402341b7cce0 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp @@ -113,7 +113,7 @@ void TaskFemConstraintFixed::updateUI() void TaskFemConstraintFixed::addToSelection() { - std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document + std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document if (selection.size()==0){ QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); return; diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp index e6bdf531a5de..e8bfb943bd8a 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp @@ -126,22 +126,22 @@ void TaskFemConstraintPlaneRotation::addToSelection() int rows = ui->lw_references->model()->rowCount(); if (rows==1){ QMessageBox::warning(this, tr("Selection error"), tr("Only one face can be selected for a plane rotation constraint!")); - Gui::Selection().clearSelection(); + Gui::Selection().clearSelection(); return; } else { - std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document - if (selection.size()==0){ - QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); - return; - } - Fem::ConstraintPlaneRotation* pcConstraint = static_cast(ConstraintView->getObject()); - std::vector Objects = pcConstraint->References.getValues(); - std::vector SubElements = pcConstraint->References.getSubValues(); - - for (std::vector::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object - if (static_cast(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){ + std::vector selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document + if (selection.size()==0){ + QMessageBox::warning(this, tr("Selection error"), tr("Nothing selected!")); + return; + } + Fem::ConstraintPlaneRotation* pcConstraint = static_cast(ConstraintView->getObject()); + std::vector Objects = pcConstraint->References.getValues(); + std::vector SubElements = pcConstraint->References.getSubValues(); + + for (std::vector::iterator it = selection.begin(); it != selection.end(); ++it){//for every selected object + if (static_cast(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){ QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!")); return; } @@ -149,49 +149,48 @@ void TaskFemConstraintPlaneRotation::addToSelection() std::vector subNames=it->getSubNames(); App::DocumentObject* obj = ConstraintView->getObject()->getDocument()->getObject(it->getFeatName()); - if (subNames.size()==1){ - for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element - bool addMe=true; - if ((subNames[subIt].substr(0,4) != "Face")) { - QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked")); - return; - } - Part::Feature* feat = static_cast(obj); - TopoDS_Shape ref = feat->Shape.getShape().getSubShape(subNames[subIt].c_str()); - if ((subNames[subIt].substr(0,4) == "Face")) { - if (!Fem::Tools::isPlanar(TopoDS::Face(ref))) { - QMessageBox::warning(this, tr("Selection error"), tr("Only planar faces can be picked")); - return; - } - } - for (std::vector::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]); - itr!= SubElements.end(); - itr = std::find(++itr,SubElements.end(),subNames[subIt])) - {// for every sub element in selection that matches one in old list - if (obj==Objects[std::distance(SubElements.begin(),itr)]){//if selected sub element's object equals the one in old list then it was added before so don't add - addMe=false; - } - } - if (addMe){ - disconnect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - Objects.push_back(obj); - SubElements.push_back(subNames[subIt]); - ui->lw_references->addItem(makeRefText(obj, subNames[subIt])); - connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - } - } - } - else { - QMessageBox::warning(this, tr("Selection error"), tr("Only one face can be selected for a plane rotation constraint!")); - Gui::Selection().clearSelection(); - return; - } - //Update UI - pcConstraint->References.setValues(Objects,SubElements); - updateUI(); - } + if (subNames.size()==1){ + for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element + bool addMe=true; + if ((subNames[subIt].substr(0,4) != "Face")) { + QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked")); + return; + } + Part::Feature* feat = static_cast(obj); + TopoDS_Shape ref = feat->Shape.getShape().getSubShape(subNames[subIt].c_str()); + if ((subNames[subIt].substr(0,4) == "Face")) { + if (!Fem::Tools::isPlanar(TopoDS::Face(ref))) { + QMessageBox::warning(this, tr("Selection error"), tr("Only planar faces can be picked")); + return; + } + } + for (std::vector::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]); + itr!= SubElements.end(); + itr = std::find(++itr,SubElements.end(),subNames[subIt])){// for every sub element in selection that matches one in old list + if (obj==Objects[std::distance(SubElements.begin(),itr)]){//if selected sub element's object equals the one in old list then it was added before so don't add + addMe=false; + } + } + if (addMe){ + disconnect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), + this, SLOT(setSelection(QListWidgetItem*))); + Objects.push_back(obj); + SubElements.push_back(subNames[subIt]); + ui->lw_references->addItem(makeRefText(obj, subNames[subIt])); + connect(ui->lw_references, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), + this, SLOT(setSelection(QListWidgetItem*))); + } + } + } + else { + QMessageBox::warning(this, tr("Selection error"), tr("Only one face can be selected for a plane rotation constraint!")); + Gui::Selection().clearSelection(); + return; + } + //Update UI + pcConstraint->References.setValues(Objects,SubElements); + updateUI(); + } } } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp index 5b469aec32c7..1a63416ef6bd 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp @@ -143,10 +143,10 @@ void TaskFemConstraintPressure::addToSelection() for (unsigned int subIt=0;subIt<(subNames.size());++subIt){// for every selected sub element bool addMe=true; - if (subNames[subIt].substr(0,4) != "Face") { - QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked")); - return; - } + if (subNames[subIt].substr(0,4) != "Face") { + QMessageBox::warning(this, tr("Selection error"), tr("Only faces can be picked")); + return; + } for (std::vector::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]); itr!= SubElements.end(); itr = std::find(++itr,SubElements.end(),subNames[subIt])) @@ -267,7 +267,7 @@ double TaskFemConstraintPressure::get_Pressure() const bool TaskFemConstraintPressure::get_Reverse() const { - return ui->checkBoxReverse->isChecked(); + return ui->checkBoxReverse->isChecked(); } /* */ diff --git a/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp index 1fa9bd2875ae..fbd32dc32e93 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp @@ -109,7 +109,7 @@ void ViewProviderFemConstraintDisplacement::updateData(const App::Property* prop bool rotzFree = pcConstraint->rotzFree.getValue(); #ifdef USE_MULTIPLE_COPY - //OvG: always need access to cp for scaling + //OvG: always need access to cp for scaling SoMultipleCopy* cpx = new SoMultipleCopy(); SoMultipleCopy* cpy = new SoMultipleCopy(); SoMultipleCopy* cpz = new SoMultipleCopy(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp index c469261e860c..2c5959e8852a 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp @@ -723,15 +723,15 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SMESHDS_Mesh* data = const_cast(mesh->getValue().getSMesh())->GetMeshDS(); - int numFaces = data->NbFaces(); - int numNodes = data->NbNodes(); - int numEdges = data->NbEdges(); + int numFaces = data->NbFaces(); + int numNodes = data->NbNodes(); + int numEdges = data->NbEdges(); if(numFaces+numNodes+numEdges == 0) return; Base::TimeInfo Start; Base::Console().Log("Start: ViewProviderFEMMeshBuilder::createMesh() =================================\n"); - const SMDS_MeshInfo& info = data->GetMeshInfo(); + const SMDS_MeshInfo& info = data->GetMeshInfo(); int numTria = info.NbTriangles(); int numQuad = info.NbQuadrangles(); diff --git a/src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp b/src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp index ace8032545c5..d7a01eebb048 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp @@ -164,7 +164,7 @@ void ViewProviderFemMeshPy::setNodeColor(Py::Dict arg) //this->getViewProviderFemMeshPtr()->setColorByNodeId(NodeColorMap); this->getViewProviderFemMeshPtr()->setColorByNodeId(NodeIds,NodeColors); Base::Console().Log(" %f: Finish ViewProviderFemMeshPy::setNodeColor() call \n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo())); - } + } } Py::Dict ViewProviderFemMeshPy::getElementColor(void) const @@ -186,7 +186,7 @@ void ViewProviderFemMeshPy::setElementColor(Py::Dict arg) NodeColorMap[id] = App::Color(Py::Float(color[0]),Py::Float(color[1]),Py::Float(color[2]),0); } this->getViewProviderFemMeshPtr()->setColorByElementId(NodeColorMap); - } + } } Py::Dict ViewProviderFemMeshPy::getNodeDisplacement(void) const @@ -212,7 +212,7 @@ void ViewProviderFemMeshPy::setNodeDisplacement(Py::Dict arg) } } this->getViewProviderFemMeshPtr()->setDisplacementByNodeId(NodeDispMap); - } + } } Py::List ViewProviderFemMeshPy::getHighlightedNodes(void) const