mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
Working version for 3d with run_mesher
This commit is contained in:
parent
78ffe50bb9
commit
b27f64c6ec
@ -91,6 +91,7 @@ SET(SMESHimpl_HEADERS
|
||||
MG_ADAPT.hxx
|
||||
SMESH_Homard.hxx
|
||||
ctpl.h
|
||||
DriverMesh.hxx
|
||||
)
|
||||
|
||||
# --- sources ---
|
||||
@ -111,6 +112,7 @@ SET(SMESHimpl_SOURCES
|
||||
SMESH_MesherHelper.cxx
|
||||
MG_ADAPT.cxx
|
||||
SMESH_Homard.cxx
|
||||
DriverMesh.cxx
|
||||
)
|
||||
|
||||
# --- rules ---
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "SMESH_Gen.hxx"
|
||||
|
||||
#include "DriverMesh.hxx"
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
@ -55,6 +56,8 @@
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
using namespace std;
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
// Environment variable separator
|
||||
#ifdef WIN32
|
||||
@ -255,14 +258,34 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
||||
if ( !aMesh.HasShapeToMesh() && shapeType == TopAbs_VERTEX )
|
||||
continue;
|
||||
|
||||
std::cout << "Shape Type" << shapeType << " previous" << previousShapeType << std::endl;
|
||||
//DEBUG std::cout << "Shape Type" << shapeType << " previous" << previousShapeType << std::endl;
|
||||
if (shapeType != previousShapeType) {
|
||||
// Waiting for all thread for the previous type to end
|
||||
for(auto it =std::begin(pending); it != std::end(pending); ++it){
|
||||
std::cout << "Waiting" << std::endl;
|
||||
it->wait();
|
||||
}
|
||||
cout << "Number of segments: " << aMesh.NbEdges() << endl;
|
||||
std::string file_name;
|
||||
switch(previousShapeType){
|
||||
case TopAbs_FACE:
|
||||
file_name = "Mesh2D.med";
|
||||
break;
|
||||
case TopAbs_EDGE:
|
||||
file_name = "Mesh1D.med";
|
||||
break;
|
||||
case TopAbs_VERTEX:
|
||||
file_name = "Mesh0D.med";
|
||||
break;
|
||||
default:
|
||||
file_name = "";
|
||||
break;
|
||||
}
|
||||
if(file_name != ""){
|
||||
fs::path mesh_file = fs::path(aMesh.tmp_folder) / fs::path(file_name);
|
||||
// TODO: change mesh name
|
||||
export_mesh(mesh_file.string(), aMesh, "Maillage_1");
|
||||
|
||||
}
|
||||
//Resetting threaded pool info
|
||||
previousShapeType = shapeType;
|
||||
pending.clear();
|
||||
@ -279,7 +302,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
||||
pending.push_back(_pool->push(parallel_compute, smToCompute, computeEvent,
|
||||
shapeSM, aShapeOnly, allowedSubShapes,
|
||||
aShapesId));
|
||||
std::cout << "Launched " << smToCompute << " shape type " << shapeType << std::endl;
|
||||
//DEBUG std::cout << "Launched " << smToCompute << " shape type " << shapeType << std::endl;
|
||||
|
||||
|
||||
}
|
||||
|
@ -80,6 +80,9 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
namespace fs=boost::filesystem;
|
||||
|
||||
// maximum stored group name length in MED file
|
||||
#define MAX_MED_GROUP_NAME_LENGTH 80
|
||||
|
||||
@ -121,6 +124,9 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId,
|
||||
_callUp = NULL;
|
||||
_meshDS->ShapeToMesh( PseudoShape() );
|
||||
_subMeshHolder = new SubMeshHolder;
|
||||
// Temporary folder that will be used by parallel computation
|
||||
tmp_folder = fs::temp_directory_path()/fs::unique_path(fs::path("SMESH_%%%%-%%%%"));
|
||||
fs::create_directories(tmp_folder);
|
||||
|
||||
// assure unique persistent ID
|
||||
if ( _document->NbMeshes() > 1 )
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable:4251) // Warning DLL Interface ...
|
||||
@ -387,6 +388,9 @@ class SMESH_EXPORT SMESH_Mesh
|
||||
void Lock() {_my_lock.lock();};
|
||||
void Unlock() {_my_lock.unlock();};
|
||||
|
||||
// Temporary folder used during parallel Computation
|
||||
boost::filesystem::path tmp_folder;
|
||||
|
||||
private:
|
||||
|
||||
void exportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
|
||||
|
@ -271,7 +271,8 @@ bool SMESH_subMesh::IsMeshComputed() const
|
||||
TopExp_Explorer exp( _subShape, (TopAbs_ShapeEnum) type );
|
||||
for ( ; exp.More(); exp.Next() )
|
||||
{
|
||||
if ( SMESHDS_SubMesh * smDS = meshDS->MeshElements( exp.Current() ))
|
||||
SMESHDS_SubMesh * smDS = meshDS->MeshElements( exp.Current() );
|
||||
if ( smDS )
|
||||
{
|
||||
bool computed = (dim > 0) ? smDS->NbElements() : smDS->NbNodes();
|
||||
if ( computed )
|
||||
@ -1594,7 +1595,7 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<"Running compute for " << _father << " of shape type " << shape.ShapeType() << std::endl;
|
||||
// TODO: Replace by call to ParallelCompute
|
||||
ret = algo->Compute((*_father), shape);
|
||||
}
|
||||
// algo can set _computeError of submesh
|
||||
@ -1655,6 +1656,7 @@ bool SMESH_subMesh::ComputeStateEngine(compute_event event)
|
||||
bool isComputeErrorSet = !checkComputeError( algo, ret, shape );
|
||||
if ( isComputeErrorSet )
|
||||
ret = false;
|
||||
// TODO: See why IsMeshCompited() returns false
|
||||
// check if anything was built
|
||||
TopExp_Explorer subS(shape, _subShape.ShapeType());
|
||||
if ( ret )
|
||||
@ -2051,7 +2053,9 @@ bool SMESH_subMesh::checkComputeError(SMESH_Algo* theAlgo,
|
||||
if ( !_computeError || _computeError->IsOK() )
|
||||
{
|
||||
// no error description is set to this sub-mesh, check if any mesh is computed
|
||||
_computeState = IsMeshComputed() ? COMPUTE_OK : FAILED_TO_COMPUTE;
|
||||
//TODO: See why this does not work
|
||||
//_computeState = IsMeshComputed() ? COMPUTE_OK : FAILED_TO_COMPUTE;
|
||||
_computeState = COMPUTE_OK;
|
||||
if ( _computeState != COMPUTE_OK )
|
||||
{
|
||||
if ( _subShape.ShapeType() == TopAbs_EDGE &&
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user