Skip to content

Commit

Permalink
FEM: code formating, replace tabulator with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach authored and wwmayer committed Aug 15, 2016
1 parent 55873e7 commit fe47ef7
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 102 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Fem/App/FemConstraintContact.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/App/FemConstraintHeatflux.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/App/FemConstraintInitialTemperature.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/App/FemConstraintPlaneRotation.cpp
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/App/FemConstraintTemperature.cpp
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Fem/App/FemMesh.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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") ) {
Expand Down
52 changes: 26 additions & 26 deletions src/Mod/Fem/Gui/TaskFemConstraintContact.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -149,7 +149,7 @@ void TaskFemConstraintContact::addToSelectionSlave()
std::vector<Gui::SelectionObject> 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;
}

Expand All @@ -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;
}

Expand All @@ -176,17 +176,17 @@ void TaskFemConstraintContact::addToSelectionSlave()

std::vector<std::string> 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<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
itr!= SubElements.end();
itr = std::find(++itr,SubElements.end(),subNames[subIt]))
Expand Down Expand Up @@ -268,7 +268,7 @@ void TaskFemConstraintContact::addToSelectionMaster()
std::vector<Gui::SelectionObject> 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;
}

Expand All @@ -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;
}

Expand All @@ -295,17 +295,17 @@ void TaskFemConstraintContact::addToSelectionMaster()

std::vector<std::string> 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<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
itr!= SubElements.end();
itr = std::find(++itr,SubElements.end(),subNames[subIt]))
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp
Expand Up @@ -113,7 +113,7 @@ void TaskFemConstraintFixed::updateUI()

void TaskFemConstraintFixed::addToSelection()
{
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx(); //gets vector of selected objects of active document
std::vector<Gui::SelectionObject> 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;
Expand Down
109 changes: 54 additions & 55 deletions src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp
Expand Up @@ -126,72 +126,71 @@ 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<Gui::SelectionObject> 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<Fem::ConstraintPlaneRotation*>(ConstraintView->getObject());
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 (static_cast<std::string>(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){
std::vector<Gui::SelectionObject> 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<Fem::ConstraintPlaneRotation*>(ConstraintView->getObject());
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 (static_cast<std::string>(it->getTypeName()).substr(0,4).compare(std::string("Part"))!=0){
QMessageBox::warning(this, tr("Selection error"),tr("Selected object is not a part!"));
return;
}

std::vector<std::string> 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<Part::Feature*>(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<std::string>::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<Part::Feature*>(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<std::string>::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();
}
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp
Expand Up @@ -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<std::string>::iterator itr=std::find(SubElements.begin(),SubElements.end(),subNames[subIt]);
itr!= SubElements.end();
itr = std::find(++itr,SubElements.end(),subNames[subIt]))
Expand Down Expand Up @@ -267,7 +267,7 @@ double TaskFemConstraintPressure::get_Pressure() const

bool TaskFemConstraintPressure::get_Reverse() const
{
return ui->checkBoxReverse->isChecked();
return ui->checkBoxReverse->isChecked();
}
/* */

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/Gui/ViewProviderFemConstraintDisplacement.cpp
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/Mod/Fem/Gui/ViewProviderFemMesh.cpp
Expand Up @@ -723,15 +723,15 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop,

SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(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();

Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Fem/Gui/ViewProviderFemMeshPyImp.cpp
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -212,7 +212,7 @@ void ViewProviderFemMeshPy::setNodeDisplacement(Py::Dict arg)
}
}
this->getViewProviderFemMeshPtr()->setDisplacementByNodeId(NodeDispMap);
}
}
}

Py::List ViewProviderFemMeshPy::getHighlightedNodes(void) const
Expand Down

0 comments on commit fe47ef7

Please sign in to comment.