From 3ddc4d96c06f14b8bcde4073817fcc02ca317c4e Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 1 Sep 2023 17:43:40 +0200 Subject: [PATCH] Clean code --- .../bbcreaVtkMeshReduction_DecimatePro.cxx | 2 + bbtk_creaVtk_PKG/src/bbcreaVtkVoiMPR.cxx | 466 +++++++++--------- 2 files changed, 237 insertions(+), 231 deletions(-) diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshReduction_DecimatePro.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshReduction_DecimatePro.cxx index 607ed21..fa077d8 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshReduction_DecimatePro.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshReduction_DecimatePro.cxx @@ -36,7 +36,9 @@ void MeshReduction_DecimatePro::Process() decimatepro->SetInputData( bbGetInputIn() ); decimatepro->SetTargetReduction( bbGetInputTargetReduction() ); decimatepro->PreserveTopologyOn(); + printf("EED MeshReduction_DecimatePro::Process Running... \n"); decimatepro->Update(); + printf("EED MeshReduction_DecimatePro::Process ...finish \n"); bbSetOutputOut(decimatepro->GetOutput() ); } else { bbSetOutputOut( NULL ); diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkVoiMPR.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkVoiMPR.cxx index 525c2e9..17dd34d 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkVoiMPR.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkVoiMPR.cxx @@ -17,261 +17,265 @@ BBTK_BLACK_BOX_IMPLEMENTATION(VoiMPR,bbtk::AtomicBlackBox); //===== void VoiMPR::Process() { - -// THE MAIN PROCESSING METHOD BODY -// Here we simply set the input 'In' value to the output 'Out' -// And print out the output value -// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : -// void bbSet{Input|Output}NAME(const TYPE&) -// const TYPE& bbGet{Input|Output}NAME() const -// Where : -// * NAME is the name of the input/output -// (the one provided in the attribute 'name' of the tag 'input') -// * TYPE is the C++ type of the input/output -// (the one provided in the attribute 'type' of the tag 'input') -// bbSetOutputOut( bbGetInputIn() ); -// std::cout << "Output value = " < vecVOI = bbGetInputIn(); - std::vector spc = bbGetInputSpacing(); - vecVOI[0] = vecVOI[0]*spc[0]; - vecVOI[1] = vecVOI[1]*spc[0]; - vecVOI[2] = vecVOI[2]*spc[1]; - vecVOI[3] = vecVOI[3]*spc[1]; - vecVOI[4] = vecVOI[4]*spc[2]; - vecVOI[5] = vecVOI[5]*spc[2]; - int dep; - std::vector vecPoint = bbGetInputActualPoint(); - vecPoint[0] = vecPoint[0]*spc[0]; - vecPoint[1] = vecPoint[1]*spc[1]; - vecPoint[2] = vecPoint[2]*spc[2]; - - if (vecPoint.size()==3) - { - if ((vecPoint[0]>=vecVOI[0]) && (vecPoint[0]<=vecVOI[1]) ) - { - showActorYZ=bbGetInputActive() && true; - } else { - showActorYZ=bbGetInputActive() && false; - } - if ((vecPoint[1]>=vecVOI[2]) && (vecPoint[1]<=vecVOI[3]) ) - { - showActorXZ=bbGetInputActive() && true; - } else { - showActorXZ=bbGetInputActive() && false; - } - if ((vecPoint[2]>=vecVOI[4]) && (vecPoint[2]<=vecVOI[5]) ) - { - showActorXY=bbGetInputActive() && true; - } else { - showActorXY=bbGetInputActive() && false; - } - - } else { - showActorXY=bbGetInputActive(); - showActorYZ=bbGetInputActive(); - showActorXZ=bbGetInputActive(); - } - - if (bbGetInputXYrender()!=NULL) - { - dep=-900; - pointsXY->SetPoint(0, vecVOI[0], vecVOI[2], dep); - pointsXY->SetPoint(1, vecVOI[0], vecVOI[3], dep); - pointsXY->SetPoint(2, vecVOI[1], vecVOI[3], dep); - pointsXY->SetPoint(3, vecVOI[1], vecVOI[2], dep); - pointsXY-> Modified(); - if ( showActorXY==true ) - { - if (actorAddedXY==false) - { - bbGetInputXYrender()->AddActor(polygonActorXY); - actorAddedXY=true; - } // - } else { - if (actorAddedXY==true) - { - bbGetInputXYrender()->RemoveActor(polygonActorXY); - actorAddedXY=false; - } // - }// Active - } // if XYrender - if (bbGetInputYZrender()!=NULL) - { - dep=900; - pointsYZ->SetPoint(0, dep,vecVOI[2], vecVOI[4] ); - pointsYZ->SetPoint(1, dep,vecVOI[2], vecVOI[5] ); - pointsYZ->SetPoint(2, dep,vecVOI[3], vecVOI[5] ); - pointsYZ->SetPoint(3, dep,vecVOI[3], vecVOI[4] ); - pointsYZ-> Modified(); - if ( showActorYZ==true ) - { - if (actorAddedYZ==false) - { - bbGetInputYZrender()->AddActor(polygonActorYZ); - actorAddedYZ=true; - } // - } else { - if (actorAddedYZ==true) - { - bbGetInputYZrender()->RemoveActor(polygonActorYZ); - actorAddedYZ=false; - } // - }// Active - } // if XYrender - if (bbGetInputXZrender()!=NULL) - { - dep=-900; - pointsXZ->SetPoint(0, vecVOI[0],dep, vecVOI[4] ); - pointsXZ->SetPoint(1, vecVOI[0],dep, vecVOI[5] ); - pointsXZ->SetPoint(2, vecVOI[1],dep, vecVOI[5] ); - pointsXZ->SetPoint(3, vecVOI[1],dep, vecVOI[4] ); - pointsXZ-> Modified(); - if ( showActorXZ==true ) - { - if (actorAddedXZ==false) - { - bbGetInputXZrender()->AddActor(polygonActorXZ); - actorAddedXZ=true; - } // - } else { - if (actorAddedXZ==true) - { - bbGetInputXZrender()->RemoveActor(polygonActorXZ); - actorAddedXZ=false; - } // - }// Active - } // if XYrender - } // In size + + // THE MAIN PROCESSING METHOD BODY + // Here we simply set the input 'In' value to the output 'Out' + // And print out the output value + // INPUT/OUTPUT ACCESSORS ARE OF THE FORM : + // void bbSet{Input|Output}NAME(const TYPE&) + // const TYPE& bbGet{Input|Output}NAME() const + // Where : + // * NAME is the name of the input/output + // (the one provided in the attribute 'name' of the tag 'input') + // * TYPE is the C++ type of the input/output + // (the one provided in the attribute 'type' of the tag 'input') + // bbSetOutputOut( bbGetInputIn() ); + // std::cout << "Output value = " < vecVOI = bbGetInputIn(); + std::vector spc = bbGetInputSpacing(); + vecVOI[0] = vecVOI[0]*spc[0]; + vecVOI[1] = vecVOI[1]*spc[0]; + vecVOI[2] = vecVOI[2]*spc[1]; + vecVOI[3] = vecVOI[3]*spc[1]; + vecVOI[4] = vecVOI[4]*spc[2]; + vecVOI[5] = vecVOI[5]*spc[2]; + int dep; + std::vector vecPoint = bbGetInputActualPoint(); + vecPoint[0] = vecPoint[0]*spc[0]; + vecPoint[1] = vecPoint[1]*spc[1]; + vecPoint[2] = vecPoint[2]*spc[2]; + + if (vecPoint.size()==3) + { + if ((vecPoint[0]>=vecVOI[0]) && (vecPoint[0]<=vecVOI[1]) ) + { + showActorYZ=bbGetInputActive() && true; + } else { + showActorYZ=bbGetInputActive() && false; + } + if ((vecPoint[1]>=vecVOI[2]) && (vecPoint[1]<=vecVOI[3]) ) + { + showActorXZ=bbGetInputActive() && true; + } else { + showActorXZ=bbGetInputActive() && false; + } + if ((vecPoint[2]>=vecVOI[4]) && (vecPoint[2]<=vecVOI[5]) ) + { + showActorXY=bbGetInputActive() && true; + } else { + showActorXY=bbGetInputActive() && false; + } + + } else { + showActorXY=bbGetInputActive(); + showActorYZ=bbGetInputActive(); + showActorXZ=bbGetInputActive(); + } + + if (bbGetInputXYrender()!=NULL) + { + dep=-900; + pointsXY->SetPoint(0, vecVOI[0], vecVOI[2], dep); + pointsXY->SetPoint(1, vecVOI[0], vecVOI[3], dep); + pointsXY->SetPoint(2, vecVOI[1], vecVOI[3], dep); + pointsXY->SetPoint(3, vecVOI[1], vecVOI[2], dep); + pointsXY-> Modified(); + if ( showActorXY==true ) + { + if (actorAddedXY==false) + { + bbGetInputXYrender()->AddActor(polygonActorXY); + actorAddedXY=true; + } // + } else { + if (actorAddedXY==true) + { + bbGetInputXYrender()->RemoveActor(polygonActorXY); + actorAddedXY=false; + } // + }// Active + } // if XYrender + if (bbGetInputYZrender()!=NULL) + { + dep=900; + pointsYZ->SetPoint(0, dep,vecVOI[2], vecVOI[4] ); + pointsYZ->SetPoint(1, dep,vecVOI[2], vecVOI[5] ); + pointsYZ->SetPoint(2, dep,vecVOI[3], vecVOI[5] ); + pointsYZ->SetPoint(3, dep,vecVOI[3], vecVOI[4] ); + pointsYZ-> Modified(); + if ( showActorYZ==true ) + { + if (actorAddedYZ==false) + { + bbGetInputYZrender()->AddActor(polygonActorYZ); + actorAddedYZ=true; + } // + } else { + if (actorAddedYZ==true) + { + bbGetInputYZrender()->RemoveActor(polygonActorYZ); + actorAddedYZ=false; + } // + }// Active + } // if XYrender + if (bbGetInputXZrender()!=NULL) + { + dep=-900; + pointsXZ->SetPoint(0, vecVOI[0],dep, vecVOI[4] ); + pointsXZ->SetPoint(1, vecVOI[0],dep, vecVOI[5] ); + pointsXZ->SetPoint(2, vecVOI[1],dep, vecVOI[5] ); + pointsXZ->SetPoint(3, vecVOI[1],dep, vecVOI[4] ); + pointsXZ-> Modified(); + if ( showActorXZ==true ) + { + if (actorAddedXZ==false) + { + bbGetInputXZrender()->AddActor(polygonActorXZ); + actorAddedXZ=true; + } // + } else { + if (actorAddedXZ==true) + { + bbGetInputXZrender()->RemoveActor(polygonActorXZ); + actorAddedXZ=false; + } // + }// Active + } // if XYrender + } // In size } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void VoiMPR::bbUserSetDefaultValues() { - -// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX -// Here we initialize the input 'In' to 0 - actorAddedXY = false; - actorAddedXZ = false; - actorAddedYZ = false; - bbSetInputActive(true); - bbSetInputXYrender(NULL); - bbSetInputYZrender(NULL); - bbSetInputXZrender(NULL); - - std::vector spc; - spc.push_back(1); - spc.push_back(1); - spc.push_back(1); - bbSetInputSpacing(spc); + + // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX + // Here we initialize the input 'In' to 0 + actorAddedXY = false; + actorAddedXZ = false; + actorAddedYZ = false; + bbSetInputActive(true); + bbSetInputXYrender(NULL); + bbSetInputYZrender(NULL); + bbSetInputXZrender(NULL); + + std::vector spc; + spc.push_back(1); + spc.push_back(1); + spc.push_back(1); + bbSetInputSpacing(spc); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void VoiMPR::bbUserInitializeProcessing() { - -// THE INITIALIZATION METHOD BODY : -// Here does nothing -// but this is where you should allocate the internal/output pointers -// if any - - - pointsXY = vtkPoints ::New(); - linesXY = vtkCellArray ::New(); - polygonXY = vtkPolyData ::New(); - polygonMapperXY = vtkPolyDataMapper ::New(); - polygonActorXY = vtkActor ::New(); -//EED 2023-07-27 + + // THE INITIALIZATION METHOD BODY : + // Here does nothing + // but this is where you should allocate the internal/output pointers + // if any + + + pointsXY = vtkPoints ::New(); + linesXY = vtkCellArray ::New(); + polygonXY = vtkPolyData ::New(); + polygonMapperXY = vtkPolyDataMapper ::New(); + polygonActorXY = vtkActor ::New(); + //EED 2023-07-27 polygonActorXY->GetProperty()->SetOpacity(0.9999); - pointsXY -> SetNumberOfPoints(4); - pointsXY -> SetPoint(0, 0, 0, 0); - pointsXY -> SetPoint(1, 0, 0, 0); - pointsXY -> SetPoint(2, 0, 0, 0); - pointsXY -> SetPoint(3, 0, 0, 0); - linesXY -> InsertNextCell(5); - linesXY -> InsertCellPoint(0); - linesXY -> InsertCellPoint(1); - linesXY -> InsertCellPoint(2); - linesXY -> InsertCellPoint(3); - linesXY -> InsertCellPoint(0); - polygonXY -> SetPoints(pointsXY); - polygonXY -> SetLines(linesXY); - polygonMapperXY -> SetInputData(polygonXY); - polygonMapperXY -> Update(); - polygonActorXY -> SetMapper(polygonMapperXY); - - - pointsXZ = vtkPoints ::New(); - linesXZ = vtkCellArray ::New(); - polygonXZ = vtkPolyData ::New(); - polygonMapperXZ = vtkPolyDataMapper ::New(); - polygonActorXZ = vtkActor ::New(); + pointsXY -> SetNumberOfPoints(4); + pointsXY -> SetPoint(0, 0, 0, 0); + pointsXY -> SetPoint(1, 0, 0, 0); + pointsXY -> SetPoint(2, 0, 0, 0); + pointsXY -> SetPoint(3, 0, 0, 0); + linesXY -> InsertNextCell(5); + linesXY -> InsertCellPoint(0); + linesXY -> InsertCellPoint(1); + linesXY -> InsertCellPoint(2); + linesXY -> InsertCellPoint(3); + linesXY -> InsertCellPoint(0); + polygonXY -> SetPoints(pointsXY); + polygonXY -> SetLines(linesXY); + polygonMapperXY -> SetInputData(polygonXY); + polygonMapperXY -> Update(); + polygonActorXY -> SetMapper(polygonMapperXY); + polygonActorXY -> GetProperty()->SetOpacity(0.99); + polygonActorXY -> GetProperty()->SetLineWidth(2); + + pointsXZ = vtkPoints ::New(); + linesXZ = vtkCellArray ::New(); + polygonXZ = vtkPolyData ::New(); + polygonMapperXZ = vtkPolyDataMapper ::New(); + polygonActorXZ = vtkActor ::New(); //EED 2023-07-27 polygonActorXZ->GetProperty()->SetOpacity(0.9999); - pointsXZ -> SetNumberOfPoints(4); - pointsXZ -> SetPoint(0, 0, 0, 0); - pointsXZ -> SetPoint(1, 0, 0, 0); - pointsXZ -> SetPoint(2, 0, 0, 0); - pointsXZ -> SetPoint(3, 0, 0, 0); - linesXZ -> InsertNextCell(5); - linesXZ -> InsertCellPoint(0); - linesXZ -> InsertCellPoint(1); - linesXZ -> InsertCellPoint(2); - linesXZ -> InsertCellPoint(3); - linesXZ -> InsertCellPoint(0); - polygonXZ -> SetPoints(pointsXZ); - polygonXZ -> SetLines(linesXZ); - polygonMapperXZ -> SetInputData(polygonXZ); - polygonMapperXZ -> Update(); - polygonActorXZ -> SetMapper(polygonMapperXZ); + pointsXZ -> SetNumberOfPoints(4); + pointsXZ -> SetPoint(0, 0, 0, 0); + pointsXZ -> SetPoint(1, 0, 0, 0); + pointsXZ -> SetPoint(2, 0, 0, 0); + pointsXZ -> SetPoint(3, 0, 0, 0); + linesXZ -> InsertNextCell(5); + linesXZ -> InsertCellPoint(0); + linesXZ -> InsertCellPoint(1); + linesXZ -> InsertCellPoint(2); + linesXZ -> InsertCellPoint(3); + linesXZ -> InsertCellPoint(0); + polygonXZ -> SetPoints(pointsXZ); + polygonXZ -> SetLines(linesXZ); + polygonMapperXZ -> SetInputData(polygonXZ); + polygonMapperXZ -> Update(); + polygonActorXZ -> SetMapper(polygonMapperXZ); + polygonActorXZ -> GetProperty()->SetOpacity(0.99); + polygonActorXZ -> GetProperty()->SetLineWidth(2); - pointsYZ = vtkPoints ::New(); - linesYZ = vtkCellArray ::New(); - polygonYZ = vtkPolyData ::New(); - polygonMapperYZ = vtkPolyDataMapper ::New(); - polygonActorYZ = vtkActor ::New(); + pointsYZ = vtkPoints ::New(); + linesYZ = vtkCellArray ::New(); + polygonYZ = vtkPolyData ::New(); + polygonMapperYZ = vtkPolyDataMapper ::New(); + polygonActorYZ = vtkActor ::New(); //EED 2023-07-27 polygonActorYZ->GetProperty()->SetOpacity(0.9999); - pointsYZ ->SetNumberOfPoints(4); - pointsYZ ->SetPoint(0, 0, 0, 0); - pointsYZ ->SetPoint(1, 0, 0, 0); - pointsYZ ->SetPoint(2, 0, 0, 0); - pointsYZ ->SetPoint(3, 0, 0, 0); - linesYZ ->InsertNextCell(5); - linesYZ ->InsertCellPoint(0); - linesYZ ->InsertCellPoint(1); - linesYZ ->InsertCellPoint(2); - linesYZ ->InsertCellPoint(3); - linesYZ ->InsertCellPoint(0); - polygonYZ -> SetPoints(pointsYZ); - polygonYZ -> SetLines(linesYZ); - polygonMapperYZ -> SetInputData(polygonYZ); - polygonMapperYZ -> Update(); - polygonActorYZ -> SetMapper(polygonMapperYZ); + pointsYZ ->SetNumberOfPoints(4); + pointsYZ ->SetPoint(0, 0, 0, 0); + pointsYZ ->SetPoint(1, 0, 0, 0); + pointsYZ ->SetPoint(2, 0, 0, 0); + pointsYZ ->SetPoint(3, 0, 0, 0); + linesYZ ->InsertNextCell(5); + linesYZ ->InsertCellPoint(0); + linesYZ ->InsertCellPoint(1); + linesYZ ->InsertCellPoint(2); + linesYZ ->InsertCellPoint(3); + linesYZ ->InsertCellPoint(0); + polygonYZ -> SetPoints(pointsYZ); + polygonYZ -> SetLines(linesYZ); + polygonMapperYZ -> SetInputData(polygonYZ); + polygonMapperYZ -> Update(); + polygonActorYZ -> SetMapper(polygonMapperYZ); + polygonActorYZ -> GetProperty()->SetOpacity(0.99); + polygonActorXY -> GetProperty()->SetLineWidth(2); + } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void VoiMPR::bbUserFinalizeProcessing() { - -// THE FINALIZATION METHOD BODY : -// Here does nothing -// but this is where you should desallocate the internal/output pointers -// if any - + // THE FINALIZATION METHOD BODY : + // Here does nothing + // but this is where you should desallocate the internal/output pointers + // if any } -} -// EO namespace bbcreaVtk + +}// EO namespace bbcreaVtk -- 2.47.1