This commit is contained in:
rnv 2021-05-26 16:32:53 +03:00
commit 0a447a3701
85 changed files with 1729 additions and 820 deletions

View File

@ -27,7 +27,7 @@ INCLUDE(CMakeDependentOption)
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
SET(${PROJECT_NAME_UC}_MINOR_VERSION 6)
SET(${PROJECT_NAME_UC}_MINOR_VERSION 7)
SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
SET(${PROJECT_NAME_UC}_VERSION
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})

View File

@ -50,4 +50,13 @@ isDone = Mesh_1.Compute()
smesh.SetName(NETGEN_1D_2D_3D.GetAlgorithm(), 'NETGEN 1D-2D-3D')
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
assert(Mesh_1.GetMesh().NbTetras()>=5)
nbOfTetraExp = 5
assert(Mesh_1.GetMesh().NbTetras()>=nbOfTetraExp)
#Mesh_1.ExportMED("toto.med")
import medcoupling as mc
mv_mm = Mesh_1.ExportMEDCoupling()
assert(mc.MEDCoupling1SGTUMesh(mv_mm[0]).getNumberOfCells()>=nbOfTetraExp)

View File

@ -0,0 +1,45 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests de blocFissure ; en standalone
Cas tests basés sur les matériels :
. cubeAngle
. cubeFin
Copyright 2021 EDF
Gérald NICOLAS
+33.1.78.19.43.52
"""
__revision__ = "V02.04"
import os
import sys
# Lancement des cas-tests
import salome
salome.standalone()
salome.salome_init()
from blocFissure.CasTests.blocFissureTest import blocFissureTest
BLOCFISSURE_TEST = blocFissureTest(["cubeAngle", "cubeAngle_2","cubeCoin", "cubeMilieu", "cubeTransverse"])
MESSAGE_ERREUR = BLOCFISSURE_TEST.lancement()
#sys.stdout.write(MESSAGE_ERREUR)
del BLOCFISSURE_TEST
# Diagnostic
if MESSAGE_ERREUR:
if ( "NOOK" in MESSAGE_ERREUR ):
LAUX = MESSAGE_ERREUR.split()
ERREUR = int(LAUX[LAUX.index("NOOK")+2])
else:
ERREUR = 0
else:
MESSAGE_ERREUR = "Impossible de trouver le diagnostic de la procédure de tests."
ERREUR = -1
if ERREUR:
sys.stderr.write(MESSAGE_ERREUR)
#raise Exception(MESSAGE_ERREUR)
assert(False)

View File

@ -0,0 +1,49 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests de blocFissure ; en standalone
Cas tests basés sur les matériels :
. decoupeCylindre
. disque_perce
. fissureGauche
. fissureGauche_2
+ ellipse, ellipse_disque, ellipse_probleme
Copyright 2021 EDF
Gérald NICOLAS
+33.1.78.19.43.52
"""
__revision__ = "V02.04"
import os
import sys
# Lancement des cas-tests
import salome
salome.standalone()
salome.salome_init()
from blocFissure.CasTests.blocFissureTest import blocFissureTest
BLOCFISSURE_TEST = blocFissureTest(["cylindre", "cylindre_2", "disquePerce", "faceGauche","ellipse_1", "ellipse_2"])
#BLOCFISSURE_TEST = blocFissureTest(["cylindre", "cylindre_2", "disquePerce", "faceGauche","ellipse_1", "ellipse_2", "faceGauche_2"])
MESSAGE_ERREUR = BLOCFISSURE_TEST.lancement()
#sys.stdout.write(MESSAGE_ERREUR)
del BLOCFISSURE_TEST
# Diagnostic
if MESSAGE_ERREUR:
if ( "NOOK" in MESSAGE_ERREUR ):
LAUX = MESSAGE_ERREUR.split()
ERREUR = int(LAUX[LAUX.index("NOOK")+2])
else:
ERREUR = 0
else:
MESSAGE_ERREUR = "Impossible de trouver le diagnostic de la procédure de tests."
ERREUR = -1
if ERREUR:
sys.stderr.write(MESSAGE_ERREUR)
#raise Exception(MESSAGE_ERREUR)
assert(False)

View File

@ -0,0 +1,45 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests de blocFissure ; en standalone
Cas tests basés sur les matériels :
. eprouvetteCourbe
. eprouvetteDroite
Copyright 2021 EDF
Gérald NICOLAS
+33.1.78.19.43.52
"""
__revision__ = "V02.03"
import os
import sys
# Lancement des cas-tests
import salome
salome.standalone()
salome.salome_init()
from blocFissure.CasTests.blocFissureTest import blocFissureTest
BLOCFISSURE_TEST = blocFissureTest(["eprouvetteCourbe", "eprouvetteDroite", "eprouvetteDroite_2"])
MESSAGE_ERREUR = BLOCFISSURE_TEST.lancement()
#sys.stdout.write(MESSAGE_ERREUR)
del BLOCFISSURE_TEST
# Diagnostic
if MESSAGE_ERREUR:
if ( "NOOK" in MESSAGE_ERREUR ):
LAUX = MESSAGE_ERREUR.split()
ERREUR = int(LAUX[LAUX.index("NOOK")+2])
else:
ERREUR = 0
else:
MESSAGE_ERREUR = "Impossible de trouver le diagnostic de la procédure de tests."
ERREUR = -1
if ERREUR:
sys.stderr.write(MESSAGE_ERREUR)
#raise Exception(MESSAGE_ERREUR)
assert(False)

View File

@ -0,0 +1,43 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests de blocFissure ; en standalone
Cas tests basés sans matériels (1/3)
Copyright 2021 EDF
Gérald NICOLAS
+33.1.78.19.43.52
"""
__revision__ = "V02.03"
import os
import sys
# Lancement des cas-tests
import salome
salome.standalone()
salome.salome_init()
from blocFissure.CasTests.blocFissureTest import blocFissureTest
BLOCFISSURE_TEST = blocFissureTest(["fissureCoude_1", "fissureCoude_2", "fissureCoude_3", "fissureCoude_4", "fissureCoude_5"])
MESSAGE_ERREUR = BLOCFISSURE_TEST.lancement()
#sys.stdout.write(MESSAGE_ERREUR)
del BLOCFISSURE_TEST
# Diagnostic
if MESSAGE_ERREUR:
if ( "NOOK" in MESSAGE_ERREUR ):
LAUX = MESSAGE_ERREUR.split()
ERREUR = int(LAUX[LAUX.index("NOOK")+2])
else:
ERREUR = 0
else:
MESSAGE_ERREUR = "Impossible de trouver le diagnostic de la procédure de tests."
ERREUR = -1
if ERREUR:
sys.stderr.write(MESSAGE_ERREUR)
#raise Exception(MESSAGE_ERREUR)
assert(False)

View File

@ -0,0 +1,43 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests de blocFissure ; en standalone
Cas tests basés sans matériels (1/3)
Copyright 2021 EDF
Gérald NICOLAS
+33.1.78.19.43.52
"""
__revision__ = "V02.03"
import os
import sys
# Lancement des cas-tests
import salome
salome.standalone()
salome.salome_init()
from blocFissure.CasTests.blocFissureTest import blocFissureTest
BLOCFISSURE_TEST = blocFissureTest(["fissureCoude_6", "fissureCoude_7", "fissureCoude_8", "fissureCoude_9", "fissureCoude_10"])
MESSAGE_ERREUR = BLOCFISSURE_TEST.lancement()
#sys.stdout.write(MESSAGE_ERREUR)
del BLOCFISSURE_TEST
# Diagnostic
if MESSAGE_ERREUR:
if ( "NOOK" in MESSAGE_ERREUR ):
LAUX = MESSAGE_ERREUR.split()
ERREUR = int(LAUX[LAUX.index("NOOK")+2])
else:
ERREUR = 0
else:
MESSAGE_ERREUR = "Impossible de trouver le diagnostic de la procédure de tests."
ERREUR = -1
if ERREUR:
sys.stderr.write(MESSAGE_ERREUR)
#raise Exception(MESSAGE_ERREUR)
assert(False)

View File

@ -0,0 +1,43 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests de blocFissure ; en standalone
Cas tests basés sans matériels (1/3)
Copyright 2021 EDF
Gérald NICOLAS
+33.1.78.19.43.52
"""
__revision__ = "V02.03"
import os
import sys
# Lancement des cas-tests
import salome
salome.standalone()
salome.salome_init()
from blocFissure.CasTests.blocFissureTest import blocFissureTest
BLOCFISSURE_TEST = blocFissureTest(["fissure_Coude", "fissure_Coude_4"])
MESSAGE_ERREUR = BLOCFISSURE_TEST.lancement()
#sys.stdout.write(MESSAGE_ERREUR)
del BLOCFISSURE_TEST
# Diagnostic
if MESSAGE_ERREUR:
if ( "NOOK" in MESSAGE_ERREUR ):
LAUX = MESSAGE_ERREUR.split()
ERREUR = int(LAUX[LAUX.index("NOOK")+2])
else:
ERREUR = 0
else:
MESSAGE_ERREUR = "Impossible de trouver le diagnostic de la procédure de tests."
ERREUR = -1
if ERREUR:
sys.stderr.write(MESSAGE_ERREUR)
#raise Exception(MESSAGE_ERREUR)
assert(False)

View File

@ -0,0 +1,46 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests de blocFissure ; en standalone
Cas tests basés sur les matériels :
. vis
. tube
Copyright 2021 EDF
Gérald NICOLAS
+33.1.78.19.43.52
"""
__revision__ = "V02.04"
import os
import sys
# Lancement des cas-tests
import salome
salome.standalone()
salome.salome_init()
from blocFissure.CasTests.blocFissureTest import blocFissureTest
BLOCFISSURE_TEST = blocFissureTest(["vis_1"])
#BLOCFISSURE_TEST = blocFissureTest(["vis_1", "tube"])
MESSAGE_ERREUR = BLOCFISSURE_TEST.lancement()
#sys.stdout.write(MESSAGE_ERREUR)
del BLOCFISSURE_TEST
# Diagnostic
if MESSAGE_ERREUR:
if ( "NOOK" in MESSAGE_ERREUR ):
LAUX = MESSAGE_ERREUR.split()
ERREUR = int(LAUX[LAUX.index("NOOK")+2])
else:
ERREUR = 0
else:
MESSAGE_ERREUR = "Impossible de trouver le diagnostic de la procédure de tests."
ERREUR = -1
if ERREUR:
sys.stderr.write(MESSAGE_ERREUR)
#raise Exception(MESSAGE_ERREUR)
assert(False)

View File

@ -1,48 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests de blocFissure ; en standalone
Copyright 2021 EDF
Gérald NICOLAS
+33.1.78.19.43.52
"""
__revision__ = "V02.01"
import os
import tempfile
import sys
# Fichier de diagnostic
LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log")
if os.path.isfile(LOGFILE):
os.remove(LOGFILE)
# Lancement des cas-tests
import salome
salome.standalone()
salome.salome_init()
from blocFissure.materielCasTests import genereMateriel
from blocFissure.CasTests import execution_Cas
# Diagnostic
ERREUR = 0
if os.path.isfile(LOGFILE):
with open(LOGFILE, 'r') as FICHIER:
LES_LIGNES = FICHIER.readlines()
for LIGNE in LES_LIGNES:
#print (LIGNE[:-1])
if ( "NOOK" in LIGNE ):
MESSAGE_ERREUR = LIGNE
ERREUR = int(LIGNE.split()[-1])
break
else:
MESSAGE_ERREUR = "Impossible de trouver le fichier de diagnostic {}".format(LOGFILE)
ERREUR = -1
if ERREUR:
sys.stderr.write(MESSAGE_ERREUR)
#raise Exception(MESSAGE_ERREUR)
assert(False)

View File

@ -46,7 +46,13 @@ SET(BAD_TESTS
test_smeshplugin_mg_tetra_parallele.py
test_smeshplugins.py
MGAdaptTests_without_session.py
blocFissure_without_session.py
blocFissure_01_without_session.py
blocFissure_02_without_session.py
blocFissure_03_without_session.py
blocFissure_04_without_session.py
blocFissure_05_without_session.py
blocFissure_06_without_session.py
blocFissure_07_without_session.py
)
SET(GOOD_TESTS

View File

@ -663,6 +663,10 @@ module SMESH
in boolean overwrite,
in boolean autoDimension) raises (SALOME::SALOME_Exception);
long long ExportMEDCoupling(in boolean auto_groups,
in boolean autoDimension
) raises (SALOME::SALOME_Exception);
/*!
* Export a [part of] Mesh into a MED file
* @params
@ -701,6 +705,13 @@ module SMESH
in string geomAssocFields,
in double ZTolerance) raises (SALOME::SALOME_Exception);
long long ExportPartToMEDCoupling( in SMESH_IDSource meshPart,
in boolean auto_groups,
in boolean autoDimension,
in GEOM::ListOfFields fields,
in string geomAssocFields,
in double ZTolerance) raises (SALOME::SALOME_Exception);
/*!
* Export Mesh to SAUV formatted file
* Write a temporary med file and use med2sauv

View File

@ -20,6 +20,7 @@
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
${MEDCOUPLING_INCLUDE_DIRS}
${MEDFILE_INCLUDE_DIRS}
${HDF5_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}

View File

@ -26,7 +26,6 @@
// Module : SMESH
//
#include "DriverMED_Family.h"
#include "MED_Factory.hxx"
#include <sstream>
@ -366,67 +365,6 @@ DriverMED_Family
return aFamilies;
}
//=============================================================================
/*!
* Create TFamilyInfo for this family
*/
//=============================================================================
MED::PFamilyInfo
DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
const MED::PMeshInfo& theMeshInfo) const
{
ostringstream aStr;
aStr << "FAM_" << myId;
set<string>::const_iterator aGrIter = myGroupNames.begin();
for(; aGrIter != myGroupNames.end(); aGrIter++){
aStr << "_" << *aGrIter;
}
string aValue = aStr.str();
// PAL19785,0019867 - med forbids whitespace to be the last char in the name
int maxSize = MED::GetNOMLength();
int lastCharPos = min( maxSize, (int) aValue.size() ) - 1;
while ( isspace( aValue[ lastCharPos ] ))
aValue.resize( lastCharPos-- );
MED::PFamilyInfo anInfo;
if(myId == 0 || myGroupAttributVal == 0){
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
aValue,
myId,
myGroupNames);
}else{
MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description,
MED::TIntVector anAttrIds (1, myId); // Id=0,
MED::TIntVector anAttrVals (1, myGroupAttributVal);
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
aValue,
myId,
myGroupNames,
anAttrDescs,
anAttrIds,
anAttrVals);
}
// cout << endl;
// cout << "Groups: ";
// set<string>::iterator aGrIter = myGroupNames.begin();
// for (; aGrIter != myGroupNames.end(); aGrIter++)
// {
// cout << " " << *aGrIter;
// }
// cout << endl;
//
// cout << "Elements: ";
// set<const SMDS_MeshElement *>::iterator anIter = myElements.begin();
// for (; anIter != myElements.end(); anIter++)
// {
// cout << " " << (*anIter)->GetID();
// }
// cout << endl;
return anInfo;
}
//=============================================================================
/*!
* Initialize the tool by SMESHDS_GroupBase

View File

@ -91,9 +91,10 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
const bool doAllInGroups);
//! Create TFamilyInfo for this family
template<class LowLevelWriter>
MED::PFamilyInfo
GetFamilyInfo (const MED::PWrapper& theWrapper,
const MED::PMeshInfo& theMeshInfo) const;
GetFamilyInfo(const LowLevelWriter& theWrapper,
const MED::PMeshInfo& theMeshInfo) const;
//! Returns elements of this family
const ElementsSet& GetElements () const;
@ -154,4 +155,70 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
ElemTypeSet myTypes; // Issue 0020576
};
#include "MED_Factory.hxx"
#include <set>
#include <string>
//=============================================================================
/*!
* Create TFamilyInfo for this family
*/
//=============================================================================
template<class LowLevelWriter>
MED::PFamilyInfo
DriverMED_Family::GetFamilyInfo(const LowLevelWriter& theWrapper,
const MED::PMeshInfo& theMeshInfo) const
{
std::ostringstream aStr;
aStr << "FAM_" << myId;
std::set<std::string>::const_iterator aGrIter = myGroupNames.begin();
for(; aGrIter != myGroupNames.end(); aGrIter++){
aStr << "_" << *aGrIter;
}
std::string aValue = aStr.str();
// PAL19785,0019867 - med forbids whitespace to be the last char in the name
int maxSize = MED::GetNOMLength();
int lastCharPos = std::min( maxSize, (int) aValue.size() ) - 1;
while ( isspace( aValue[ lastCharPos ] ))
aValue.resize( lastCharPos-- );
MED::PFamilyInfo anInfo;
if(myId == 0 || myGroupAttributVal == 0){
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
aValue,
myId,
myGroupNames);
}else{
MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description,
MED::TIntVector anAttrIds (1, myId); // Id=0,
MED::TIntVector anAttrVals (1, myGroupAttributVal);
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
aValue,
myId,
myGroupNames,
anAttrDescs,
anAttrIds,
anAttrVals);
}
// cout << endl;
// cout << "Groups: ";
// set<string>::iterator aGrIter = myGroupNames.begin();
// for (; aGrIter != myGroupNames.end(); aGrIter++)
// {
// cout << " " << *aGrIter;
// }
// cout << endl;
//
// cout << "Elements: ";
// set<const SMDS_MeshElement *>::iterator anIter = myElements.begin();
// for (; anIter != myElements.end(); anIter++)
// {
// cout << " " << (*anIter)->GetID();
// }
// cout << endl;
return anInfo;
}
#endif

View File

@ -35,6 +35,7 @@
#include "SMDS_SetIterator.hxx"
#include "SMESHDS_Mesh.hxx"
#include "MED_Common.hxx"
#include "MED_TFile.hxx"
#include <med.h>
@ -343,13 +344,43 @@ namespace
}
}
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
{
MED::PWrapper myMed = CrWrapperW(myFile, myVersion);
return this->PerformInternal<MED::PWrapper>(myMed);
}
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh_Mem::Perform()
{
void *ptr(nullptr);
std::size_t sz(0);
Driver_Mesh::Status status = Driver_Mesh::DRS_OK;
bool isClosed(false);
TMemFile *tfileInst = nullptr;
{// let braces to flush (call of MED::PWrapper myMed destructor)
tfileInst = new TMemFile(&isClosed);
MED::PWrapper myMed = CrWrapperW(myFile, -1, tfileInst);
status = this->PerformInternal<MED::PWrapper>(myMed);
}
if(tfileInst)
{
ptr = tfileInst->getData(); sz = tfileInst->getSize();
}
_data = MEDCoupling::DataArrayByte::New();
_data->useArray(reinterpret_cast<char *>(ptr),true,MEDCoupling::DeallocType::C_DEALLOC,sz,1);
if(!isClosed)
THROW_SALOME_EXCEPTION("DriverMED_W_SMESHDS_Mesh_Mem::Perform - MED memory file id is supposed to be closed !");
return status;
}
//================================================================================
/*!
* \brief Write my mesh
*/
//================================================================================
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
template<class LowLevelWriter>
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::PerformInternal(LowLevelWriter myMed)
{
Status aResult = DRS_OK;
try {
@ -471,7 +502,6 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
}
}
MED::PWrapper myMed = CrWrapperW(myFile, myVersion);
PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aSpaceDimension,aMeshName);
//MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
myMed->SetMeshInfo(aMeshInfo);
@ -532,7 +562,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
list<DriverMED_FamilyPtr>::iterator aFamsIter;
for (aFamsIter = aFamilies.begin(); aFamsIter != aFamilies.end(); aFamsIter++)
{
PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo(myMed,aMeshInfo);
PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo<LowLevelWriter>(myMed,aMeshInfo);
myMed->SetFamilyInfo(aFamilyInfo);
}

View File

@ -74,7 +74,10 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
/*! add one mesh
*/
virtual Status Perform();
Status Perform() override;
template<class LowLevelWriter>
Driver_Mesh::Status PerformInternal(LowLevelWriter myMed);
private:
@ -94,4 +97,15 @@ class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
double myZTolerance;
};
#include "MEDCouplingMemArray.hxx"
class MESHDRIVERMED_EXPORT DriverMED_W_SMESHDS_Mesh_Mem : public DriverMED_W_SMESHDS_Mesh
{
public:
Status Perform() override;
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> getData() { return _data; }
private:
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> _data;
};
#endif

View File

@ -24,6 +24,7 @@ INCLUDE_DIRECTORIES(
${HDF5_INCLUDE_DIRS}
${MEDFILE_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${MEDCOUPLING_INCLUDE_DIRS}
)
# additional preprocessor / compiler flags
@ -37,6 +38,7 @@ SET(_link_LIBRARIES
${HDF5_LIBS}
${MEDFILE_C_LIBRARIES}
${KERNEL_SALOMELocalTrace}
${MEDCoupling_medloader}
)
# --- headers ---

View File

@ -183,10 +183,10 @@ namespace MED
if (!CheckCompatibility(fileName)) {
EXCEPTION(std::runtime_error, "Cannot open file '"<<fileName<<"'.");
}
return new MED::TWrapper(fileName, false);
return new MED::TWrapper(fileName, false, nullptr);
}
PWrapper CrWrapperW(const std::string& fileName, int theVersion)
PWrapper CrWrapperW(const std::string& fileName, int theVersion, TFileInternal *tfileInst)
{
bool isCreated = false;
if (!CheckCompatibility(fileName, true))
@ -204,6 +204,6 @@ namespace MED
wantedMajor = theVersion/10;
wantedMinor = theVersion%10;
}
return new MED::TWrapper(fileName, true, wantedMajor, wantedMinor);
return new MED::TWrapper(fileName, true, tfileInst, wantedMajor, wantedMinor);
}
}

View File

@ -47,7 +47,7 @@ namespace MED
PWrapper CrWrapperR( const std::string& );
MEDWRAPPER_EXPORT
PWrapper CrWrapperW( const std::string&, int theVersion=-1 );
PWrapper CrWrapperW( const std::string&, int theVersion=-1 , TFileInternal *tfileInst=nullptr );
}
#endif // MED_Factory_HeaderFile

View File

@ -0,0 +1,93 @@
// Copyright (C) 2021 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#pragma once
#include "MED_Wrapper.hxx"
namespace MED
{
class TFileInternal
{
public:
virtual ~TFileInternal() = default;
virtual void Open(EModeAcces theMode, TErr* theErr = nullptr) = 0;
virtual void Close() = 0;
virtual const TIdt& Id() const = 0;
};
class MEDIDTHoder : public TFileInternal
{
protected:
MEDIDTHoder(bool *isClosedStatus = nullptr):_isClosedStatus(isClosedStatus) { }
void UnRefFid()
{
if (--myCount == 0)
{
MEDfileClose(myFid);
myIsClosed = true;
if(_isClosedStatus)
*_isClosedStatus = true;
}
}
public:
const TIdt& Id() const override;
~MEDIDTHoder() { this->UnRefFid(); }
void Close() override { this->UnRefFid(); }
protected:
TInt myCount = 0;
TIdt myFid = 0;
bool myIsClosed = false;
bool *_isClosedStatus = nullptr;
};
class TFileDecorator : public TFileInternal
{
public:
TFileDecorator(TFileInternal *effective):_effective(effective) { }
void Open(EModeAcces theMode, TErr* theErr = nullptr) override { if(_effective) _effective->Open(theMode,theErr); }
void Close() override { if(_effective) _effective->Close(); }
const TIdt& Id() const override { if(_effective) return _effective->Id(); EXCEPTION(std::runtime_error, "TFileDecorator - GetFid() : no effective TFile !"); }
~TFileDecorator() { delete _effective; }
private:
TFileInternal *_effective = nullptr;
};
class TMemFile : public MEDIDTHoder
{
public:
TMemFile(bool* isClosedStatus = nullptr):MEDIDTHoder(isClosedStatus) { }
void Open(EModeAcces theMode, TErr* theErr = nullptr) override;
void *getData() const { return memfile.app_image_ptr; }
std::size_t getSize() const { return memfile.app_image_size; }
private:
med_memfile memfile = MED_MEMFILE_INIT;
};
class TFile : public MEDIDTHoder
{
public:
TFile(const std::string& theFileName, TInt theMajor=-1, TInt theMinor=-1);
void Open(EModeAcces theMode, TErr* theErr = nullptr) override;
protected:
std::string myFileName;
TInt myMajor;
TInt myMinor;
};
}

View File

@ -23,7 +23,9 @@
#include "MED_Wrapper.hxx"
#include "MED_TStructures.hxx"
#include "MED_Utilities.hxx"
#include "MED_TFile.hxx"
#include "MEDFileUtilities.hxx"
#include <med.h>
#include <med_err.h>
#include <med_proto.h>
@ -76,90 +78,75 @@ namespace MED
}
//---------------------------------------------------------------
class TFile
const TIdt& MEDIDTHoder::Id() const
{
TFile();
TFile(const TFile&);
if (myFid < 0)
EXCEPTION(std::runtime_error, "TFile - GetFid() < 0");
return myFid;
}
public:
TFile(const std::string& theFileName, TInt theMajor=-1, TInt theMinor=-1):
myCount(0),
myFid(0),
myFileName(theFileName),
myMajor(theMajor),
myMinor(theMinor)
void TMemFile::Open(EModeAcces theMode, TErr* theErr)
{
if (this->myCount++ == 0)
{
if ((myMajor < 0) || (myMajor > MED_MAJOR_NUM)) myMajor = MED_MAJOR_NUM;
if ((myMinor < 0) || (myMajor == MED_MAJOR_NUM && myMinor > MED_MINOR_NUM)) myMinor = MED_MINOR_NUM;
std::string dftFileName = MEDCoupling::MEDFileWritableStandAlone::GenerateUniqueDftFileNameInMem();
memfile = MED_MEMFILE_INIT;
memfile.app_image_ptr=0;
memfile.app_image_size=0;
myFid = MEDmemFileOpen(dftFileName.c_str(),&memfile,MED_FALSE,MED_ACC_CREAT);
}
if (theErr)
*theErr = TErr(myFid);
else if (myFid < 0)
EXCEPTION(std::runtime_error,"TMemFile - MEDmemFileOpen");
}
~TFile()
{
Close();
}
TFile::TFile(const std::string& theFileName, TInt theMajor, TInt theMinor):
myFileName(theFileName),
myMajor(theMajor),
myMinor(theMinor)
{
if ((myMajor < 0) || (myMajor > MED_MAJOR_NUM)) myMajor = MED_MAJOR_NUM;
if ((myMinor < 0) || (myMajor == MED_MAJOR_NUM && myMinor > MED_MINOR_NUM)) myMinor = MED_MINOR_NUM;
}
void
Open(EModeAcces theMode,
TErr* theErr = NULL)
{
if (myCount++ == 0) {
const char* aFileName = myFileName.c_str();
void TFile::Open(EModeAcces theMode, TErr* theErr)
{
if (myCount++ == 0) {
const char* aFileName = myFileName.c_str();
#ifdef WIN32
if (med_access_mode(theMode) == MED_ACC_RDWR) {
// Force removing readonly attribute from a file under Windows, because of a bug in the HDF5
std::string aReadOlnyRmCmd = "attrib -r \"" + myFileName + "\"> nul 2>&1";
if (med_access_mode(theMode) == MED_ACC_RDWR) {
// Force removing readonly attribute from a file under Windows, because of a bug in the HDF5
std::string aReadOlnyRmCmd = "attrib -r \"" + myFileName + "\"> nul 2>&1";
#ifdef UNICODE
const char* to_decode = aReadOlnyRmCmd.c_str();
int size_needed = MultiByteToWideChar(CP_UTF8, 0, to_decode, strlen(to_decode), NULL, 0);
wchar_t* awReadOlnyRmCmd = new wchar_t[size_needed + 1];
MultiByteToWideChar(CP_UTF8, 0, to_decode, strlen(to_decode), awReadOlnyRmCmd, size_needed);
awReadOlnyRmCmd[size_needed] = '\0';
_wsystem(awReadOlnyRmCmd);
delete[] awReadOlnyRmCmd;
const char* to_decode = aReadOlnyRmCmd.c_str();
int size_needed = MultiByteToWideChar(CP_UTF8, 0, to_decode, strlen(to_decode), NULL, 0);
wchar_t* awReadOlnyRmCmd = new wchar_t[size_needed + 1];
MultiByteToWideChar(CP_UTF8, 0, to_decode, strlen(to_decode), awReadOlnyRmCmd, size_needed);
awReadOlnyRmCmd[size_needed] = '\0';
_wsystem(awReadOlnyRmCmd);
delete[] awReadOlnyRmCmd;
#else
system(aReadOlnyRmCmd.c_str());
system(aReadOlnyRmCmd.c_str());
#endif
}
#endif
myFid = MEDfileVersionOpen(aFileName,med_access_mode(theMode), myMajor, myMinor, MED_RELEASE_NUM);
}
if (theErr)
*theErr = TErr(myFid);
else if (myFid < 0)
EXCEPTION(std::runtime_error,"TFile - MEDfileVersionOpen('"<<myFileName<<"',"<<theMode<<"',"<< myMajor <<"',"<< myMinor<<"',"<< MED_RELEASE_NUM<<")");
#endif
myFid = MEDfileVersionOpen(aFileName,med_access_mode(theMode), myMajor, myMinor, MED_RELEASE_NUM);
}
const TIdt&
Id() const
{
if (myFid < 0)
EXCEPTION(std::runtime_error, "TFile - GetFid() < 0");
return myFid;
}
void
Close()
{
if (--myCount == 0)
MEDfileClose(myFid);
}
protected:
TInt myCount;
TIdt myFid;
std::string myFileName;
TInt myMajor;
TInt myMinor;
};
if (theErr)
*theErr = TErr(myFid);
else if (myFid < 0)
EXCEPTION(std::runtime_error,"TFile - MEDfileVersionOpen('"<<myFileName<<"',"<<theMode<<"',"<< myMajor <<"',"<< myMinor<<"',"<< MED_RELEASE_NUM<<")");
}
//---------------------------------------------------------------
class TFileWrapper
{
PFile myFile;
PFileInternal myFile;
TInt myMinor;
public:
TFileWrapper(const PFile& theFile,
TFileWrapper(const PFileInternal& theFile,
EModeAcces theMode,
TErr* theErr = NULL,
TInt theMinor=-1):
@ -211,11 +198,15 @@ namespace MED
//---------------------------------------------------------------
TWrapper
::TWrapper(const std::string& theFileName, bool write, TInt theMajor, TInt theMinor):
myFile(new TFile(theFileName, theMajor, theMinor)),
::TWrapper(const std::string& theFileName, bool write, TFileInternal *tfileInst, TInt theMajor, TInt theMinor):
myMajor(theMajor),
myMinor(theMinor)
{
if(!tfileInst)
myFile.reset(new TFile(theFileName, theMajor, theMinor) );
else
myFile.reset(new TFileDecorator(tfileInst) );
TErr aRet;
if ( write ) {
myFile->Open(eLECTURE_ECRITURE, &aRet);

View File

@ -32,8 +32,8 @@
namespace MED
{
//----------------------------------------------------------------------------
class TFile;
typedef boost::shared_ptr<TFile> PFile;
class TFileInternal;
typedef std::shared_ptr<TFileInternal> PFileInternal;
typedef enum {eLECTURE, eLECTURE_ECRITURE, eLECTURE_AJOUT, eCREATION} EModeAcces;
@ -52,7 +52,7 @@ namespace MED
TWrapper& operator=(const TWrapper&);
public:
TWrapper(const std::string& theFileName, bool write, TInt theMajor=-1, TInt theVersion=-1);
TWrapper(const std::string& theFileName, bool write, TFileInternal *tfileInst = nullptr, TInt theMajor=-1, TInt theVersion=-1);
virtual
~TWrapper();
@ -938,7 +938,7 @@ namespace MED
TErr* theErr = NULL);
protected:
PFile myFile;
PFileInternal myFile;
TInt myMajor;
TInt myMinor;
};
@ -963,23 +963,23 @@ namespace MED
//----------------------------------------------------------------------------
//! Specialization of SharedPtr for TWrapper
template<>
class MEDWRAPPER_EXPORT SharedPtr<TWrapper>: public boost::shared_ptr<TWrapper>
class MEDWRAPPER_EXPORT SharedPtr<TWrapper>: public std::shared_ptr<TWrapper>
{
public:
SharedPtr() {}
SharedPtr(TWrapper* p):
boost::shared_ptr<TWrapper>(p)
std::shared_ptr<TWrapper>(p)
{}
template<class Y>
explicit SharedPtr(Y* p):
boost::shared_ptr<TWrapper>(p)
std::shared_ptr<TWrapper>(p)
{}
template<class Y>
SharedPtr(const SharedPtr<Y>& r):
boost::shared_ptr<TWrapper>(boost::dynamic_pointer_cast<TWrapper,Y>(r))
std::shared_ptr<TWrapper>(boost::dynamic_pointer_cast<TWrapper,Y>(r))
{}
template<class Y>
@ -1021,7 +1021,7 @@ namespace MED
TWrapper*
get() const // never throws
{
return boost::shared_ptr<TWrapper>::get();
return std::shared_ptr<TWrapper>::get();
}
};
}

View File

@ -1392,48 +1392,17 @@ bool SMESH_Mesh::HasDuplicatedGroupNamesMED()
return false;
}
//================================================================================
/*!
* \brief Export the mesh to a med file
* \param [in] file - name of the MED file
* \param [in] theMeshName - name of this mesh
* \param [in] theAutoGroups - boolean parameter for creating/not creating
* the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
* the typical use is auto_groups=false.
* \param [in] theVersion - define the minor (xy, where version is x.y.z) of MED file format.
* If theVersion is equal to -1, the minor version is not changed (default).
* \param [in] meshPart - mesh data to export
* \param [in] theAutoDimension - if \c true, a space dimension of a MED mesh can be either
* - 1D if all mesh nodes lie on OX coordinate axis, or
* - 2D if all mesh nodes lie on XOY coordinate plane, or
* - 3D in the rest cases.
* If \a theAutoDimension is \c false, the space dimension is always 3.
* \param [in] theAddODOnVertices - to create 0D elements on all vertices
* \param [in] theAllElemsToGroup - to make every element to belong to any group (PAL23413)
* \param [in] ZTolerance - tolerance in Z direction. If Z coordinate of a node is close to zero
* within a given tolerance, the coordinate is set to zero.
* If \a ZTolerance is negative, the node coordinates are kept as is.
* \return int - mesh index in the file
*/
//================================================================================
void SMESH_Mesh::ExportMED(const char * file,
void SMESH_Mesh::ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
const char* theMeshName,
bool theAutoGroups,
int theVersion,
const SMESHDS_Mesh* meshPart,
bool theAutoDimension,
bool theAddODOnVertices,
double theZTolerance,
bool theAllElemsToGroup)
{
MESSAGE("MED_VERSION:"<< theVersion);
Driver_Mesh::Status status;
Driver_Mesh::Status status = Driver_Mesh::DRS_OK;
SMESH_TRY;
DriverMED_W_SMESHDS_Mesh myWriter;
myWriter.SetFile ( file , theVersion);
myWriter.SetMesh ( meshPart ? (SMESHDS_Mesh*) meshPart : _myMeshDS );
myWriter.SetAutoDimension( theAutoDimension );
myWriter.AddODOnVertices ( theAddODOnVertices );
@ -1492,6 +1461,64 @@ void SMESH_Mesh::ExportMED(const char * file,
throw TooLargeForExport("MED");
}
/*!
* Same as SMESH_Mesh::ExportMED except for \a file and \a theVersion
*/
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> SMESH_Mesh::ExportMEDCoupling(
const char* theMeshName,
bool theAutoGroups,
const SMESHDS_Mesh* meshPart,
bool theAutoDimension,
bool theAddODOnVertices,
double theZTolerance,
bool theAllElemsToGroup)
{
DriverMED_W_SMESHDS_Mesh_Mem myWriter;
this->ExportMEDCommmon(myWriter,theMeshName,theAutoGroups,meshPart,theAutoDimension,theAddODOnVertices,theZTolerance,theAllElemsToGroup);
return myWriter.getData();
}
//================================================================================
/*!
* \brief Export the mesh to a med file
* \param [in] file - name of the MED file
* \param [in] theMeshName - name of this mesh
* \param [in] theAutoGroups - boolean parameter for creating/not creating
* the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
* the typical use is auto_groups=false.
* \param [in] theVersion - define the minor (xy, where version is x.y.z) of MED file format.
* If theVersion is equal to -1, the minor version is not changed (default).
* \param [in] meshPart - mesh data to export
* \param [in] theAutoDimension - if \c true, a space dimension of a MED mesh can be either
* - 1D if all mesh nodes lie on OX coordinate axis, or
* - 2D if all mesh nodes lie on XOY coordinate plane, or
* - 3D in the rest cases.
* If \a theAutoDimension is \c false, the space dimension is always 3.
* \param [in] theAddODOnVertices - to create 0D elements on all vertices
* \param [in] theAllElemsToGroup - to make every element to belong to any group (PAL23413)
* \param [in] ZTolerance - tolerance in Z direction. If Z coordinate of a node is close to zero
* within a given tolerance, the coordinate is set to zero.
* If \a ZTolerance is negative, the node coordinates are kept as is.
* \return int - mesh index in the file
*/
//================================================================================
void SMESH_Mesh::ExportMED(const char * file,
const char* theMeshName,
bool theAutoGroups,
int theVersion,
const SMESHDS_Mesh* meshPart,
bool theAutoDimension,
bool theAddODOnVertices,
double theZTolerance,
bool theAllElemsToGroup)
{
MESSAGE("MED_VERSION:"<< theVersion);
DriverMED_W_SMESHDS_Mesh myWriter;
myWriter.SetFile( file , theVersion );
this->ExportMEDCommmon(myWriter,theMeshName,theAutoGroups,meshPart,theAutoDimension,theAddODOnVertices,theZTolerance,theAllElemsToGroup);
}
//================================================================================
/*!
* \brief Export the mesh to a SAUV file

View File

@ -41,6 +41,8 @@
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include "MEDCouplingMemArray.hxx"
#include <map>
#include <list>
#include <vector>
@ -62,6 +64,8 @@ class SMESH_HypoFilter;
class SMESH_subMesh;
class TopoDS_Solid;
class DriverMED_W_SMESHDS_Mesh;
typedef std::list<int> TListOfInt;
typedef std::list<TListOfInt> TListOfListOfInt;
@ -261,6 +265,15 @@ class SMESH_EXPORT SMESH_Mesh
TooLargeForExport(const char* format):runtime_error(format) {}
};
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> ExportMEDCoupling(
const char* theMeshName = NULL,
bool theAutoGroups = true,
const SMESHDS_Mesh* theMeshPart = 0,
bool theAutoDimension = false,
bool theAddODOnVertices = false,
double theZTolerance = -1.,
bool theAllElemsToGroup = false);
void ExportMED(const char * theFile,
const char* theMeshName = NULL,
bool theAutoGroups = true,
@ -372,6 +385,16 @@ class SMESH_EXPORT SMESH_Mesh
private:
void ExportMEDCommmon(DriverMED_W_SMESHDS_Mesh& myWriter,
const char* theMeshName,
bool theAutoGroups,
const SMESHDS_Mesh* meshPart,
bool theAutoDimension,
bool theAddODOnVertices,
double theZTolerance,
bool theAllElemsToGroup);
private:
void fillAncestorsMap(const TopoDS_Shape& theShape);
void getAncestorsSubMeshes(const TopoDS_Shape& theSubShape,
std::vector< SMESH_subMesh* >& theSubMeshes) const;

View File

@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES(
${Boost_INCLUDE_DIRS}
${OpenCASCADE_INCLUDE_DIR}
${OMNIORB_INCLUDE_DIR}
${MEDCOUPLING_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/Controls
${PROJECT_SOURCE_DIR}/src/Driver
${PROJECT_SOURCE_DIR}/src/DriverDAT

View File

@ -34,6 +34,7 @@ INCLUDE_DIRECTORIES(
${Boost_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${HDF5_INCLUDE_DIRS}
${MEDCOUPLING_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/OBJECT
${PROJECT_SOURCE_DIR}/src/SMESHFiltersSelection
${PROJECT_SOURCE_DIR}/src/SMDS

View File

@ -4795,7 +4795,7 @@ Il ne peut pas être supprimé.</translation>
</message>
<message>
<source>Generate mesh from CAD model or import mesh</source>
<translation type="unfinished">Generate mesh from CAD model or import mesh</translation>
<translation type="unfinished">Créer un maillage à partir d'un modèle CAO ou par importation</translation>
</message>
</context>
<context>
@ -5151,7 +5151,7 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
</message>
<message>
<source>PREF_SELECTION_INCREMENT</source>
<translation type="unfinished">Elements width increment</translation>
<translation type="unfinished">Incrément de largeur d'éléments</translation>
</message>
<message>
<source>PREF_OBJECT_COLOR</source>
@ -5247,59 +5247,59 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
</message>
<message>
<source>INFO_WELCOME_TO_SMESH</source>
<translation type="unfinished">Welcome to Mesh</translation>
<translation type="unfinished">Bienvenue dans le module Mesh</translation>
</message>
<message>
<source>INFO_GRP_CREATE_MESH</source>
<translation type="unfinished">Create mesh</translation>
<translation type="unfinished">Créer un maillage</translation>
</message>
<message>
<source>INFO_DEFINE_ALGOS</source>
<translation type="unfinished">Choose algorithms</translation>
<translation type="unfinished">Choisir les algorithmes</translation>
</message>
<message>
<source>INFO_DEFINE_HYPOS</source>
<translation type="unfinished">Define hypotheses</translation>
<translation type="unfinished">Définir des hypothèses</translation>
</message>
<message>
<source>INFO_COMPUTE</source>
<translation type="unfinished">Compute</translation>
<translation type="unfinished">Calculer</translation>
</message>
<message>
<source>INFO_REFINE</source>
<translation type="unfinished">Add refinements</translation>
<translation type="unfinished">Ajouter des raffinements</translation>
</message>
<message>
<source>INFO_REFINE_LOCAL_SIZE</source>
<translation type="unfinished">via local sizes with some hypotheses</translation>
<translation type="unfinished">via des tailles locales dans certaines hypothèses</translation>
</message>
<message>
<source>INFO_REFINE_SUBMESH</source>
<translation type="unfinished">via sub-meshes</translation>
<translation type="unfinished">via des sous-maillages</translation>
</message>
<message>
<source>INFO_GRP_IMPORT_MESH</source>
<translation type="unfinished">Import mesh</translation>
<translation type="unfinished">Importer un maillage</translation>
</message>
<message>
<source>INFO_AVAILABLE_FORMATS</source>
<translation type="unfinished">Available formats</translation>
<translation type="unfinished">Formats disponibles</translation>
</message>
<message>
<source>INFO_GRP_CHECK_MESH</source>
<translation type="unfinished"> Check mesh quality</translation>
<translation type="unfinished">Contrôler la qualité du maillage</translation>
</message>
<message>
<source>INFO_DISPLAY</source>
<translation type="unfinished">Display mesh</translation>
<translation type="unfinished">Afficher le maillage</translation>
</message>
<message>
<source>INFO_QUALITY_INFO</source>
<translation type="unfinished">Display some quality criteria</translation>
<translation type="unfinished">Afficher des critères de qualité</translation>
</message>
<message>
<source>INFO_QUALITY_AREA</source>
<translation type="unfinished">area</translation>
<translation type="unfinished">surface</translation>
</message>
<message>
<source>INFO_QUALITY_VOLUME</source>
@ -5307,11 +5307,11 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
</message>
<message>
<source>INFO_QUALITY_ASPECT_RATION</source>
<translation type="unfinished">aspect ration</translation>
<translation type="unfinished">Facteur de forme</translation>
</message>
<message>
<source>INFO_CLIPPING</source>
<translation type="unfinished">Add clipping planes</translation>
<translation type="unfinished">Insérer un plan de coupe</translation>
</message>
</context>
<context>

View File

@ -28,6 +28,7 @@ INCLUDE_DIRECTORIES(
${KERNEL_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${GEOM_INCLUDE_DIRS}
${MEDCOUPLING_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/Controls
${PROJECT_SOURCE_DIR}/src/SMDS
${PROJECT_SOURCE_DIR}/src/SMESHDS

View File

@ -23,6 +23,8 @@
#include "SALOME_Container_i.hxx"
#include "SALOME_KernelServices.hxx"
#include "SALOME_Fake_NamingService.hxx"
#include <cstring>
static Engines::EngineComponent_var _unique_compo;
@ -46,6 +48,8 @@ Engines::EngineComponent_var RetrieveSMESHInstance()
//
pman->activate();
//
SMESH_Gen_i::SetNS(new SALOME_Fake_NamingService);
//
SMESH_Gen_No_Session_i *servant = new SMESH_Gen_No_Session_i(orb, poa, conId, "SMESH_inst_2", "SMESH");
PortableServer::ObjectId *zeId = servant->getId();
CORBA::Object_var zeRef = poa->id_to_reference(*zeId);

View File

@ -29,7 +29,6 @@ SMESH_Gen_No_Session_i::SMESH_Gen_No_Session_i( CORBA::ORB_ptr orb,
const char* instanceName,
const char* interfaceName):SMESH_Gen_i(orb,poa,contId,instanceName,interfaceName,false)
{
myNS = new SALOME_Fake_NamingService;
}
GEOM::GEOM_Gen_var SMESH_Gen_No_Session_i::GetGeomEngine( bool isShaper )

View File

@ -237,6 +237,14 @@ CORBA::Object_var SMESH_Gen_i::SObjectToObject( SALOMEDS::SObject_ptr theSObject
return anObj;
}
// Set Naming Service object
void SMESH_Gen_i::SetNS(SALOME_NamingService_Abstract *ns)
{
if(myNS)
delete myNS;
myNS = ns;
}
//=============================================================================
/*!
* GetNS [ static ]
@ -247,7 +255,7 @@ CORBA::Object_var SMESH_Gen_i::SObjectToObject( SALOMEDS::SObject_ptr theSObject
SALOME_NamingService_Abstract* SMESH_Gen_i::GetNS()
{
if ( myNS == NULL ) {
if ( !myNS ) {
myNS = SINGLETON_<SALOME_NamingService>::Instance();
ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting());
myNS->init_orb( GetORB() );

View File

@ -104,6 +104,8 @@ public:
static CORBA::ORB_var GetORB() { return myOrb;}
// Get SMESH module's POA object
static PortableServer::POA_var GetPOA() { return myPoa;}
// Set Naming Service object
static void SetNS(SALOME_NamingService_Abstract *ns);
// Get Naming Service object
static SALOME_NamingService_Abstract* GetNS();
// Get SALOME_LifeCycleCORBA object

View File

@ -3684,6 +3684,25 @@ void SMESH_Mesh_i::PrepareForWriting (const char* file, bool overwrite)
}
}
/*!
Return a MeshName
*/
std::string SMESH_Mesh_i::generateMeshName()
{
string aMeshName = "Mesh";
SALOMEDS::Study_var aStudy = SMESH_Gen_i::GetSMESHGen()->getStudyServant();
if ( !aStudy->_is_nil() )
{
SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject( _this() );
if ( !aMeshSO->_is_nil() )
{
CORBA::String_var name = aMeshSO->GetName();
aMeshName = name;
}
}
return aMeshName;
}
//================================================================================
/*!
* \brief Prepare a file for export and pass names of mesh groups from study to mesh DS
@ -3698,13 +3717,11 @@ string SMESH_Mesh_i::prepareMeshNameAndGroups(const char* file,
{
// Perform Export
PrepareForWriting(file, overwrite);
string aMeshName = "Mesh";
string aMeshName(this->generateMeshName());
SALOMEDS::Study_var aStudy = SMESH_Gen_i::GetSMESHGen()->getStudyServant();
if ( !aStudy->_is_nil() ) {
SALOMEDS::SObject_wrap aMeshSO = _gen_i->ObjectToSObject( _this() );
if ( !aMeshSO->_is_nil() ) {
CORBA::String_var name = aMeshSO->GetName();
aMeshName = name;
// asv : 27.10.04 : fix of 6903: check for StudyLocked before adding attributes
if ( !aStudy->GetProperties()->IsLocked() )
{
@ -3763,6 +3780,23 @@ void SMESH_Mesh_i::ExportMED(const char* file,
SMESH_CATCH( SMESH::throwCorbaException );
}
CORBA::LongLong SMESH_Mesh_i::ExportMEDCoupling(CORBA::Boolean auto_groups, CORBA::Boolean autoDimension)
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> data;
SMESH_TRY;
// TODO : Fix me ! 2 next lines are required
//if( !this->_gen_i->IsEmbeddedMode() )
// SMESH::throwCorbaException("SMESH_Mesh_i::ExportMEDCoupling : only for embedded mode !");
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
string aMeshName = this->generateMeshName();
data = _impl->ExportMEDCoupling( aMeshName.c_str(), auto_groups, 0, autoDimension );
SMESH_CATCH( SMESH::throwCorbaException );
MEDCoupling::DataArrayByte *ret(data.retn());
return reinterpret_cast<CORBA::LongLong>(ret);
}
//================================================================================
/*!
* \brief Export a mesh to a SAUV file
@ -3862,23 +3896,47 @@ void SMESH_Mesh_i::ExportSTL (const char *file, const bool isascii)
SMESH_CATCH( SMESH::throwCorbaException );
}
//================================================================================
/*!
* \brief Export a part of mesh to a med file
*/
//================================================================================
void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
const char* file,
CORBA::Boolean auto_groups,
CORBA::Long version,
CORBA::Boolean overwrite,
CORBA::Boolean autoDimension,
const GEOM::ListOfFields& fields,
const char* geomAssocFields,
CORBA::Double ZTolerance)
class MEDFileSpeCls
{
public:
MEDFileSpeCls(const char *file, CORBA::Boolean overwrite, CORBA::Long version):_file(file),_overwrite(overwrite),_version(version) { }
std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self) { return self.prepareMeshNameAndGroups(_file.c_str(),_overwrite); }
void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups,
SMESH_MeshPartDS* partDS,
CORBA::Boolean autoDimension, bool have0dField,
CORBA::Double ZTolerance)
{
mesh->ExportMED( _file.c_str(), aMeshName.c_str(), auto_groups, _version,
partDS, autoDimension,have0dField,ZTolerance);
}
void exportField(SMESH_Mesh_i& self, const std::string& aMeshName, bool have0dField, SMESHDS_Mesh *meshDS, const GEOM::ListOfFields& fields, const char*geomAssocFields)
{
DriverMED_W_Field fieldWriter;
fieldWriter.SetFile( _file.c_str() );
fieldWriter.SetMeshName( aMeshName );
fieldWriter.AddODOnVertices( have0dField );
self.exportMEDFields( fieldWriter, meshDS, fields, geomAssocFields );
}
void prepareForWriting(SMESH_Mesh_i& self) { self.PrepareForWriting(_file.c_str(), _overwrite); }
private:
std::string _file;
CORBA::Boolean _overwrite;
CORBA::Long _version;
};
template<class SPECLS>
void SMESH_Mesh_i::ExportPartToMEDCommon(SPECLS& speCls,
SMESH::SMESH_IDSource_ptr meshPart,
CORBA::Boolean auto_groups,
CORBA::Boolean autoDimension,
const GEOM::ListOfFields& fields,
const char* geomAssocFields,
CORBA::Double ZTolerance)
{
MESSAGE("MED version: "<< version);
SMESH_TRY;
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
@ -3924,10 +3982,8 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
if ( CORBA::is_nil( meshPart ) ||
SMESH::DownCast< SMESH_Mesh_i* >( meshPart ))
{
aMeshName = prepareMeshNameAndGroups(file, overwrite);
_impl->ExportMED( file, aMeshName.c_str(), auto_groups, version,
0, autoDimension, /*addODOnVertices=*/have0dField,
ZTolerance);
aMeshName = speCls.prepareMeshNameAndGroups(*this);
speCls.exportTo(_impl, aMeshName, auto_groups, nullptr, autoDimension, have0dField, ZTolerance);
meshDS = _impl->GetMeshDS();
}
else
@ -3935,7 +3991,7 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
PrepareForWriting(file, overwrite);
speCls.prepareForWriting(*this);
SALOMEDS::SObject_wrap SO = _gen_i->ObjectToSObject( meshPart );
if ( !SO->_is_nil() ) {
@ -3944,8 +4000,7 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
}
SMESH_MeshPartDS* partDS = new SMESH_MeshPartDS( meshPart );
_impl->ExportMED( file, aMeshName.c_str(), auto_groups, version,
partDS, autoDimension, /*addODOnVertices=*/have0dField, ZTolerance);
speCls.exportTo(_impl, aMeshName, auto_groups, partDS, autoDimension, have0dField, ZTolerance);
meshDS = tmpDSDeleter._obj = partDS;
}
@ -3953,15 +4008,32 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
if ( _impl->HasShapeToMesh() )
{
DriverMED_W_Field fieldWriter;
fieldWriter.SetFile( file );
fieldWriter.SetMeshName( aMeshName );
fieldWriter.AddODOnVertices( have0dField );
exportMEDFields( fieldWriter, meshDS, fields, geomAssocFields );
speCls.exportField(*this,aMeshName,have0dField,meshDS,fields,geomAssocFields);
}
SMESH_CATCH( SMESH::throwCorbaException );
}
//================================================================================
/*!
* \brief Export a part of mesh to a med file
*/
//================================================================================
void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
const char* file,
CORBA::Boolean auto_groups,
CORBA::Long version,
CORBA::Boolean overwrite,
CORBA::Boolean autoDimension,
const GEOM::ListOfFields& fields,
const char* geomAssocFields,
CORBA::Double ZTolerance)
{
MESSAGE("MED version: "<< version);
MEDFileSpeCls spe(file,overwrite,version);
this->ExportPartToMEDCommon<MEDFileSpeCls>(spe,meshPart,auto_groups,autoDimension,fields,geomAssocFields,ZTolerance);
// dump
SMESH_TRY;
GEOM::ListOfGBO_var goList = new GEOM::ListOfGBO;
goList->length( fields.length() );
for ( size_t i = 0; i < fields.length(); ++i )
@ -3980,10 +4052,45 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
<< ( geomAssocFields ? geomAssocFields : "" ) << "',"
<< TVar( ZTolerance )
<< " )";
SMESH_CATCH( SMESH::throwCorbaException );
}
class MEDFileMemSpeCls
{
public:
std::string prepareMeshNameAndGroups(SMESH_Mesh_i& self) { return self.generateMeshName(); }
void exportTo(SMESH_Mesh *mesh, const std::string& aMeshName, CORBA::Boolean auto_groups,
SMESH_MeshPartDS* partDS,
CORBA::Boolean autoDimension, bool have0dField,
CORBA::Double ZTolerance)
{
_res = mesh->ExportMEDCoupling(aMeshName.c_str(),auto_groups,partDS,autoDimension,have0dField,ZTolerance);
}
void prepareForWriting(SMESH_Mesh_i& self) { /* nothing here */ }
void exportField(SMESH_Mesh_i& self, const std::string& aMeshName, bool have0dField, SMESHDS_Mesh *meshDS, const GEOM::ListOfFields& fields, const char*geomAssocFields)
{
THROW_IK_EXCEPTION("exportField Not implemented yet for full memory !");
}
public:
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> getData() { return _res; }
private:
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> _res;
};
CORBA::LongLong SMESH_Mesh_i::ExportPartToMEDCoupling(SMESH::SMESH_IDSource_ptr meshPart,
CORBA::Boolean auto_groups,
CORBA::Boolean autoDimension,
const GEOM::ListOfFields& fields,
const char* geomAssocFields,
CORBA::Double ZTolerance)
{
MEDFileMemSpeCls spe;
this->ExportPartToMEDCommon<MEDFileMemSpeCls>(spe,meshPart,auto_groups,autoDimension,fields,geomAssocFields,ZTolerance);
MEDCoupling::MCAuto<MEDCoupling::DataArrayByte> res( spe.getData() );
MEDCoupling::DataArrayByte *ret(res.retn());
return reinterpret_cast<CORBA::LongLong>(ret);
}
//================================================================================
/*!
* Write GEOM fields to MED file

View File

@ -212,6 +212,10 @@ public:
CORBA::Boolean overwrite,
CORBA::Boolean autoDimension = true);
CORBA::LongLong ExportMEDCoupling(CORBA::Boolean auto_groups,
CORBA::Boolean autoDimension = true
);
void ExportSAUV( const char* file, CORBA::Boolean auto_groups );
void ExportDAT( const char* file );
@ -225,6 +229,16 @@ public:
const char* file,
CORBA::Boolean withRequiredGroups);
template<class SPECLS>
void ExportPartToMEDCommon(SPECLS& speCls,
SMESH::SMESH_IDSource_ptr meshPart,
CORBA::Boolean auto_groups,
CORBA::Boolean autoDim,
const GEOM::ListOfFields& fields,
const char* geomAssocFields,
CORBA::Double ZTolerance);
void ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
const char* file,
CORBA::Boolean auto_groups,
@ -234,6 +248,14 @@ public:
const GEOM::ListOfFields& fields,
const char* geomAssocFields,
CORBA::Double ZTolerance);
CORBA::LongLong ExportPartToMEDCoupling(SMESH::SMESH_IDSource_ptr meshPart,
CORBA::Boolean auto_groups,
CORBA::Boolean autoDim,
const GEOM::ListOfFields& fields,
const char* geomAssocFields,
CORBA::Double ZTolerance);
void ExportPartToDAT(SMESH::SMESH_IDSource_ptr meshPart,
const char* file);
void ExportPartToUNV(SMESH::SMESH_IDSource_ptr meshPart,
@ -626,14 +648,9 @@ public:
std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
std::map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI
private:
public:
std::string generateMeshName( );
std::string prepareMeshNameAndGroups( const char* file, CORBA::Boolean overwrite );
/*!
* Check and correct names of mesh groups
*/
void checkGroupNames();
/*
* Write GEOM fields to MED file
*/
@ -641,6 +658,12 @@ private:
SMESHDS_Mesh* meshDS,
const GEOM::ListOfFields& fields,
const char* geomAssocFields);
private:
/*!
* Check and correct names of mesh groups
*/
void checkGroupNames();
/*!
* Convert submesh ids into submesh interfaces
*/

View File

@ -2299,6 +2299,69 @@ class Mesh(metaclass = MeshMeta):
self.mesh.RemoveHypothesis( self.geom, hyp )
pass
pass
def ExportMEDCoupling(self, *args, **kwargs):
"""
Export the mesh in a memory representation.
Parameters:
auto_groups (boolean): parameter for creating/not creating
the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
the typical use is auto_groups=False.
overwrite (boolean): parameter for overwriting/not overwriting the file
meshPart: a part of mesh (:class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`) to export instead of the mesh
autoDimension: if *True* (default), a space dimension of a MED mesh can be either
- 1D if all mesh nodes lie on OX coordinate axis, or
- 2D if all mesh nodes lie on XOY coordinate plane, or
- 3D in the rest cases.
If *autoDimension* is *False*, the space dimension is always 3.
fields: list of GEOM fields defined on the shape to mesh.
geomAssocFields: each character of this string means a need to export a
corresponding field; correspondence between fields and characters
is following:
- 'v' stands for "_vertices_" field;
- 'e' stands for "_edges_" field;
- 'f' stands for "_faces_" field;
- 's' stands for "_solids_" field.
zTolerance (float): tolerance in Z direction. If Z coordinate of a node is
close to zero within a given tolerance, the coordinate is set to zero.
If *ZTolerance* is negative (default), the node coordinates are kept as is.
"""
auto_groups = args[0] if len(args) > 0 else False
meshPart = args[1] if len(args) > 1 else None
autoDimension = args[2] if len(args) > 2 else True
fields = args[3] if len(args) > 3 else []
geomAssocFields = args[4] if len(args) > 4 else ''
z_tolerance = args[5] if len(args) > 5 else -1.
# process keywords arguments
auto_groups = kwargs.get("auto_groups", auto_groups)
meshPart = kwargs.get("meshPart", meshPart)
autoDimension = kwargs.get("autoDimension", autoDimension)
fields = kwargs.get("fields", fields)
geomAssocFields = kwargs.get("geomAssocFields", geomAssocFields)
z_tolerance = kwargs.get("zTolerance", z_tolerance)
# invoke engine's function
if meshPart or fields or geomAssocFields or z_tolerance > 0:
unRegister = genObjUnRegister()
if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
unRegister.set( meshPart )
z_tolerance,Parameters,hasVars = ParseParameters(z_tolerance)
self.mesh.SetParameters(Parameters)
return self.mesh.ExportPartToMEDCoupling(meshPart, auto_groups, autoDimension, fields, geomAssocFields, z_tolerance)
else:
intPtr = self.mesh.ExportMEDCoupling(auto_groups, autoDimension)
import medcoupling
dab = medcoupling.FromPyIntPtrToDataArrayByte(intPtr)
return medcoupling.MEDFileMesh.New(dab)
def ExportMED(self, *args, **kwargs):
"""
Export the mesh in a file in MED format

View File

@ -29,6 +29,7 @@ INCLUDE_DIRECTORIES(
${Boost_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${GEOM_INCLUDE_DIRS}
${MEDCOUPLING_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/SMESHUtils
${PROJECT_SOURCE_DIR}/src/SMESH
${PROJECT_SOURCE_DIR}/src/SMESHDS

View File

@ -32,6 +32,7 @@ INCLUDE_DIRECTORIES(
${Boost_INCLUDE_DIRS}
${QWT_INCLUDE_DIR}
${OMNIORB_INCLUDE_DIR}
${MEDCOUPLING_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/SMESH
${PROJECT_SOURCE_DIR}/src/SMESHUtils
${PROJECT_SOURCE_DIR}/src/SMESH_I

View File

@ -27,6 +27,7 @@ INCLUDE_DIRECTORIES(
${MEDFILE_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${MEDCOUPLING_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/SMESHImpl
${PROJECT_SOURCE_DIR}/src/SMESH
${PROJECT_SOURCE_DIR}/src/SMESHUtils

View File

@ -22,7 +22,8 @@
# scripts / static
SET(plugin_SCRIPTS
__init__.py
cubeAngle2.py
blocFissureTest.py
cubeAngle_2.py
cubeAngle.py
cubeCoin.py
cubeMilieu.py
@ -35,7 +36,6 @@ SET(plugin_SCRIPTS
eprouvetteCourbe.py
eprouvetteDroite_2.py
eprouvetteDroite.py
execution_Cas.py
faceGauche_2.py
faceGauche.py
fissureCoude_10.py

View File

@ -0,0 +1,522 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2021 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
__revision__ = "V03.02"
"""Lancement des cas-tests de blocFissure
Temps par type de matériel :
. cubeAngle : 24s ["cubeAngle", "cubeAngle_2"])
. cubeFin : 42s ["cubeCoin", "cubeMilieu", "cubeTransverse"]
. decoupeCylindre : 8s ["cylindre", "cylindre_2"]
. disquePerce (+ ellipse_disque) : 9s ["disquePerce"]
. fissureGauche : 26s ["faceGauche"]
. fissureGauche_2 (+ ellipse + ellipse_probleme): 22s ["ellipse_1", "ellipse_2", "faceGauche_2"]
. eprouvetteCourbe : 22s ["eprouvetteCourbe"]
. eprouvetteDroite : 31s ["eprouvetteDroite", "eprouvetteDroite_2"]
. vis : 9s ["vis"]
. tube : ["tube"]
. sans matériel : 66s ["fissureCoude_1", "fissureCoude_2", "fissureCoude_3", "fissureCoude_4", "fissureCoude_5"]
. sans matériel : 69s ["fissureCoude_6", "fissureCoude_7", "fissureCoude_8", "fissureCoude_9", "fissureCoude_10"]
. sans matériel : 28s ["fissure_Coude", "fissure_Coude_4"]
"""
import logging
import os
import sys
import tempfile
import traceback
from blocFissure.gmu import initLog
from blocFissure.gmu.casStandard import casStandard
# -----------------------------------------------------------------------------------------------
LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log")
#initLog.setDebug(LOGFILE) # debug = 10
#initLog.setVerbose(LOGFILE) # info = 20
#initLog.setRelease(LOGFILE) # warning = 30
#initLog.setPerfTests(LOGFILE) # critical = 50
#initLog.setAlways(LOGFILE) # critical = 50
# Les cas qui marchent ...
TORUNOK = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ] # OK 19/04/2021
# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
TORUNPB = list()
for IAUX in TORUNOK:
TORUNPB.append((IAUX+1)%2)
print ("TORUN = {} # OK".format(TORUNOK))
print ("TORUN = {} # PB".format(TORUNPB))
# Numéro de référence associé à chaque problème défini par le nom de son fichier dans le répertoire CasTests
NREF_PB = dict()
NREF_PB["cubeAngle"] = 0
NREF_PB["cubeAngle_2"] = 1
NREF_PB["cubeCoin"] = 2
NREF_PB["cubeMilieu"] = 3
NREF_PB["cubeTransverse"] = 4
NREF_PB["cylindre"] = 5
NREF_PB["cylindre_2"] = 6
NREF_PB["disquePerce"] = 7
NREF_PB["ellipse_1"] = 8
NREF_PB["ellipse_2"] = 9
NREF_PB["eprouvetteCourbe"] = 10
NREF_PB["eprouvetteDroite"] = 11
NREF_PB["eprouvetteDroite_2"] = 12
NREF_PB["faceGauche"] = 13
NREF_PB["faceGauche_2"] = 14
NREF_PB["fissureCoude_1"] = 15
NREF_PB["fissureCoude_2"] = 16
NREF_PB["fissureCoude_3"] = 17
NREF_PB["fissureCoude_4"] = 18
NREF_PB["fissureCoude_5"] = 19
NREF_PB["fissureCoude_6"] = 20
NREF_PB["fissureCoude_7"] = 21
NREF_PB["fissureCoude_8"] = 22
NREF_PB["fissureCoude_9"] = 23
NREF_PB["fissureCoude_10"] = 24
NREF_PB["fissure_Coude"] = 25
NREF_PB["fissure_Coude_4"] = 26
NREF_PB["vis_1"] = 27
NREF_PB["tube"] = 28
#========================= Début de la classe ===================================
class blocFissureTest (object):
"""Test de blocFissure
Options facultatives
********************
Le(s) numéro/nom du/des tests à passer. Si aucun n'est donné, tous les cas sont passés.
"""
# A. La base
message_info = ""
_verbose = 0
_verbose_max = 0
affiche_aide_globale = 0
# B. Les variables
l_cas = None
l_problemes = None
d_nom_probleme = None
l_materiels = None
#=========================== Début de la méthode =================================
def __init__ ( self, liste_option ):
"""Le constructeur de la classe blocFissureTest"""
self.l_cas = list()
erreur = False
for option in liste_option :
#print (option, type(option))
if isinstance(option, str):
saux = option.upper()
else:
saux = option
#print (saux)
# Options générales de pilotage
if saux in ( "-H", "-HELP" ):
self.affiche_aide_globale = 1
elif saux == "-V" :
self._verbose = 1
elif saux == "-VMAX" :
self._verbose = 1
self._verbose_max = 1
else :
# Options du traitement
if isinstance(option, int):
self.l_cas.append(option)
elif ( option in NREF_PB ):
self.l_cas.append(NREF_PB[option])
else:
print ("Option inconnue : {}".format(option))
erreur = True
# Si aucun cas n'est donné, on prend tous ceux par défaut
if not self.l_cas:
for i_aux, valeur in enumerate(TORUNOK):
if valeur:
self.l_cas.append(i_aux)
if erreur:
self.l_cas = list()
if self._verbose_max:
print ("Liste des cas : {}".format(self.l_cas))
if self._verbose_max:
initLog.setVerbose(LOGFILE) # info = 20
#=========================== Fin de la méthode ==================================
#=========================== Début de la méthode =================================
def __del__(self):
"""A la suppression de l'instance de classe"""
if self._verbose_max:
print ("Suppression de l'instance de la classe.")
#=========================== Fin de la méthode ==================================
#=========================== Début de la méthode =================================
def caract_l_problemes (self):
"""Caractérisation des problèmes"""
self.d_nom_probleme = dict()
self.l_problemes = list()
self.l_materiels = list()
n_cas = 0
if n_cas in self.l_cas:
from blocFissure.CasTests.cubeAngle import cubeAngle
self.l_problemes.append(cubeAngle(n_cas))
self.l_materiels.append("cubeAngle")
n_cas = 1
if n_cas in self.l_cas:
from blocFissure.CasTests.cubeAngle_2 import cubeAngle_2
self.l_problemes.append(cubeAngle_2(n_cas))
self.l_materiels.append("cubeAngle")
n_cas = 2
if n_cas in self.l_cas:
from blocFissure.CasTests import cubeCoin
self.l_problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, n_cas))
self.d_nom_probleme[n_cas] = "cubeCoin"
self.l_materiels.append("cubeFin")
n_cas = 3
if n_cas in self.l_cas:
from blocFissure.CasTests import cubeMilieu
self.l_problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, n_cas))
self.d_nom_probleme[n_cas] = "cubeMilieu"
self.l_materiels.append("cubeFin")
n_cas = 4
if n_cas in self.l_cas:
from blocFissure.CasTests import cubeTransverse
self.l_problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, n_cas))
self.d_nom_probleme[n_cas] = "cubeTransverse"
self.l_materiels.append("cubeFin")
n_cas = 5
if n_cas in self.l_cas:
from blocFissure.CasTests.cylindre import cylindre
self.l_problemes.append(cylindre(n_cas))
self.l_materiels.append("decoupeCylindre")
n_cas = 6
if n_cas in self.l_cas:
from blocFissure.CasTests.cylindre_2 import cylindre_2
self.l_problemes.append(cylindre_2(n_cas))
self.l_materiels.append("decoupeCylindre")
n_cas = 7
if n_cas in self.l_cas:
from blocFissure.CasTests import disquePerce
self.l_problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, n_cas))
self.d_nom_probleme[n_cas] = "disquePerce"
self.l_materiels.append("disquePerce")
self.l_materiels.append("ellipse_disque")
n_cas = 8
if n_cas in self.l_cas:
from blocFissure.CasTests.ellipse_1 import ellipse_1
self.l_problemes.append(ellipse_1(n_cas))
self.l_materiels.append("ellipse")
self.l_materiels.append("fissureGauche_2")
n_cas = 9
if n_cas in self.l_cas:
from blocFissure.CasTests.ellipse_2 import ellipse_2
self.l_problemes.append(ellipse_2(n_cas))
self.l_materiels.append("ellipse_probleme")
self.l_materiels.append("fissureGauche_2")
n_cas = 10
if n_cas in self.l_cas:
from blocFissure.CasTests.eprouvetteCourbe import eprouvetteCourbe
self.l_problemes.append(eprouvetteCourbe(n_cas))
self.l_materiels.append("eprouvetteCourbe")
n_cas = 11
if n_cas in self.l_cas:
from blocFissure.CasTests.eprouvetteDroite import eprouvetteDroite
self.l_problemes.append(eprouvetteDroite(n_cas))
self.l_materiels.append("eprouvetteDroite")
n_cas = 12
if n_cas in self.l_cas:
from blocFissure.CasTests.eprouvetteDroite_2 import eprouvetteDroite_2
self.l_problemes.append(eprouvetteDroite_2(n_cas))
self.l_materiels.append("eprouvetteDroite")
n_cas = 13
if n_cas in self.l_cas:
from blocFissure.CasTests.faceGauche import faceGauche
self.l_problemes.append(faceGauche(n_cas))
self.l_materiels.append("fissureGauche")
n_cas = 14
if n_cas in self.l_cas:
from blocFissure.CasTests.faceGauche_2 import faceGauche_2
self.l_problemes.append(faceGauche_2(n_cas))
self.l_materiels.append("fissureGauche_2")
n_cas = 15
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_1 import fissureCoude_1
self.l_problemes.append(fissureCoude_1(n_cas))
n_cas = 16
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_2 import fissureCoude_2
self.l_problemes.append(fissureCoude_2(n_cas))
n_cas = 17
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_3 import fissureCoude_3
self.l_problemes.append(fissureCoude_3(n_cas))
n_cas = 18
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_4 import fissureCoude_4
self.l_problemes.append(fissureCoude_4(n_cas))
n_cas = 19
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_5 import fissureCoude_5
self.l_problemes.append(fissureCoude_5(n_cas))
n_cas = 20
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_6 import fissureCoude_6
self.l_problemes.append(fissureCoude_6(n_cas))
n_cas = 21
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_7 import fissureCoude_7
self.l_problemes.append(fissureCoude_7(n_cas))
n_cas = 22
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_8 import fissureCoude_8
self.l_problemes.append(fissureCoude_8(n_cas))
n_cas = 23
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_9 import fissureCoude_9
self.l_problemes.append(fissureCoude_9(n_cas))
n_cas = 24
if n_cas in self.l_cas:
from blocFissure.CasTests.fissureCoude_10 import fissureCoude_10
self.l_problemes.append(fissureCoude_10(n_cas))
n_cas = 25
if n_cas in self.l_cas:
from blocFissure.CasTests.fissure_Coude import fissure_Coude
self.l_problemes.append(fissure_Coude(n_cas))
n_cas = 26
if n_cas in self.l_cas:
from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
self.l_problemes.append(fissure_Coude_4(n_cas))
n_cas = 27
if n_cas in self.l_cas:
# genereMateriel : vis
from blocFissure.CasTests.vis_1 import vis_1
self.l_problemes.append(vis_1(n_cas))
self.l_materiels.append("vis")
n_cas = 28
if n_cas in self.l_cas:
# genereMateriel : tube
from blocFissure.CasTests.tube import tube
self.l_problemes.append(tube(n_cas))
self.l_materiels.append("tube")
#"Mesh_13" has not been computed:
#- "algo2d_facePeau_0" failed on "FACE_12 to mesh". Error: Algorithm failed. NgException at Surface meshing: Problem in Surface mesh generation
#- "algo1d_cercle1_0" failed on EDGE #20. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
#- "algo1d_cercle1_0" failed on EDGE #17. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
#- "algo1d_cercle1_0" failed on EDGE #15. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
#- "algo1d_cercle1_0" failed on EDGE #12. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
return
#=========================== Fin de la méthode ==================================
#=========================== Début de la méthode =================================
def cree_materiels (self):
"""Création des matériels"""
if "cubeAngle" in self.l_materiels:
from blocFissure.materielCasTests import cubeAngle
if "cubeFin" in self.l_materiels:
from blocFissure.materielCasTests import cubeFin
if "decoupeCylindre" in self.l_materiels:
from blocFissure.materielCasTests import decoupeCylindre
if "disquePerce" in self.l_materiels:
from blocFissure.materielCasTests import disquePerce
if "ellipse_disque" in self.l_materiels:
from blocFissure.materielCasTests import ellipse_disque
if "ellipse_probleme" in self.l_materiels:
from blocFissure.materielCasTests import ellipse_probleme
if "ellipse" in self.l_materiels:
from blocFissure.materielCasTests import ellipse
if "fissureGauche" in self.l_materiels:
from blocFissure.materielCasTests import fissureGauche
if "fissureGauche_2" in self.l_materiels:
from blocFissure.materielCasTests import fissureGauche_2
if "eprouvetteCourbe" in self.l_materiels:
from blocFissure.materielCasTests import eprouvetteCourbe
if "eprouvetteDroite" in self.l_materiels:
from blocFissure.materielCasTests import eprouvetteDroite
if "vis" in self.l_materiels:
from blocFissure.materielCasTests import vis
if "tube" in self.l_materiels:
from blocFissure.materielCasTests import tube
return
#=========================== Fin de la méthode ==================================
#=========================== Début de la méthode =================================
def calcul_cas (self, n_cas, cas, ligne):
"""Calcul d'un cas"""
texte = ""
if n_cas in self.d_nom_probleme:
nom = self.d_nom_probleme[n_cas]
else:
nom = cas.nomProbleme
texte_a = "\n=== Exécution du cas n° {}, '{}'".format(NREF_PB[nom],nom)
logging.critical(ligne+texte_a)
try:
ok_maillage = cas.executeProbleme()
except:
traceback.print_exc()
ok_maillage = False
if not ok_maillage:
texte = "Problème avec le cas n° {}, '{}'\n".format(NREF_PB[nom],nom)
print(ligne)
return ok_maillage, texte
#=========================== Fin de la méthode ==================================
#=========================== Début de la méthode =================================
def calcul_tout (self):
"""Calcul de tous les cas"""
ligne = "---------------------------------------------------------------------"
texte = "\n"
nb_cas_ok = 0
nb_cas_nook = 0
for n_cas, cas in enumerate(self.l_problemes):
#print ("Cas n° {}, '{}'".format(n_cas,cas.nomProbleme))
ok_maillage, texte_a = self.calcul_cas (n_cas, cas, ligne)
texte += texte_a
if ok_maillage:
nb_cas_ok += 1
else:
nb_cas_nook += 1
print(ligne)
nb_cas = nb_cas_nook + nb_cas_ok
if ( nb_cas > 1):
if nb_cas_nook:
texte += ". Nombre de cas_tests OK : {}\n".format(nb_cas_ok)
texte += ". Nombre de cas_tests NOOK : {}\n".format(nb_cas_nook)
else:
texte += "Les {} tests se sont bien passés.\n".format(nb_cas)
print (texte+ligne)
logging.critical(ligne+texte)
return texte
#=========================== Fin de la méthode ==================================
#=========================== Début de la méthode =================================
def lancement (self):
"""Lancement général"""
# Tri des problèmes
self.caract_l_problemes ()
# Création des matériels
self.cree_materiels ()
# Calcul des fissures
texte = self.calcul_tout ()
return texte
#=========================== Fin de la méthode ==================================
#========================== Fin de la classe ====================================
#==================================================================================
# Lancement
#==================================================================================
if __name__ == "__main__" :
# 1. Options
L_OPTIONS = sys.argv[1:]
L_OPTIONS.append("-v")
# 2. Lancement de la classe
#print ("L_OPTIONS :", L_OPTIONS)
BLOCFISSURE_TEST = blocFissureTest(L_OPTIONS)
if BLOCFISSURE_TEST.affiche_aide_globale:
sys.stdout.write(BLOCFISSURE_TEST.__doc__+"\n")
else:
TEXTE = BLOCFISSURE_TEST.lancement()
sys.stdout.write(TEXTE)
del BLOCFISSURE_TEST

View File

@ -23,13 +23,13 @@ import os
from .cubeAngle import cubeAngle
class cubeAngle2(cubeAngle):
class cubeAngle_2(cubeAngle):
"""problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan
detection d'un probleme de tolerance sur les edges de jonction pipe et face fissure externe
"""
nomProbleme = "cubeAngle2"
nomProbleme = "cubeAngle_2"
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):

View File

@ -33,7 +33,7 @@ from .cylindre import cylindre
class cylindre_2(cylindre):
"""problème de fissure plane sur cylindre hexa, fond de fissure complexe : polyline"""
nomProbleme = "cylindre2"
nomProbleme = "cylindre_2"
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \

View File

@ -23,8 +23,8 @@
import os
from blocFissure import gmu
dicoParams = dict(nomCas = 'disque',
nomProbleme = "disque",
dicoParams = dict(nomCas = 'disquePerce',
nomProbleme = "disquePerce",
maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "disque.med"),
CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_disque.brep"),
edgeFiss = [3],

View File

@ -34,7 +34,7 @@ from blocFissure.gmu.putName import putName
class ellipse_1(fissureGenerique):
"""problème de fissure non plane, débouchante non normale"""
nomProbleme = "ellipse1"
nomProbleme = "ellipse_1"
shapeFissureParams = dict()
maillageFissureParams = dict()
referencesMaillageFissure = dict()
@ -78,7 +78,7 @@ class ellipse_1(fissureGenerique):
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1.brep"))
shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_1.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [3])
geompy.addToStudy( shellFiss, 'shellFiss' )

View File

@ -32,7 +32,7 @@ from .ellipse_1 import ellipse_1
class ellipse_2(ellipse_1):
"""problème de fissure non plane, débouchante non normale"""
nomProbleme = "ellipse2"
nomProbleme = "ellipse_2"
# ---------------------------------------------------------------------------
def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
@ -43,7 +43,7 @@ class ellipse_2(ellipse_1):
lgInfluence = shapeFissureParams['lgInfluence']
shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1_pb.brep"))
shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_1_pb.brep"))
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [3])
geompy.addToStudy( shellFiss, 'shellFiss' )

View File

@ -1,302 +0,0 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2021 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
"""Lancement des cas-tests de blocFissure"""
import logging
import os
import tempfile
import traceback
from blocFissure.gmu import initLog
from blocFissure.gmu.casStandard import casStandard
# -----------------------------------------------------------------------------------------------
LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log")
#initLog.setDebug(LOGFILE) # debug = 10
#initLog.setVerbose(LOGFILE) # info = 20
#initLog.setRelease(LOGFILE) # warning = 30
#initLog.setPerfTests(LOGFILE) # critical = 50
#initLog.setAlways(LOGFILE) # critical = 50
# ---tous les cas en séquence, ou les cas sélectionnés ...
TORUNOK = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ] # OK 19/04/2021
# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
#RUNALL = False
RUNALL = True
if RUNALL:
TORUN = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
TORUN = TORUNOK
else:
TORUNPB = list()
for IAUX in TORUNOK:
TORUNPB.append((IAUX+1)%2)
print ("TORUN = {} # OK".format(TORUNOK))
print ("TORUN = {} # PB".format(TORUNPB))
# genereMateriel
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] # aucun
TORUN = [ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # cubeAngle
TORUN = [ 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # cubeFin
TORUN = [ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # decoupeCylindre
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # disque_perce + ellipse_disque
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # ellipse + fissureGauche2
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # ellipse_probleme + fissureGauche2
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # eprouvetteCourbe
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # eprouvetteDroite
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # fissureGauche
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # fissureGauche2
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0] # vis
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] # tube
# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
TORUN = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0] # OK
# -----------------------------------------------------------------------------------------------
def caract_l_problemes ():
"""Caractérisation des problèmes"""
d_aux = dict()
l_problemes = list()
n_cas = 0
# genereMateriel : cubeAngle
from blocFissure.CasTests.cubeAngle import cubeAngle
l_problemes.append(cubeAngle(n_cas))
n_cas = 1
# genereMateriel : cubeAngle
from blocFissure.CasTests.cubeAngle2 import cubeAngle2
l_problemes.append(cubeAngle2(n_cas))
n_cas = 2
# genereMateriel : cubeFin
from blocFissure.CasTests import cubeCoin
l_problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, n_cas))
d_aux[n_cas] = "cubeCoin"
n_cas = 3
# genereMateriel : cubeFin
from blocFissure.CasTests import cubeMilieu
l_problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, n_cas))
d_aux[n_cas] = "cubeMilieu"
n_cas = 4
# genereMateriel : cubeFin
from blocFissure.CasTests import cubeTransverse
l_problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, n_cas))
d_aux[n_cas] = "cubeTransverse"
n_cas = 5
# genereMateriel : decoupeCylindre
from blocFissure.CasTests.cylindre import cylindre
l_problemes.append(cylindre(n_cas))
n_cas = 6
# genereMateriel : decoupeCylindre
from blocFissure.CasTests.cylindre_2 import cylindre_2
l_problemes.append(cylindre_2(n_cas))
n_cas = 7
# genereMateriel : disque_perce
# genereMateriel : ellipse_disque
from blocFissure.CasTests import disquePerce
l_problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, n_cas))
d_aux[n_cas] = "disquePerce"
n_cas = 8
# genereMateriel: ellipse
# genereMateriel : fissureGauche2
from blocFissure.CasTests.ellipse_1 import ellipse_1
l_problemes.append(ellipse_1(n_cas))
n_cas = 9
# genereMateriel: ellipse_probleme
# genereMateriel : fissureGauche2
from blocFissure.CasTests.ellipse_2 import ellipse_2
l_problemes.append(ellipse_2(n_cas))
n_cas = 10
# genereMateriel : eprouvetteCourbe
from blocFissure.CasTests.eprouvetteCourbe import eprouvetteCourbe
l_problemes.append(eprouvetteCourbe(n_cas))
n_cas = 11
# genereMateriel : eprouvetteDroite
from blocFissure.CasTests.eprouvetteDroite import eprouvetteDroite
l_problemes.append(eprouvetteDroite(n_cas))
n_cas = 12
# genereMateriel : eprouvetteDroite
from blocFissure.CasTests.eprouvetteDroite_2 import eprouvetteDroite_2
l_problemes.append(eprouvetteDroite_2(n_cas))
n_cas = 13
# genereMateriel : fissureGauche
from blocFissure.CasTests.faceGauche import faceGauche
l_problemes.append(faceGauche(n_cas))
n_cas = 14
# genereMateriel : fissureGauche2
from blocFissure.CasTests.faceGauche_2 import faceGauche_2
l_problemes.append(faceGauche_2(n_cas))
n_cas = 15
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_1 import fissureCoude_1
l_problemes.append(fissureCoude_1(n_cas))
n_cas = 16
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_2 import fissureCoude_2
l_problemes.append(fissureCoude_2(n_cas))
n_cas = 17
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_3 import fissureCoude_3
l_problemes.append(fissureCoude_3(n_cas))
n_cas = 18
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_4 import fissureCoude_4
l_problemes.append(fissureCoude_4(n_cas))
n_cas = 19
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_5 import fissureCoude_5
l_problemes.append(fissureCoude_5(n_cas))
n_cas = 20
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_6 import fissureCoude_6
l_problemes.append(fissureCoude_6(n_cas))
n_cas = 21
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_7 import fissureCoude_7
l_problemes.append(fissureCoude_7(n_cas))
n_cas = 22
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_8 import fissureCoude_8
l_problemes.append(fissureCoude_8(n_cas))
n_cas = 23
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_9 import fissureCoude_9
l_problemes.append(fissureCoude_9(n_cas))
n_cas = 24
# genereMateriel : aucun
from blocFissure.CasTests.fissureCoude_10 import fissureCoude_10
l_problemes.append(fissureCoude_10(n_cas))
n_cas = 25
# genereMateriel : aucun
from blocFissure.CasTests.fissure_Coude import fissure_Coude
l_problemes.append(fissure_Coude(n_cas))
n_cas = 26
# genereMateriel : aucun
from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
l_problemes.append(fissure_Coude_4(n_cas))
n_cas = 27
# genereMateriel : vis
from blocFissure.CasTests.vis_1 import vis_1
l_problemes.append(vis_1(n_cas))
n_cas = 28
# genereMateriel : tube
from blocFissure.CasTests.tube import tube
l_problemes.append(tube(n_cas))
#"Mesh_13" has not been computed:
#- "algo2d_facePeau_0" failed on "FACE_12 to mesh". Error: Algorithm failed. NgException at Surface meshing: Problem in Surface mesh generation
#- "algo1d_cercle1_0" failed on EDGE #20. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
#- "algo1d_cercle1_0" failed on EDGE #17. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
#- "algo1d_cercle1_0" failed on EDGE #15. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
#- "algo1d_cercle1_0" failed on EDGE #12. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
return l_problemes, d_aux
#=============================================================
def calcul_cas (n_cas, cas, d_aux, ligne):
"""Calcul d'un cas"""
texte = ""
if n_cas in d_aux:
nom = d_aux[n_cas]
else:
nom = cas.nomProbleme
texte_a = "\n=== Exécution du cas n° {}, '{}'".format(n_cas,nom)
logging.critical(ligne+texte_a)
try:
ok_maillage = cas.executeProbleme()
except:
traceback.print_exc()
ok_maillage = False
if not ok_maillage:
texte = "Problème avec le cas n° {}, '{}'\n".format(n_cas,nom)
print(ligne)
return ok_maillage, texte
#=============================================================
def calcul_tout (l_problemes, d_aux):
"""Calcul de tous les cas"""
ligne = "---------------------------------------------------------------------"
texte = "\n"
nb_cas_ok = 0
nb_cas_nook = 0
for n_cas, cas in enumerate(l_problemes):
#print ("Cas n° {}, '{}'".format(n_cas,cas.nomProbleme))
if TORUN[n_cas]:
ok_maillage, texte_a = calcul_cas (n_cas, cas, d_aux, ligne)
texte += texte_a
if ok_maillage:
nb_cas_ok += 1
else:
nb_cas_nook += 1
print(ligne)
nb_cas = nb_cas_nook + nb_cas_ok
if ( nb_cas > 1):
if nb_cas_nook:
texte += ". Nombre de cas_tests OK : {}\n".format(nb_cas_ok)
texte += ". Nombre de cas_tests NOOK : {}\n".format(nb_cas_nook)
else:
texte += "Les {} tests se sont bien passés.\n".format(nb_cas)
print (texte+ligne)
logging.critical(ligne+texte)
return
#=============================================================
#=============================================================
while True:
L_PROBLEMES, D_AUX = caract_l_problemes()
if ( len(L_PROBLEMES) != len(TORUN) ):
TEXTE = "\nNombre de problèmes définis : {}\n".format(len(L_PROBLEMES))
TEXTE += "Longueur de la liste 'TORUN' : {}\n".format(len(TORUN))
TEXTE += "\t==> Incohérence de programmation à corriger dans {}".format(__name__)
print (TEXTE)
break
calcul_tout (L_PROBLEMES, D_AUX)
break

View File

@ -43,7 +43,7 @@ master_doc = 'index'
# General substitutions.
project = 'Plug-in blocFissure'
copyright = '2010-2021 EDF R&D'
copyright = '2010-2021 EDF'
# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -51,21 +51,21 @@ Geometrical parameters of the tore are illustrated :
:align: center
:alt: Geometrical parameters of the tore
Different levels of verbose are available. Use one of this 4 optional functions to set verbose type:
Different levels of verbose are available. The prints are located in the file ''LOGFILE''. Use one of this 4 optional functions to set verbose type:
- / **setDebug()**
- / **setDebug(LOGFILE)**
- / **setVerbose()**
- / **setVerbose(LOGFILE)**
- / **setRelease()**
- / **setRelease(LOGFILE)**
- / **setUnitTests()**
- / **setUnitTests(LOGFILE)**
**example to run in salome session**::
from blocFissure import gmu
from blocFissure.gmu import initLog
initLog.setDebug()
initLog.setDebug("/tmp/blocFissure.log")
from blocFissure.casStandard import casStandard
@ -83,6 +83,8 @@ Different levels of verbose are available. Use one of this 4 optional functions
execInstance = casStandard(dicoParams)
newmesh = execInstance.maillageFissure

View File

@ -4,96 +4,102 @@
Test cases
#######################
A base of 30 test cases guarantees the correct functioning of « Bloc Fissure ». 12 cases are dedicated to :ref:`cracked bended pipes <pipeTC>` and the others 13 are for other :ref:`generic geometries <genericTC>`. They are shown here in order to illustrate cases on which « Bloc Fissure » works.
A base of 28 test cases guarantees the correct functioning of « Bloc Fissure ». 12 cases are dedicated to :ref:`cracked bended pipes <pipeTC>` and the others 16 are for other :ref:`generic geometries <genericTC>`. They are shown here in order to illustrate cases on which « Bloc Fissure » works.
.. _genericTC:
Generic cases
===============================
All 13 cases are shown Table 2. Two views show the whole cracked structure and a zoom onto the crack with its tore.
All 16 cases are shown Table 2. Two views show the whole cracked structure and a zoom onto the crack with its tore.
+-------------------------------------------+----------------------------------------------+
| CubeAngle |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/01_CubeAngle.png | .. image:: images/01_CubeAngle_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| CubeAngle2 |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/02_CubeAngle2.png | .. image:: images/02_CubeAngle2_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| cylindre |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/03_cylindre.png | .. image:: images/03_cylindre_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| cylindre2 |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/04_cylindre2.png | .. image:: images/04_cylindre2_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| disque |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/05_disque.png | .. image:: images/05_disque_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| ellipse1 |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/06_ellipse1.png | .. image:: images/06_ellipse1_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| ellipse2 (tilted crack) |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/07_ellipse2.png | .. image:: images/07_ellipse2_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| eprouvetteCourbe |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/08_eprouvetteCourbe.png | .. image:: images/08_eprouvetteCourbe_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| eprouvetteDroite |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/09_eprouvetteDroite.png | .. image:: images/09_eprouvetteDroite_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| eprouvetteDroite2 |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/10_eprouvetteDroite2.png | .. image:: images/10_eprouvetteDroite2_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| faceGauche |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/11_faceGauche.png | .. image:: images/11_faceGauche_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| faceGauche2 |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/12_faceGauche2.png | .. image:: images/12_faceGauche2_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| vis (Crack is in the radius filet between the screw head and the screw shank) |
+-------------------------------------------+----------------------------------------------+
|.. image:: images/13_vis_1.png | .. image:: images/13_vis_1_2.png |
| :width: 400 | :width: 400 |
| :align: center | :align: center |
+-------------------------------------------+----------------------------------------------+
| tube |
+-------------------------------------------+----------------------------------------------+
+--------------------------------------------+-----------------------------------------------+
| CubeAngle |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/01_CubeAngle.png | .. image:: images/01_CubeAngle_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| CubeAngle_2 |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/02_CubeAngle_2.png | .. image:: images/02_CubeAngle_2_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| cubeCoin |
+--------------------------------------------+-----------------------------------------------+
| cubeMilieu |
+--------------------------------------------+-----------------------------------------------+
| cubeTransverse |
+--------------------------------------------+-----------------------------------------------+
| cylindre |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/03_cylindre.png | .. image:: images/03_cylindre_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| cylindre_2 |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/04_cylindre_2.png | .. image:: images/04_cylindre_2_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| disquePerce |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/05_disque.png | .. image:: images/05_disque_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| ellipse_1 |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/06_ellipse_1.png | .. image:: images/06_ellipse_1_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| ellipse_2 (tilted crack) |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/07_ellipse_2.png | .. image:: images/07_ellipse_2_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| eprouvetteCourbe |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/08_eprouvetteCourbe.png | .. image:: images/08_eprouvetteCourbe_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| eprouvetteDroite |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/09_eprouvetteDroite.png | .. image:: images/09_eprouvetteDroite_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| eprouvetteDroite_2 |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/10_eprouvetteDroite_2.png | .. image:: images/10_eprouvetteDroite_2_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| faceGauche |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/11_faceGauche.png | .. image:: images/11_faceGauche_2.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| faceGauche_2 |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/12_faceGauche_2.png | .. image:: images/12_faceGauche_2_a.png |
| :height: 300 | :height: 300 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| vis (Crack is in the radius filet between the screw head and the screw shank) |
+--------------------------------------------+-----------------------------------------------+
|.. image:: images/13_vis_1.png | .. image:: images/13_vis_1_2.png |
| :width: 400 | :width: 400 |
| :align: center | :align: center |
+--------------------------------------------+-----------------------------------------------+
| tube |
+--------------------------------------------+-----------------------------------------------+
.. _pipeTC:
@ -123,16 +129,14 @@ coude_0 can be computed using this file for the data:
« Bloc Fissure » is very efficient for the case of bended pipes. The generation of the geometry and the crack insertion takes only around 15s.
Running test cases
Data for the test cases
=====================================
All the files for these test cases are stored in the directory of the installation of SALOME:
``Salome-VXXXX_package-YY/modules/SMESH_VXXXX/lib/python3.6/site-packages/salome/blocFissure``
The test cases can be runned either through the python window of the SALOME GUI or with a python script.
0) **Generate med and breps files.**::
The set of the med, xao and brep files can be created by the following importation:
from blocFissure.materielCasTests import genereMateriel
@ -142,48 +146,36 @@ Once the files are generated, they are saved into the directory of the installat
There is no need to generate them again.
1) **To execute all test cases**::
To check the installation of salome, the test cases can be computed by the salome test process::
from blocFissure.CasTests import execution_Cas
salome -test blocFissure
2) **To execute only selected test cases**:
Running test cases
=====================================
modify the file ``CasTests/execution_Cas.py`` and change::
The test cases can be runned by the following instructions::
runall = False. #old : True
from blocFissure.CasTests.blocFissureTest import blocFissureTest
BLOCFISSURE_TEST = blocFissureTest(list_of_cases)
MESSAGE_ERREUR = BLOCFISSURE_TEST.lancement()
sys.stdout.write(MESSAGE_ERREUR)
del BLOCFISSURE_TEST
And change from 0 to 1 of the index of the test you want to launch::
If ``list_of_cases`` is an empty list, all the cases are computed.
torun = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
then launch the test cases::
from blocFissure.CasTests import execution_Cas
The index of each test is the position of the test in the following table, from 0 for cubeAngle, 1 for cubeAngle2,
2 for cubeCoin... from top to bottom, then from left to right.
If not, ``list_of_cases`` is made of the list of the numbers and/or the name of the requested case. The index of each test is the position of the test in the following table, from 0 for cubeAngle, 1 for cubeAngle_2, 2 for cubeCoin... from top to bottom, then from left to right.
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeAngle | cylindre_2 | eprouvetteDroite_2 | fissureCoude_3 | fissureCoude_9 |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeAngle2 | disquePerce | faceGauche | fissureCoude_4 | fissure_Coude |
| cubeAngle_2 | disquePerce | faceGauche | fissureCoude_4 | fissure_Coude |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeCoin | ellipse_1 | faceGauche_2 | fissureCoude_5 | fissure_Coude_4 |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeMilieu | ellipse_2 | fissureCoude_1 | fissureCoude_6 | vis_1 |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cubeTransverse | eprouvetteCourbe | fissureCoude_10 | fissureCoude_7 | tube |
| cubeTransverse | eprouvetteCourbe | fissureCoude_10 | fissureCoude_7 | |
+--------------------+--------------------+--------------------+-----------------+-----------------+
| cylindre | eprouvetteDroite | fissureCoude_2 | fissureCoude_8 | |
+--------------------+--------------------+--------------------+-----------------+-----------------+
3) **To execute only one test case**::
from blocFissure.CasTests.[TEST_CASE_NAME] import [TEST_CASE_NAME]
[TEST_CASE_NAME](0).executeProbleme()
[TEST_CASE_NAME] is the name of the test case in the previous list. Note that the test cases fissureCoude_4 and fissure_Coude_4 are very similar.

View File

@ -132,8 +132,8 @@ def construitFissureGenerale(shapesFissure, shapeFissureParams, \
# --- inventaire des faces de peau coupées par la fissure
ptEdgeFond, fsFissuExt, edFisExtPe, edFisExtPi, \
facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, ptFisExtPi, \
ptEdgeFond, fsFissuExt, edFisExtPe, edFisExtPi, facesPeaux, edCircPeau, \
gpedgeBord, gpedgeVifs, edFissPeau, ptFisExtPi, \
edgeRadFacePipePeau, facesPipePeau = \
construitFissureGenerale_b( partitionsPeauFissFond, \
edgesPipeFiss, edgesFondFiss, wireFondFiss, aretesVivesC, \
@ -201,7 +201,7 @@ def construitFissureGenerale(shapesFissure, shapeFissureParams, \
# --- maillage faces de peau
meshesFacesPeau = mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \
facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, \
facesPeaux, edCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, \
bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives, \
edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad, \
mailleur, nro_cas)

View File

@ -50,7 +50,6 @@ pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure
edFisExtPi = [ list() for _ in range(nbFacesFilling)] # pour chaque face [edge commun au pipe des faces de fissure externes]
facesPeaux = [None for _ in range(nbFacesFilling)] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
edCircPeau = [ list() for _ in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
ptCircPeau = [ list() for _ in range(nbFacesFilling)] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
gpedgeBord = [None for _ in range(nbFacesFilling)] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
gpedgeVifs = [None for _ in range(nbFacesFilling)] # pour chaque face de peau : groupes subshape des edges aux arêtes vives entre fillings
edFissPeau = [ list() for _ in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
@ -70,7 +69,6 @@ pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure
edFisExtPi[ifil] = dataPPFF['edgesFissExtPipe']
facesPeaux[ifil] = dataPPFF['facePeau']
edCircPeau[ifil] = dataPPFF['edgesCircPeau']
ptCircPeau[ifil] = dataPPFF['verticesCircPeau']
gpedgeBord[ifil] = dataPPFF['groupEdgesBordPeau']
gpedgeVifs[ifil] = dataPPFF['bordsVifs']
edFissPeau[ifil] = dataPPFF['edgesFissurePeau']
@ -87,5 +85,5 @@ pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure
geomPublish(initLog.debug, avc, name, nro_cas)
return ptEdgeFond, fsFissuExt, edFisExtPe, edFisExtPi, facesPeaux, edCircPeau, \
ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, ptFisExtPi, \
gpedgeBord, gpedgeVifs, edFissPeau, ptFisExtPi, \
edgeRadFacePipePeau, facesPipePeau

View File

@ -34,6 +34,7 @@ class fissureGenerique(object):
"""
nomProbleme = "fissureGenerique"
maillageFissure = None
geomParams = dict()
meshParams = dict()
shapeFissureParams = dict()
@ -132,10 +133,10 @@ class fissureGenerique(object):
if step == 4:
return
maillageFissure = self.genereMaillageFissure(geometriesSaines, maillagesSains, \
shapesFissure, self.shapeFissureParams, self.maillageFissureParams, \
elementsDefaut, step, mailleur)
self.maillageFissure = self.genereMaillageFissure(geometriesSaines, maillagesSains, \
shapesFissure, self.shapeFissureParams, self.maillageFissureParams, \
elementsDefaut, step, mailleur)
self.setReferencesMaillageFissure()
ok_maillage = getStatsMaillageFissure(maillageFissure, self.referencesMaillageFissure, self.maillageFissureParams)
ok_maillage = getStatsMaillageFissure(self.maillageFissure, self.referencesMaillageFissure, self.maillageFissureParams)
return ok_maillage

View File

@ -57,6 +57,6 @@ def identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSo
# --- edges de la face de peau partagées avec la face de fissure
edgesFissurePeau = identifieEdgesPeau_c(verticesPipePeau, facePeau, edgesListees, verticesCircPeau)
return (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
return (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau, \
edgesCircPeau, groupEdgesBordPeau, \
bordsVifs, edgesFissurePeau, aretesVivesCoupees)

View File

@ -32,6 +32,7 @@ def identifieEdgesPeau_a(edgesFissExtPipe, facePeau, facesPeauSorted, edgesPeauF
nro_cas=None):
"""Identification précise des edges et disques des faces de peau selon index extremité fissure"""
logging.info('start')
logging.info("Traitement des arêtes de '%s'", facePeau.GetName())
for face in facesPeauSorted[:-1]: # la ou les faces débouchantes, pas la grande face de peau
logging.debug("examen face debouchante circulaire")
@ -46,7 +47,6 @@ def identifieEdgesPeau_a(edgesFissExtPipe, facePeau, facesPeauSorted, edgesPeauF
sharedVertices = geompy.GetSharedShapesMulti([face, edgesPeauFondIn[j_aux_0]], geompy.ShapeType["VERTEX"])
nameFace = "facePipePeau_{}".format(i_aux)
nameVert = "endEdgeFond_{}".format(i_aux)
nameEdge = "edgeRadFacePipePeau_{}".format(i_aux)
facesPipePeau[i_aux] = face
endsEdgeFond[i_aux] = sharedVertices[0]
geomPublish(initLog.debug, face, nameFace, nro_cas)
@ -55,29 +55,30 @@ def identifieEdgesPeau_a(edgesFissExtPipe, facePeau, facesPeauSorted, edgesPeauF
for edge in edgesFace:
if geompy.MinDistance(edge, sharedVertices[0]) < 1e-3:
edgeRadFacePipePeau[i_aux] = edge
nameEdge = "edgeRadFacePipePeau_{}".format(i_aux)
geomPublish(initLog.debug, edge, nameEdge, nro_cas)
break
# --- edges elliptiques de la face de peau et points de jonction de la face externe de fissure
logging.info("Traitement des arêtes de '%s'", facePeau.GetName())
edgesCircPeau = [None for _ in range(len(facesPipePeau))]
verticesCircPeau = [None for _ in range(len(facesPipePeau))]
logging.info('Nombre de faces : len(facesPipePeau) = %d', len(facesPipePeau))
edgesCircPeau = list()
verticesCircPeau = list()
for i_aux,fcirc in enumerate(facesPipePeau):
logging.info(". Partage avec la face '%s'", fcirc.GetName())
# Arêtes
edges = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["EDGE"])
grpEdgesCirc = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
geompy.UnionList(grpEdgesCirc, edges)
edgesCircPeau[i_aux] = grpEdgesCirc
name = "edgeCirc_{}".format(i_aux)
geomPublishInFather(initLog.always, facePeau, grpEdgesCirc, name)
groupe = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
geompy.UnionList(groupe, edges)
geomPublishInFather(initLog.always, facePeau, groupe, "edgeCirc_{}".format(i_aux))
edgesCircPeau.append(groupe)
edgesListees = edgesListees + edges
# Sommets
vertices = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["VERTEX"])
grpVertCircPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"])
geompy.UnionList(grpVertCircPeau, vertices)
verticesCircPeau[i_aux] = grpVertCircPeau
name = "pointEdgeCirc_{}".format(i_aux)
geomPublishInFather(initLog.info, facePeau, grpVertCircPeau, name)
groupe = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"])
geompy.UnionList(groupe, vertices)
geomPublishInFather(initLog.info, facePeau, groupe, "point(s)EdgeCirc_{}".format(i_aux))
verticesCircPeau.append(groupe)
logging.info('==> Nombre de sommets : len(verticesCircPeau) = %d', len(verticesCircPeau))
logging.info("==> Nombre de groupes d'arêtes : len(edgesCircPeau) = %d", len(edgesCircPeau))
logging.info("==> Nombre de groupes de sommets : len(verticesCircPeau) = %d", len(verticesCircPeau))
return edgesCircPeau, verticesCircPeau

View File

@ -32,7 +32,9 @@ def identifieEdgesPeau_b(facePeau, edgesListees, \
"""edges de bord de la face de peau"""
logging.info('start')
# Liste des arêtes de bord
edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
logging.info('Détermination des arêtes de bord à partir des %d arêtes de fillingFaceExterne', len(edgesFilling))
edgesBords = list()
for i_aux, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge)
@ -42,18 +44,19 @@ def identifieEdgesPeau_b(facePeau, edgesListees, \
if geompy.ShapeInfo(edgepeau)['EDGE'] > 1:
logging.debug(" EDGES multiples")
l_edges = geompy.ExtractShapes(edgepeau, geompy.ShapeType["EDGE"], False)
edgesBords += l_edges
edgesListees += l_edges
edgesBords.extend(l_edges)
edgesListees.extend(l_edges)
else:
logging.debug(" EDGE")
edgesBords.append(edgepeau)
edgesListees.append(edgepeau)
logging.info('==> Nombre d arêtes de bord : len(edgesBords) = %d', len(edgesBords))
groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesBordPeau, edgesBords)
bordsVifs = None
if aretesVivesC is not None:
logging.debug("identification des bords vifs par GetInPlace")
logging.info("identification des bords vifs par GetInPlace")
bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC)
if bordsVifs is None:
logging.debug("pas d'identification des bords vifs par GetInPlace: test par distance")
@ -69,7 +72,8 @@ def identifieEdgesPeau_b(facePeau, edgesListees, \
if ( dist < 0.001 ):
edvifs.append(edge)
break
if len(edvifs) >0:
if edvifs:
logging.info('==> Nombre d arêtes de bord vif : len(edvifs) = %d', len(edvifs))
bordsVifs = geompy.CreateGroup(facePeau,geompy.ShapeType["EDGE"])
for edge in edvifs:
geompy.AddObject(bordsVifs, geompy.GetSubShapeID(facePeau, edge))

View File

@ -33,38 +33,39 @@ def identifieEdgesPeau_c(verticesPipePeau, facePeau, edgesListees, verticesCircP
logging.info('start')
logging.info("Traitement des arêtes de '%s'", facePeau.GetName())
logging.info('Nombre de sommets : len(verticesPipePeau) = %d', len(verticesPipePeau))
#logging.info('verticesPipePeau = %s', verticesPipePeau)
logging.info('Nombre de sommets : len(verticesCircPeau) = %d', len(verticesCircPeau))
#logging.info('verticesCircPeau = %s', verticesCircPeau)
edgesPeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
logging.info('Nombre total d arêtes de la peau : len(edgesPeau) = %d', len(edgesPeau))
edges = substractSubShapes(facePeau, edgesPeau, edgesListees)
edgesFissurePeau = list()
# --- au moins une extrémité du pipe sur cette face de peau
l_edge_cercle = list()
# --- au moins une extrémité du pipe sur cette face de peau : arêtes sui les prenent toutes
if verticesPipePeau:
# En premier, les edges associés aux extrémités du pipe
edgesFissurePeau = [None for _ in range(len(verticesCircPeau))]
i_aux = -1
for edge in edges:
for i_aux, vertex in enumerate(verticesCircPeau):
logging.info(".. distance %s", geompy.MinDistance(vertex, edge))
if ( ( geompy.MinDistance(vertex, edge) < 1.e-3 ) and ( edge not in edgesFissurePeau ) ):
edgesFissurePeau[i_aux] = edge
name = "edgeFissurePeau_{}".format(i_aux)
logging.info("... entrée de %s à la place %d", edge, i_aux)
geomPublishInFather(initLog.debug, facePeau, edge, name)
# Ensuite, on ajoute les edges manquantes
for edge in edges:
if edge not in edgesFissurePeau:
logging.info("... ajout")
edgesFissurePeau.append(edge)
for groupe in verticesCircPeau:
cercle = True
for id_vertex in geompy.GetObjectIDs(groupe):
vertex = geompy.GetSubShape(facePeau, [id_vertex])
distance = geompy.MinDistance(vertex, edge)
logging.info(".. distance %s", distance)
if ( distance > 1.e-3 ):
cercle = False
break
if cercle:
logging.info("... entrée de %s dans l_edge_cercle", edge)
l_edge_cercle.append(edge)
i_aux += 1
name = "edgeFissurePeauCercle_{}".format(i_aux)
geomPublishInFather(initLog.info, facePeau, edge, name)
else:
for i_aux, edge in enumerate(edges):
# --- Les arêtes n'appartenant pas aux cercles
edgesFissurePeau = list()
for i_aux, edge in enumerate(edges):
if edge not in l_edge_cercle:
edgesFissurePeau.append(edge)
name = "edgeFissurePeau{}".format(i_aux)
name = "edgeFissurePeau_{}".format(i_aux)
geomPublishInFather(initLog.debug, facePeau, edge, name)
logging.info('==> Nombre d arêtes : len(edgesFissurePeau) = %d', len(edgesFissurePeau))

View File

@ -27,10 +27,9 @@ from .trouveEdgesFissPeau import trouveEdgesFissPeau
from .identifieFacesPeau import identifieFacesPeau
from .identifieEdgesPeau import identifieEdgesPeau
def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss, \
edgesFondFiss, wireFondFiss, aretesVivesC, \
facesDefaut, centreFondFiss, rayonPipe, \
aretesVivesCoupees, \
def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, \
edgesPipeFiss, edgesFondFiss, wireFondFiss, aretesVivesC, \
facesDefaut, centreFondFiss, rayonPipe, aretesVivesCoupees, \
nro_cas=None):
"""Identification des éléments géométriques de la face de peau"""
logging.info('start')
@ -69,7 +68,8 @@ def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss
# --- identification précise des edges et disques des faces de peau selon index extremité fissure
(endsEdgeFond, facesPipePeau, edgeRadFacePipePeau, edgesCircPeau, verticesCircPeau, groupEdgesBordPeau, \
(endsEdgeFond, facesPipePeau, edgeRadFacePipePeau, \
edgesCircPeau, groupEdgesBordPeau, \
bordsVifs, edgesFissurePeau, aretesVivesCoupees) = \
identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSorted, \
edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees, \
@ -83,7 +83,6 @@ def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss
edgesFissExtPipe = edgesFissExtPipe, # pour chaque face [edge commun au pipe des faces de fissure externes]
facePeau = facePeau, # pour chaque face : la face de peau finale a mailler (percee des faces débouchantes)
edgesCircPeau = edgesCircPeau, # pour chaque face de peau : [groupe subshapes edges circulaires aux débouchés du pipe]
verticesCircPeau = verticesCircPeau, # pour chaque face de peau : [groupe subshapes points sur edges circulaires aux débouchés du pipe]
groupEdgesBordPeau = groupEdgesBordPeau, # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
bordsVifs = bordsVifs, # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
edgesFissurePeau = edgesFissurePeau, # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]

View File

@ -60,7 +60,8 @@ def mailleFacesFissure(faceFissureExterne, \
hypo2d.SetQuadAllowed( 0 )
putName(hypo2d, "faceFiss", i_pref=nro_cas)
logging.info("UseExisting1DElements depuis '%s'", edgesPipeFissureExterneC.GetName())
logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \
edgesPipeFissureExterneC.GetName(), edgeFaceFissGroup.GetName())
algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC)
putName(algo1d.GetSubMesh(), "edgeFissPeau", i_pref=nro_cas)
hypo1d = algo1d.SourceEdges([ edgeFaceFissGroup ],0,0)

View File

@ -34,7 +34,7 @@ from . import initLog
from .putName import putName
def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \
facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, \
facesPeaux, edCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, \
bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives, \
edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad, \
mailleur="MeshGems", nro_cas=None):
@ -91,13 +91,13 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \
# --- edges de bord de la face de filling
filling = facesDefaut[ifil]
edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False)
groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesBordPeau, edgesFilling)
geomPublishInFather(initLog.always, filling, groupEdgesBordPeau, "EdgesBords", nro_cas)
gpedgeBord[ifil] = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"])
geompy.UnionList(gpedgeBord[ifil], edgesFilling)
geomPublishInFather(initLog.always, filling, gpedgeBord[ifil], "EdgesBords", nro_cas)
logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \
groupEdgesBordPeau.GetName(), bordsLibres.GetName())
algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
gpedgeBord[ifil].GetName(), bordsLibres.GetName())
algo1d = meshFacePeau.UseExisting1DElements(geom=gpedgeBord[ifil])
putName(algo1d.GetSubMesh(), "bordsLibres", ifil, nro_cas)
hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
putName(hypo1d, "SourceEdges_{}".format(bordsLibres.GetName()), ifil, nro_cas)
@ -105,21 +105,20 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \
else:
logging.info("face de peau %d coupée par la fissure", ifil)
edgesCircPeau = edCircPeau[ifil] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
_ = ptCircPeau[ifil] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
groupEdgesBordPeau = gpedgeBord[ifil] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
bordsVifs = gpedgeVifs[ifil] # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
edgesFissurePeau = edFissPeau[ifil] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
# edCircPeau[ifil] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
# gpedgeBord[ifil] : pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
# gpedgeVifs[ifil] : pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
# edFissPeau[ifil] : pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \
groupEdgesBordPeau.GetName(), bordsLibres.GetName())
algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
gpedgeBord[ifil].GetName(), bordsLibres.GetName())
algo1d = meshFacePeau.UseExisting1DElements(geom=gpedgeBord[ifil])
putName(algo1d.GetSubMesh(), "bordsLibres", ifil, nro_cas)
hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
putName(hypo1d, "SourceEdges_{}".format(bordsLibres.GetName()), i_pref=nro_cas)
objet = geompy.MakeCompound(edgesFissurePeau)
geomPublishInFather(initLog.always, facePeau, objet, "edgesFissurePeau")
objet = geompy.MakeCompound(edFissPeau[ifil])
geomPublishInFather(initLog.always, facePeau, objet, "edFissPeau_{}".format(ifil))
logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \
objet.GetName(), grpEdgesPeauFissureExterne.GetName())
algo1d = meshFacePeau.UseExisting1DElements(geom=objet)
@ -127,15 +126,15 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \
hypo1d = algo1d.SourceEdges([ grpEdgesPeauFissureExterne ],0,0)
putName(hypo1d, "SourceEdges_{}".format(grpEdgesPeauFissureExterne.GetName()), i_pref=nro_cas)
if bordsVifs is not None:
if gpedgeVifs[ifil] is not None:
logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \
bordsVifs.GetName(), grpAretesVives.GetName())
algo1d = meshFacePeau.UseExisting1DElements(geom=bordsVifs)
putName(algo1d.GetSubMesh(), "bordsVifs", ifil, nro_cas)
gpedgeVifs[ifil].GetName(), grpAretesVives.GetName())
algo1d = meshFacePeau.UseExisting1DElements(geom=gpedgeVifs[ifil])
putName(algo1d.GetSubMesh(), "gpedgeVifs", ifil, nro_cas)
hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0)
putName(hypo1d, "SourceEdges_{}".format(grpAretesVives.GetName()), i_pref=nro_cas)
for i_aux, edgeCirc in enumerate(edgesCircPeau):
for i_aux, edgeCirc in enumerate(edCircPeau[ifil]):
texte = "i_aux = {}".format(i_aux)
logging.info(texte)
if edgeCirc is not None:

View File

@ -25,13 +25,13 @@ SET(plugin_SCRIPTS
cubeAngle.py
cubeFin.py
decoupeCylindre.py
disque_perce.py
disquePerce.py
ellipse_disque.py
ellipse_probleme.py
ellipse.py
eprouvetteCourbe.py
eprouvetteDroite.py
fissureGauche2.py
fissureGauche_2.py
fissureGauche.py
genereMateriel.py
tube.py

View File

@ -19,7 +19,7 @@
#
"""Géométries et maillages de base nécessaires aux cas-tests :
. cubeAngle
. cubeAngle2
. cubeAngle_2
"""
import os

View File

@ -18,7 +18,7 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
"""Géométrie et maillage de base nécessaire au cas-test :
. disque_perce
. disquePerce
"""
import os

View File

@ -54,8 +54,8 @@ Scale_1 = geompy.MakeScaleAlongAxes(Rotation_1, Vertex_1, 1, 1.5, 1)
Vertex_3 = geompy.MakeVertex(420, -400, 300)
Vertex_4 = geompy.MakeVertex(500, 400, 500)
Box_1 = geompy.MakeBoxTwoPnt(Vertex_4, Vertex_3)
ellipse1 = geompy.MakeCut(Scale_1, Box_1)
[fondFiss] = geompy.SubShapes(ellipse1, [4])
ellipse_1 = geompy.MakeCut(Scale_1, Box_1)
[fondFiss] = geompy.SubShapes(ellipse_1, [4])
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
@ -69,9 +69,9 @@ geompy.addToStudy( Scale_1, 'Scale_1' )
geompy.addToStudy( Vertex_3, 'Vertex_3' )
geompy.addToStudy( Vertex_4, 'Vertex_4' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( ellipse1, 'ellipse1' )
geompy.addToStudyInFather( ellipse1, fondFiss, 'fondFiss' )
geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1.brep"))
geompy.addToStudy( ellipse_1, 'ellipse_1' )
geompy.addToStudyInFather( ellipse_1, fondFiss, 'fondFiss' )
geompy.ExportBREP(ellipse_1, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_1.brep"))
if salome.sg.hasDesktop():

View File

@ -54,7 +54,7 @@ Vertex_2 = geompy.MakeVertex(20, -100, -50)
Vertex_4 = geompy.MakeVertex(100, 100, 50)
Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_4)
Cut_1 = geompy.MakeCut(Rotation_1, Box_1)
ellipse1 = geompy.MakeTranslation(Cut_1, 400, 0, 400)
ellipse_1 = geompy.MakeTranslation(Cut_1, 400, 0, 400)
geompy.addToStudy( Disk_1, 'Disk_1' )
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
@ -68,8 +68,8 @@ geompy.addToStudy( Vertex_2, 'Vertex_2' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Vertex_4, 'Vertex_4' )
geompy.addToStudy( Cut_1, 'Cut_1' )
geompy.addToStudy( ellipse1, 'ellipse1_pb' )
geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse1_pb.brep"))
geompy.addToStudy( ellipse_1, 'ellipse_1_pb' )
geompy.ExportBREP(ellipse_1, os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_1_pb.brep"))
if salome.sg.hasDesktop():

View File

@ -21,13 +21,13 @@
from blocFissure.materielCasTests import cubeAngle
from blocFissure.materielCasTests import cubeFin
from blocFissure.materielCasTests import decoupeCylindre
from blocFissure.materielCasTests import disque_perce
from blocFissure.materielCasTests import disquePerce
from blocFissure.materielCasTests import ellipse_disque
from blocFissure.materielCasTests import ellipse
from blocFissure.materielCasTests import ellipse_probleme
from blocFissure.materielCasTests import eprouvetteCourbe
from blocFissure.materielCasTests import eprouvetteDroite
from blocFissure.materielCasTests import fissureGauche
from blocFissure.materielCasTests import fissureGauche2
from blocFissure.materielCasTests import fissureGauche_2
from blocFissure.materielCasTests import vis
from blocFissure.materielCasTests import tube

View File

@ -26,6 +26,7 @@ INCLUDE_DIRECTORIES(
${Boost_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${MEDCOUPLING_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/SMESH
${PROJECT_SOURCE_DIR}/src/SMESH_I
${PROJECT_SOURCE_DIR}/src/SMESHDS