Fem: Apply clang-format

This commit is contained in:
wmayer
2023-09-22 12:38:37 +02:00
committed by wwmayer
parent 0b0e6b5799
commit e66404523c
79 changed files with 3674 additions and 2787 deletions

View File

@@ -24,22 +24,22 @@
#include <SMESH_Version.h>
#ifndef _PreComp_
# include <Python.h>
# include <SMESHDS_Mesh.hxx>
# include <SMESH_Mesh.hxx>
#include <Python.h>
#include <SMESHDS_Mesh.hxx>
#include <SMESH_Mesh.hxx>
# ifdef FCWithNetgen
# include <NETGENPlugin_Hypothesis.hxx>
# include <NETGENPlugin_Mesher.hxx>
# endif
#ifdef FCWithNetgen
#include <NETGENPlugin_Hypothesis.hxx>
#include <NETGENPlugin_Mesher.hxx>
#endif
#endif
#include <App/DocumentObjectPy.h>
#include <Base/Console.h>
#include <Mod/Part/App/PartFeature.h>
#include "FemMeshShapeNetgenObject.h"
#include "FemMesh.h"
#include "FemMeshShapeNetgenObject.h"
using namespace Fem;
@@ -47,49 +47,64 @@ using namespace App;
PROPERTY_SOURCE(Fem::FemMeshShapeNetgenObject, Fem::FemMeshShapeObject)
const char* FinenessEnums[]= {"VeryCoarse","Coarse","Moderate","Fine","VeryFine","UserDefined",nullptr};
const char* FinenessEnums[] =
{"VeryCoarse", "Coarse", "Moderate", "Fine", "VeryFine", "UserDefined", nullptr};
FemMeshShapeNetgenObject::FemMeshShapeNetgenObject()
{
ADD_PROPERTY_TYPE(MaxSize,(1000), "MeshParams",Prop_None,"Maximum element size");
ADD_PROPERTY_TYPE(SecondOrder,(true), "MeshParams",Prop_None,"Create quadric elements");
ADD_PROPERTY_TYPE(Fineness,(2), "MeshParams",Prop_None,"Fineness level of the mesh");
ADD_PROPERTY_TYPE(MaxSize, (1000), "MeshParams", Prop_None, "Maximum element size");
ADD_PROPERTY_TYPE(SecondOrder, (true), "MeshParams", Prop_None, "Create quadric elements");
ADD_PROPERTY_TYPE(Fineness, (2), "MeshParams", Prop_None, "Fineness level of the mesh");
Fineness.setEnums(FinenessEnums);
ADD_PROPERTY_TYPE(GrowthRate,(0.3), "MeshParams",Prop_None," allows to define how much the linear dimensions of two adjacent cells can differ");
ADD_PROPERTY_TYPE(NbSegsPerEdge,(1), "MeshParams",Prop_None,"allows to define the minimum number of mesh segments in which edges will be split");
ADD_PROPERTY_TYPE(NbSegsPerRadius,(2), "MeshParams",Prop_None,"allows to define the minimum number of mesh segments in which radiuses will be split");
ADD_PROPERTY_TYPE(Optimize,(true), "MeshParams",Prop_None,"Optimize the resulting mesh");
ADD_PROPERTY_TYPE(
GrowthRate,
(0.3),
"MeshParams",
Prop_None,
" allows to define how much the linear dimensions of two adjacent cells can differ");
ADD_PROPERTY_TYPE(
NbSegsPerEdge,
(1),
"MeshParams",
Prop_None,
"allows to define the minimum number of mesh segments in which edges will be split");
ADD_PROPERTY_TYPE(
NbSegsPerRadius,
(2),
"MeshParams",
Prop_None,
"allows to define the minimum number of mesh segments in which radiuses will be split");
ADD_PROPERTY_TYPE(Optimize, (true), "MeshParams", Prop_None, "Optimize the resulting mesh");
}
FemMeshShapeNetgenObject::~FemMeshShapeNetgenObject() = default;
App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute()
App::DocumentObjectExecReturn* FemMeshShapeNetgenObject::execute()
{
#ifdef FCWithNetgen
Fem::FemMesh newMesh;
Part::Feature *feat = Shape.getValue<Part::Feature*>();
Part::Feature* feat = Shape.getValue<Part::Feature*>();
TopoDS_Shape shape = feat->Shape.getValue();
NETGENPlugin_Mesher myNetGenMesher(newMesh.getSMesh(),shape,true);
NETGENPlugin_Mesher myNetGenMesher(newMesh.getSMesh(), shape, true);
#if SMESH_VERSION_MAJOR >= 9
NETGENPlugin_Hypothesis* tet= new NETGENPlugin_Hypothesis(0,newMesh.getGenerator());
NETGENPlugin_Hypothesis* tet = new NETGENPlugin_Hypothesis(0, newMesh.getGenerator());
#else
NETGENPlugin_Hypothesis* tet= new NETGENPlugin_Hypothesis(0,1,newMesh.getGenerator());
NETGENPlugin_Hypothesis* tet = new NETGENPlugin_Hypothesis(0, 1, newMesh.getGenerator());
#endif
tet->SetMaxSize(MaxSize.getValue());
tet->SetSecondOrder(SecondOrder.getValue());
tet->SetOptimize(Optimize.getValue());
int iFineness = Fineness.getValue();
tet->SetFineness((NETGENPlugin_Hypothesis::Fineness)iFineness);
if(iFineness == 5){
if (iFineness == 5) {
tet->SetGrowthRate(GrowthRate.getValue());
tet->SetNbSegPerEdge(NbSegsPerEdge.getValue());
tet->SetNbSegPerRadius(NbSegsPerRadius.getValue());
}
myNetGenMesher.SetParameters( tet);
myNetGenMesher.SetParameters(tet);
newMesh.getSMesh()->ShapeToMesh(shape);
myNetGenMesher.Compute();
@@ -100,40 +115,42 @@ App::DocumentObjectExecReturn *FemMeshShapeNetgenObject::execute()
const SMDS_MeshInfo& info = data->GetMeshInfo();
int numFaces = data->NbFaces();
int numNode = info.NbNodes();
//int numTria = info.NbTriangles();
//int numQuad = info.NbQuadrangles();
//int numPoly = info.NbPolygons();
// int numTria = info.NbTriangles();
// int numQuad = info.NbQuadrangles();
// int numPoly = info.NbPolygons();
int numVolu = info.NbVolumes();
//int numTetr = info.NbTetras();
//int numHexa = info.NbHexas();
//int numPyrd = info.NbPyramids();
//int numPris = info.NbPrisms();
//int numHedr = info.NbPolyhedrons();
// int numTetr = info.NbTetras();
// int numHexa = info.NbHexas();
// int numPyrd = info.NbPyramids();
// int numPris = info.NbPrisms();
// int numHedr = info.NbPolyhedrons();
Base::Console().Log("NetgenMesh: %i Nodes, %i Volumes, %i Faces\n",numNode,numVolu,numFaces);
Base::Console().Log("NetgenMesh: %i Nodes, %i Volumes, %i Faces\n", numNode, numVolu, numFaces);
FemMesh.setValue(newMesh);
FemMesh.setValue(newMesh);
return App::DocumentObject::StdReturn;
#else
return new App::DocumentObjectExecReturn("The FEM module is built without NETGEN support. Meshing will not work!!!", this);
return new App::DocumentObjectExecReturn(
"The FEM module is built without NETGEN support. Meshing will not work!!!",
this);
#endif
}
//short FemMeshShapeNetgenObject::mustExecute(void) const
// short FemMeshShapeNetgenObject::mustExecute(void) const
//{
// return 0;
//}
// return 0;
// }
//PyObject *FemMeshShapeNetgenObject::getPyObject()
// PyObject *FemMeshShapeNetgenObject::getPyObject()
//{
// if (PythonObject.is(Py::_None())){
// // ref counter is set to 1
// PythonObject = Py::Object(new DocumentObjectPy(this),true);
// }
// return Py::new_reference_to(PythonObject);
//}
// if (PythonObject.is(Py::_None())){
// // ref counter is set to 1
// PythonObject = Py::Object(new DocumentObjectPy(this),true);
// }
// return Py::new_reference_to(PythonObject);
// }
//void FemMeshShapeNetgenObject::onChanged(const Property* prop)
// void FemMeshShapeNetgenObject::onChanged(const Property* prop)
//{
// Fem::FemMeshShapeObject::onChanged(prop);
//}
// Fem::FemMeshShapeObject::onChanged(prop);
// }