SET(${PROJECT_NAME_UC}_PATCH_VERSION 1)
SET(${PROJECT_NAME_UC}_VERSION
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
-SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
+SET(${PROJECT_NAME_UC}_VERSION_DEV 2)
# Find KERNEL
# ===========
#
SALOME_CONFIGURE_FILE(VERSION.in VERSION INSTALL ${SALOME_INSTALL_BINS})
+
+# scripts / static / binaries
+# temporary standalone project version of mg-tetra_hpc.exe
+SET(_bin_SCRIPTS
+ mg-tetra_hpc.bash
+ mg-tetra_hpc.exe_Linux_64_avril2014
+ meshgems_mpi.c
+ meshgems_mpi.h
+)
+
+# --- rules ---
+SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_BINS})
--- /dev/null
+/*
+ * Copyright 2009-2013 Distene SAS
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "meshgems_mpi.h"
+
+#include <mpi.h>
+
+static MPI_Datatype *meshgems_mpi_datatype_map = NULL;
+static MPI_Op *meshgems_mpi_op_map = NULL;
+static int meshgems_mpi_datatype_count = 0;
+static int meshgems_mpi_op_count = 0;
+
+struct meshgems_mpi_handler_
+{
+ MPI_Request rq;
+};
+
+/* note : MPI standard states that a MPI_Datatype is a simple type (pointer or int) */
+
+static inline int meshgems_mpi_find_type(meshgems_mpi_datatype datatype, MPI_Datatype *odt)
+{
+ if(meshgems_mpi_datatype_map && datatype > 0 && datatype <= meshgems_mpi_datatype_count) {
+ *odt = meshgems_mpi_datatype_map[datatype];
+ return MESHGEMS_MPI_SUCCESS;
+ }
+
+ return MESHGEMS_MPI_ERR;
+}
+
+int meshgems_mpi_type_new(int count, int *array_of_blocklengths, long *array_of_displacements,
+ meshgems_mpi_datatype *array_of_types, meshgems_mpi_datatype *newtype)
+{
+ MPI_Datatype nt, *aot;
+ MPI_Aint *aod;
+ int ret, r, i;
+ void *t;
+
+ ret = MESHGEMS_MPI_SUCCESS;
+
+ aot = (MPI_Datatype *) calloc(count, sizeof(MPI_Datatype));
+ aod = (MPI_Aint *) calloc(count, sizeof(MPI_Aint));
+ if(!aot || !aod) {
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+
+ for(i = 0;i < count;i++) {
+ /*
+ r = meshgems_mpi_find_type(array_of_types[i], aot+i);
+ if(r != MESHGEMS_MPI_SUCCESS){
+ ret = r;
+ goto out;
+ }
+ */
+ aot[i] = meshgems_mpi_datatype_map[array_of_types[i]];
+ aod[i] = (MPI_Aint) array_of_displacements[i];
+ }
+
+ r = MPI_Type_create_struct(count, array_of_blocklengths, aod, aot, &nt);
+ /* With MPI1 you can use :
+ r = MPI_Type_struct(count, array_of_blocklengths,
+ aod, aot, &nt);
+ */
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+ r = MPI_Type_commit(&nt);
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+
+ meshgems_mpi_datatype_count++;
+ t = realloc(meshgems_mpi_datatype_map, (meshgems_mpi_datatype_count + 1) * sizeof(MPI_Datatype));
+ if(!t) {
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+ meshgems_mpi_datatype_map = (MPI_Datatype *) t;
+ meshgems_mpi_datatype_map[meshgems_mpi_datatype_count] = nt;
+ *newtype = meshgems_mpi_datatype_count;
+
+ out: if(aod)
+ free(aod);
+ if(aot)
+ free(aot);
+
+ return ret;
+}
+
+int meshgems_mpi_type_delete(meshgems_mpi_datatype datatype)
+{
+ /* no op for now */
+ return MESHGEMS_MPI_SUCCESS;
+}
+
+int meshgems_mpi_init(int *argc, char ***argv)
+{
+ int ret;
+
+ ret = MESHGEMS_MPI_SUCCESS;
+
+ meshgems_mpi_datatype_map = calloc(meshgems_mpi_datatype_enum_count, sizeof(MPI_Datatype));
+ meshgems_mpi_op_map = calloc(meshgems_mpi_op_enum_count, sizeof(MPI_Op));
+ if(!meshgems_mpi_datatype_map || !meshgems_mpi_op_map) {
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+ meshgems_mpi_datatype_count = meshgems_mpi_datatype_enum_count - 1;
+ meshgems_mpi_op_count = meshgems_mpi_op_enum_count - 1;
+
+ if(sizeof(int) == 4) {
+ meshgems_mpi_datatype_map[meshgems_mpi_datatype_i4] = MPI_INT;
+ } else if(sizeof(int) == 4) {
+ meshgems_mpi_datatype_map[meshgems_mpi_datatype_i4] = MPI_SHORT;
+ } else {
+ fprintf(stderr, "Unable to find mpi type for 4 bytes integer\n");
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+
+ if(sizeof(int) == 8) {
+ meshgems_mpi_datatype_map[meshgems_mpi_datatype_i8] = MPI_INT;
+ } else if(sizeof(long) == 8) {
+ meshgems_mpi_datatype_map[meshgems_mpi_datatype_i8] = MPI_LONG;
+ } else if(sizeof(long long) == 8) {
+ meshgems_mpi_datatype_map[meshgems_mpi_datatype_i8] = MPI_LONG_LONG;
+ } else {
+ fprintf(stderr, "Unable to find mpi type for 8 bytes integer\n");
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+
+ if(sizeof(float) == 4) {
+ meshgems_mpi_datatype_map[meshgems_mpi_datatype_r4] = MPI_FLOAT;
+ } else {
+ fprintf(stderr, "Unable to find mpi type for 4 bytes real\n");
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+
+ if(sizeof(double) == 8) {
+ meshgems_mpi_datatype_map[meshgems_mpi_datatype_r8] = MPI_DOUBLE;
+ } else {
+ fprintf(stderr, "Unable to find mpi type for 8 bytes real\n");
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+
+ meshgems_mpi_op_map[meshgems_mpi_op_max] = MPI_MAX;
+ meshgems_mpi_op_map[meshgems_mpi_op_sum] = MPI_SUM;
+
+ MPI_Init(argc, argv);
+
+ out:
+
+ if(ret != MESHGEMS_MPI_SUCCESS) {
+ if(meshgems_mpi_datatype_map)
+ free(meshgems_mpi_datatype_map);
+ if(meshgems_mpi_op_map)
+ free(meshgems_mpi_op_map);
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_rank(int *r)
+{
+ MPI_Comm_rank(MPI_COMM_WORLD, r);
+
+ return MESHGEMS_MPI_SUCCESS;
+}
+
+int meshgems_mpi_size(int *n)
+{
+ MPI_Comm_size(MPI_COMM_WORLD, n);
+
+ return MESHGEMS_MPI_SUCCESS;
+}
+
+int meshgems_mpi_finalize(void)
+{
+ MPI_Finalize();
+
+ return MESHGEMS_MPI_SUCCESS;
+}
+
+meshgems_mpi_handler *meshgems_mpi_handler_new(void)
+{
+ meshgems_mpi_handler *handler;
+
+ handler = calloc(1, sizeof(meshgems_mpi_handler));
+
+ return handler;
+}
+
+void meshgems_mpi_handler_delete(meshgems_mpi_handler *handler)
+{
+ if(handler)
+ free(handler);
+}
+
+int meshgems_mpi_send(void* buffer, int count, meshgems_mpi_datatype datatype, int dest, int tag)
+{
+ int ret;
+ int r;
+ MPI_Datatype dtt;
+
+ dtt = meshgems_mpi_datatype_map[datatype];
+
+ r = MPI_Send(buffer, count, dtt, dest, tag, MPI_COMM_WORLD);
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_isend(void* buffer, int count, meshgems_mpi_datatype datatype, int dest, int tag,
+ meshgems_mpi_handler *handler)
+{
+ int ret;
+ int r;
+ MPI_Datatype dtt;
+
+ dtt = meshgems_mpi_datatype_map[datatype];
+
+ r = MPI_Isend(buffer, count, dtt, dest, tag, MPI_COMM_WORLD, &(handler->rq));
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_wait(meshgems_mpi_handler *handler)
+{
+ int ret;
+ int r;
+
+ r = MPI_Wait(&(handler->rq), MPI_STATUS_IGNORE );
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_recv(void* buffer, int count, meshgems_mpi_datatype datatype, int src, int tag)
+{
+ int ret;
+ int r;
+ MPI_Datatype dtt;
+
+ dtt = meshgems_mpi_datatype_map[datatype];
+
+ if(src == MESHGEMS_MPI_ANY_SOURCE) {
+ src = MPI_ANY_SOURCE;
+ }
+
+ r = MPI_Recv(buffer, count, dtt, src, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE );
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_reduce(void *sendbuf, void *recvbuf, int count, meshgems_mpi_datatype datatype,
+ meshgems_mpi_op op, int root)
+{
+ int ret;
+ int r;
+ MPI_Datatype dtt;
+ MPI_Op mop;
+
+ dtt = meshgems_mpi_datatype_map[datatype];
+ mop = meshgems_mpi_op_map[op];
+
+ r = MPI_Reduce(sendbuf, recvbuf, count, dtt, mop, root, MPI_COMM_WORLD);
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_allreduce(void *sendbuf, void *recvbuf, int count, meshgems_mpi_datatype datatype,
+ meshgems_mpi_op op)
+{
+ int ret;
+ int r;
+ MPI_Datatype dtt;
+ MPI_Op mop;
+
+ dtt = meshgems_mpi_datatype_map[datatype];
+ mop = meshgems_mpi_op_map[op];
+
+ r = MPI_Allreduce(sendbuf, recvbuf, count, dtt, mop, MPI_COMM_WORLD);
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_gather(void *sendbuf, int sendcount, meshgems_mpi_datatype sendtype, void *recvbuf,
+ int recvcount, meshgems_mpi_datatype recvtype, int root)
+{
+ int ret;
+ int r;
+ MPI_Datatype sdtt, rdtt;
+
+ sdtt = meshgems_mpi_datatype_map[sendtype];
+ rdtt = meshgems_mpi_datatype_map[recvtype];
+
+ r = MPI_Gather(sendbuf, sendcount, sdtt, recvbuf, recvcount, rdtt, root, MPI_COMM_WORLD);
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_allgather(void *sendbuf, int sendcount, meshgems_mpi_datatype sendtype,
+ void *recvbuf, int recvcount, meshgems_mpi_datatype recvtype)
+{
+ int ret;
+ int r;
+ MPI_Datatype sdtt, rdtt;
+
+ ret = MESHGEMS_MPI_SUCCESS;
+
+ sdtt = meshgems_mpi_datatype_map[sendtype];
+ rdtt = meshgems_mpi_datatype_map[recvtype];
+
+ r = MPI_Allgather(sendbuf, sendcount, sdtt, recvbuf, recvcount, rdtt, MPI_COMM_WORLD);
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ goto out;
+ }
+
+ out:
+
+ return ret;
+}
+
+int meshgems_mpi_allgatherv(void *sendbuf, int sendcount, meshgems_mpi_datatype sendtype,
+ void *recvbuf, int *recvcount, int *displs, meshgems_mpi_datatype recvtype)
+{
+ int ret;
+ int r;
+ MPI_Datatype sdtt, rdtt;
+
+ sdtt = meshgems_mpi_datatype_map[sendtype];
+ rdtt = meshgems_mpi_datatype_map[recvtype];
+
+ r = MPI_Allgatherv(sendbuf, sendcount, sdtt, recvbuf, recvcount, displs, rdtt, MPI_COMM_WORLD);
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_barrier(void)
+{
+ int ret;
+ int r;
+
+ r = MPI_Barrier(MPI_COMM_WORLD);
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
+
+int meshgems_mpi_abort(int errorcode)
+{
+ int ret;
+ int r;
+
+ r = MPI_Abort(MPI_COMM_WORLD, errorcode);
+
+ if(r != MPI_SUCCESS) {
+ ret = MESHGEMS_MPI_ERR;
+ } else {
+ ret = MESHGEMS_MPI_SUCCESS;
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright 2009-2013 Distene SAS
+ *
+ */
+
+#ifndef __MESHGEMS_MPI_H__
+#define __MESHGEMS_MPI_H__
+
+#define MESHGEMS_MPI_SUCCESS 0
+#define MESHGEMS_MPI_ERR 1
+
+#define MESHGEMS_MPI_ANY_SOURCE -1
+
+/* Declare these as int rather than enum to be able to create dynamic types/operations */
+
+typedef int meshgems_mpi_datatype;
+typedef int meshgems_mpi_op;
+
+#define meshgems_mpi_datatype_none 0
+#define meshgems_mpi_datatype_i4 1
+#define meshgems_mpi_datatype_i8 2
+#define meshgems_mpi_datatype_r4 3
+#define meshgems_mpi_datatype_r8 4
+#define meshgems_mpi_datatype_enum_count 5
+
+#define meshgems_mpi_op_none 0
+#define meshgems_mpi_op_max 1
+#define meshgems_mpi_op_sum 2
+#define meshgems_mpi_op_enum_count 3
+
+int meshgems_mpi_type_new(int count, int *array_of_blocklengths, long *array_of_displacements,
+ meshgems_mpi_datatype *array_of_types, meshgems_mpi_datatype *newtype);
+int meshgems_mpi_type_delete(meshgems_mpi_datatype datatype);
+
+struct meshgems_mpi_handler_;
+typedef struct meshgems_mpi_handler_ meshgems_mpi_handler;
+
+meshgems_mpi_handler *meshgems_mpi_handler_new(void);
+void meshgems_mpi_handler_delete(meshgems_mpi_handler *handler);
+
+int meshgems_mpi_init(int *argc, char ***argv);
+int meshgems_mpi_rank(int *r);
+int meshgems_mpi_size(int *n);
+int meshgems_mpi_finalize(void);
+
+int meshgems_mpi_send(void* buffer, int count, meshgems_mpi_datatype datatype, int dest, int tag);
+int meshgems_mpi_isend(void* buffer, int count, meshgems_mpi_datatype datatype, int dest, int tag,
+ meshgems_mpi_handler *handler);
+int meshgems_mpi_wait(meshgems_mpi_handler *handler);
+
+int meshgems_mpi_recv(void* buffer, int count, meshgems_mpi_datatype, int src, int tag);
+
+int meshgems_mpi_reduce(void *sendbuf, void *recvbuf, int count, meshgems_mpi_datatype datatype,
+ meshgems_mpi_op op, int root);
+
+int meshgems_mpi_allreduce(void *sendbuf, void *recvbuf, int count, meshgems_mpi_datatype datatype,
+ meshgems_mpi_op op);
+
+int meshgems_mpi_gather(void *sendbuf, int sendcount, meshgems_mpi_datatype sendtype, void *recvbuf,
+ int recvcount, meshgems_mpi_datatype recvtype, int root);
+
+int meshgems_mpi_allgather(void *sendbuf, int sendcount, meshgems_mpi_datatype sendtype,
+ void *recvbuf, int recvcount, meshgems_mpi_datatype recvtype);
+
+int meshgems_mpi_allgatherv(void *sendbuf, int sendcount, meshgems_mpi_datatype sendtype,
+ void *recvbuf, int *recvcount, int *displs, meshgems_mpi_datatype recvtype);
+
+int meshgems_mpi_barrier(void);
+
+int meshgems_mpi_abort(int errorcode);
+
+#endif
--- /dev/null
+#!/bin/bash
+
+#bash script mg-tetra_hpc.bash
+#we have renamed binary executable mg-tetra_hpc.exe V1.3.0 as mg-tetra_hpc.exe_Linux_64_avril2014
+#to assume call of other beta-versions of distene mg-tetra_hpc.exe code in standalone plugin GHS3DPRLPLUGIN sources
+#and also assume licence file set to overriding licence file of other distene products ( HEXOTIC, GHS3D, etc... )
+#this script is used for only one call of mg-tetra_hpc.bash from salome plugin GHS3DPRLPLUGIN
+
+#echo "mg-tetra_hpc.bash initial parameters are:" $1 $2 $3 $4
+echo "mg-tetra_hpc.bash initial parameters are:" $*
+#$0 is ignored
+
+CURRENTDIR=`pwd`
+COMPILDIR=`dirname $0`
+echo "COMPILDIR" $COMPILDIR
+echo "CURRENTDIR" $CURRENTDIR
+if [[ $HOSTNAME == *hpcspot* ]]
+ then
+ HOST="hpcspot"
+ else
+ HOST="STANDART_CentOs6" #CentOs6 default
+fi
+echo "HOST" $HOST
+
+#we need to compile for mg-tetra_hpc.exe
+#DISTENE_LICENSE_FILE is for example, have to be set
+if [ $HOST == "hpcspot" ]
+ then
+ #env openmpi centos6.5 hpcspot.com
+ source /apps/mpi/openmpi-1.6-x86_64-gcc48/env.sh
+ #export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
+ #export DLIM8VAR="dlim8 1:1:29030@10.27.51.1/002590c96d98::8fbdc02cde090ca0369ad028e839065b97709e3c33e640eb6a3c2c7e40fe3985"
+ else
+ #env openmpi centos6.5 standart lgls is206786
+ export WD2=/usr/lib64/openmpi
+ export PATH=$WD2/bin:${PATH}
+ export LD_LIBRARY_PATH=$COMPILDIR:$WD2/lib:${LD_LIBRARY_PATH}
+ #export DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
+ #export DLIM8VAR="dlim8 1:1:29030@132.166.151.49/84c419b8::87af196ab2a936ab31363624539bff8096fbe1f3c83028c8f6b399b0a904ef85"
+fi
+
+cd $COMPILDIR
+if [ ! -f libmeshgems_mpi.so ]
+then
+ echo "libmeshgems_mpi.sols does not exist, I compile it..."
+ mpicc meshgems_mpi.c -shared -fPIC -o libmeshgems_mpi.so
+ ls -alt lib*
+fi
+cd $CURRENTDIR
+
+echo "mg-tetra_hpc.bash assume licence file set:"
+env | grep DLIM
+
+#mg-tetra_hpc.exe_Linux_64_avril2014 --help
+#ldd `which mg-tetra_hpc.exe_Linux_64_avril2014`
+mpirun -n $2 mg-tetra_hpc.exe_Linux_64_avril2014 ${@:3:30}
+
+
/*!
-\page ghs3dprl_hypo_page MG-Tetra Parallel Parameters hypothesis
-
-\n MG-Tetra Parallel Parameters hypothesis works only with <b>MG-Tetra Parallel</b> algorithm.
-This algorithm is a commercial software, its use requires a licence (http://www.distene.com/fr/build/offer.html).
-\n Tepal_V1.4 gives the possibility to generate a partitioned
-mesh with 200 million tetrahedrons on a computer with average memory size
-(2Go RAM) in about 50 hours on one CPU (Xeon, 2008).
-\n New Tepal_V2.0 gives the possibility to generate a partitioned mesh with (for the moment) no more than 100 million
-tetrahedrons on computers using MPI, (Total 16 Go RAM)
-in about 900 seconds (!yes! : !seconds!) on 2 octo processors (Xeon, 2009).
-The launch of this beta-version is described below.
+\page ghs3dprl_hypo_page MG-Tetra-hpc (Parallel) Parameters hypothesis
+
+\n MG-Tetra-hpc Parameters hypothesis works only with <b>MG-Tetra-hpc</b> code (formerly tepal)
+which is the parallel implementation of MeshGems-Tetra (formerly TetMesh-GHS3D) algorithm.
+This algorithm is a DISTENE commercial software, its use requires a licence.
+\n
+See http://www.distene.com and http://www.meshgems.com/volume-meshing-meshgems-tetra.html.
+\n MG-Tetra-hpc (Tepal V3 in fact) gives the possibility to generate a partitioned
+mesh with more than 200 million tetrahedrons on computers using MPI.
+The launch of this version is described below.
\n This is a serious alternative to MG-Tetra, which requires a much less common
configuration with 64Go RAM to only try to make a partition of a mesh with
-200 million tetrahedrons, no result guaranteed.
+200 million tetrahedrons, no result guaranteed (in 2010).
\n
\note The Plugin doesn't load in the Memory the supposedly large resulting meshes.
The meshes are saved in MED files and can be imported in the user-defined location via menu File-Import-MED Files.
<b>Name</b> - allows to define the name of the hypothesis (MG-Tetra Parallel Parameters by default).
</li>
<li>
-<b>MED_Name</b> - allows to define the path and the prefix of the
+<b>MED Name</b> - allows to define the path and the prefix of the
resulting MED files ("DOMAIN" by default).
If the path is not defined, the environment variable $SALOME_TMP_DIR
is used. If $SALOME_TMP_DIR is not defined as well, the environment
variable $TMP is used.
</li>
<li>
-<b>Nb_Part</b> - allows to define the number of generated MED files.
+<b>Nb Partitions</b> - allows to define the number of generated MED files.
The initial skin (triangles) will be meshed (tetrahedrons) and partitioned
in Nb_Part by the elementary algorithm implemented in Tepal.<br>
</li>
<li>
-<b>Keep_Files</b> - if this box is checked, input files of Tepal
+<b>Keep Files</b> - if this box is checked, input files of Tepal
(GHS3DPRL.points and GHS3DPRL.faces) are not deleted after use (...if the
background mode was not used).
</li>
<li>
-<b>Tepal_in_Background</b> - if this box is checked, Tepal execution
+<b>Tetra_hpc in Background</b> - if this box is checked, Tetra_hpc execution
and MED file generation are launched in background mode and the user
can even exit Salome. Pay attention that in this case Tepal algorithm works
independently of "killSalome.py", and sometimes on another host.
</li>
<li>
-<b>To_Mesh_Holes</b> - if this box is checked, the parameter component
-of MG-Tetra will mesh holes.
+<b>Merge subdomains</b> - if this box is checked, merge the subdomains
+into one mesh and write the output .mesh(b).
+</li>
+<li>
+<b>Tag subdomains</b> - if this box is checked, use the parallel subdomain
+index as tag into the merged output mesh or not (used in combination with the
+merge_subdomains option).
+</li>
+<li>
+<b>Output interfaces</b> - if this box is checked, write the parallel subdomains interface
+triangles into the merged output mesh (used in combination with the merge_subdomains option).
+</li>
+<li>
+<b>Discard subdomains</b> - if this box is checked, discard the parallel subdomains
+(mesh, global numbering and interfaces).
</li>
-<h1>Modifying MG-Tetra Parallel Advanced Parameters</h1><br>
-GHS3DPRL Plugin launches a standalone binary executable tepal2med.<br>
-tepal2med launches tepal, waits for the end of computation, and
+<h1>Modifying MG-Tetra-hpc Advanced Parameters</h1><br>
+GHS3DPRL Plugin launches a standalone binary executable <b>tetrahpc2med</b>.<br>
+tetrahpc2med launches tetra_hpc, waits for the end of computation, and
converts the resulting output tepal files into MED files.<br>
Some advanced optional parameters are accessible as arguments.<br>
-If keep_files option is checked, it is possible to re-launch tepal2med
-or tepal in the Terminal as a command with custom parameters.<br>
+If keep_files option is checked, it is possible to re-launch tetrahpc2med
+or tetra_hpc in the Terminal as a command with custom parameters.<br>
<li>
-<b>Advanced tepal2med Parameters</b> - type "tepal2med --help" in the Terminal. <p>
+<b>Advanced tetrahpc2med Parameters</b> - type <b>tetrahpc2med --help</b> in the Terminal. <p>
\verbatim
-myname@myhost > /export/home/myname/salome_5/GHS3DPRLPLUGIN_5/bin/salome/tepal2med --help
-Available options:
- --help : produces this help message
- --casename : path and name of input tepal2med files which are
- - output files of tepal .msg .noboite .faces .points .glo
- - output file of GHS3DPRL_Plugin casename_skin.med (optional)
- with initial skin and its initial groups
- --number : number of partitions
- --medname : path and name of output MED files
- --limitswap : max size of working cpu memory (Mo) (before swapping on .temp files)
- --verbose : trace of execution (0->6)
- --test : more tests about joints, before generation of output files
- --menu : a GUI menu for option number
- --launchtepal : also launch tepal on files casename.faces and casename.points and option number
- --meshholes : force parameter component of tetmesh-ghs3d to mesh holes
- --background : force background mode from launch tepal and generation of final MED files (big meshes)
- --deletegroups : regular expression (see QRegExp) which matches unwanted groups in final MED files
- (try --deletegroups="(\bAll_Nodes|\bAll_Faces)"
- (try --deletegroups="((\bAll_|\bNew_)(N|F|T))"
+myname@myhost > /export/home/myname/salome_7/GHS3DPRLPLUGIN/bin/salome/tetrahpc2med --help
+tetrahpc2med V3.0 (MED3+tetra-hpc) Available options:
+ --help : produces this help message
+ --casename : path and name of input tetrahpc2med files which are
+ - output files of GHS3DPRL_Plugin .mesh
+ - output file of GHS3DPRL_Plugin casename_skin.med (optional)
+ with initial skin and its initial groups
+ --number : number of partitions
+ --medname : path and name of output MED files
+ --limitswap : max size of working cpu memory (Mo) (before swapping on .temp files)
+ --verbose : trace of execution (0->6)
+ --test : more tests about joints, before generation of output files
+ --menu : a GUI menu for option number
+ --launchtetra : also launch tetra-hpc on files casename.mesh and option number
+ --merge_subdomains : merge the subdomains into one mesh and write the output .mesh(b) file
+ --tag_subdomains : use the parallel subdomain index as tag into the merged output mesh
+ to identify the parallel subdomains (used in combination with the merge_subdomains option)
+ --output_interfaces : write the parallel subdomains interface triangles into the merged output mesh
+ (used in combination with the merge_subdomains option)
+ --discard_subdomains : discard the parallel subdomains informations output (mesh, global numbering and interfaces)
+ --background : force background mode from launch tetra-hpc and generation of final MED files (big meshes)
+ --deletegroups : regular expression (see QRegExp) which matches unwanted groups in final MED files
+ (try --deletegroups="(\bJOINT)"
+ (try --deletegroups="(\bAll_Nodes|\bAll_Faces)"
+ (try --deletegroups="((\bAll_|\bNew_)(N|F|T))"
example:
- tepal2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN --limitswap=1000
- --verbose=0 --test=yes --menu=no --launchtepal=no
+ tetrahpc2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN --limitswap=1000 --verbose=0 --test=yes --menu=no --launchtetra=no
\endverbatim
\n
</li>
<li>
-<b>Advanced Tepal_V1.4 Parameters</b> <p>
+<b>Advanced tetra_hpc parameters (2014)</b> <p>
\verbatim
-USAGE : tepal options
-
-With options :
- --filename name (-f name) :
- Prefix of the input case (MANDATORY)
-
- --ndom n (-n n) :
- Number of subdomains to make (MANDATORY)
-
- --ghs3d ghs3d options (-g ghs3d options) :
- Runs temesh ghs3d on a previously generated subdomain. (ghs3d options must be "quoted")
-
- --memory m (-m m) :
- Max amount of memory (megabytes) allowed for ghs in the cutting process. (default is 0 : unlimited)
-
- --mesh_only (-Z ) :
- Only (re)meshes all subdomains and updates communications messages
-
- --mesh_call command (-c command) :
- Calls the user specified command for meshing all the
- subomains after their skin has been generated
-
- --stats_only (-S ) :
- Only computes and shows some statistics on subdomains
-
- --rebuild (-r ) :
- Merges final subdomains skins
-
- --rebuild_tetra (-R ) :
- Merges final subdomains skins and tetraedra
-
- --rebuild_iface (-i ) :
- Includes interfaces in final subdomains merge
-
- --rebuild_retag (-t ) :
- Tags vertices, faces (and tetra if selected) with their
- subdomain number in the final merge of subdomains (keeps the lowest tag for shared elements)
-
- --rebuild_ensight_parts (-e ) :
- Builds ensight geom file with parts
-
- --tetmesh_args str (-G str) :
- Arguments to pass to Tetmesh during cutting process
+Usage: tetra_hpc.exe [options]
+
+Options:
+
+ Short option (if it exists)
+ / Long option
+ | / Description
+ | | /
+ v v v
+
+ --help
+ print this help
+
+ --in <input mesh file name>
+ Sets the input file
+ (MANDATORY)
+
+ --out <output mesh file name>
+ Sets the output file
+ (MANDATORY)
+
+ --merge_subdomains <merge>
+ Describes whether to merge the subdomains into one mesh and write the
+ output .mesh(b) file or not.
+ if <merge> is
+ yes : the subdomains will be merged into one mesh and written to
+ the output .mesh(b),
+ no : the subdomains will not be merged.
+ default : no
+
+ --tag_subdomains <tag>
+ Describes whether to use the parallel subdomain index as tag into the
+ merged output mesh or not (used in combination with the
+ merge_subdomains option).
+ if <tag> is
+ yes : the tags of the tetrahedra in the merged output will
+ identify the parallel subdomains,
+ no : the tag will keep its standard meaning of volume domain.
+ default : no
+
+ --output_interfaces <output_interfaces>
+ Describes whether to write the parallel subdomains interface
+ triangles into the merged output mesh or not (used in combination
+ with the merge_subdomains option).
+ if <output_interfaces> is
+ yes : the parallel subdomains interface triangles will be written
+ into the merged output mesh,
+ no : they will not be added to the merged output mesh.
+ default : no
+
+ --verbose <verbose>
+ Set the verbosity level, increasing from 0 to 10.
+ <verbose> values are increasing from 0 to 10 :
+ 0 : no details
+ 10 : very detailed
+ default : 3
+
+ --discard_subdomains <discard>
+ Describes whether to discard the parallel subdomains (mesh, global
+ numbering and interfaces) or not.
+ if <discard> is
+ yes : the subdomain informations (mesh, global numbering and
+ interfaces) will be discarded,
+ no : they will be written to disk as output.
+ default : no
\endverbatim
\n
</li>
-<li>
-<b>Advanced MG-Tertra Parameters (through Tepal_V1.4's --tetmesh_args)</b> - type "ghs3d -h" in a Terminal. <p>
-\verbatim
-myname@myhost > ghs3d -h
-
-USE
- /export/home/myname/ghs3d-4.0/DISTENE/Tools/TetMesh-GHS3D4.0/bin/Linux/ghs3dV4.0
- [-u] [-m memory>] [-M MEMORY] [-f prefix] [-v verbose]
- [-c component] [-p0] [-C] [-E count] [-t] [-o level]
- [-I filetype] [-a/-b] [-O n m]
-
-DESCRIPTION
-
- -u (-h) : prints this message.
-
- -m memory : launches the software with memory in Megabytes.
- The default value of this parameter is 64 Megabytes and its
- minimum value is 10 Megabytes.
- It is also possible to set this parameter with the
- environment variable GHS3D_MEMORY by means of an operation
- equivalent to:
- setenv GHS3D_MEMORY memory,
- the value specified in the command line has the priority on
- the environment variable.
-
- -M MEMORY : provides the automatic memory adjustment feature.
- If MEMORY (in Megabytes) is equal to zero, the size of the work space is
- calculated from the input. If MEMORY is not equal to
- zero, the software starts with MEMORY amount of work space.
- The software reallocates memory as necessary.
- The start value of MEMORY can range from 0 to 64 Megabytes,
- the maximum depends on -m option and the actual memory available.
-
- -f prefix : defines the generic prefix of the files.
-
- -v verbose : sets the output level parameter (the verbose parameter
- must be in the range 0 to 10).
-
- -c component : chooses the meshed component. If the parameter is
- 0, all components will be meshed, if
- 1, only the main (outermost) component will be meshed
-
- -p0 : disables creation of internal points.
-
- -C : uses an alternative boundary recovery mechanism. It should be used only
- when the standard boundary recovery fails.
-
- -E count : sets the extended output for error messages. If -E is used,
- the error messages will be printed, it is possible
- to indicate the maximum number of printed messages between 1 and 100.
-
- -t : generates an error file prefix.Log
-
- -o level : sets the required optimisation level.
- Valid optimisation levels are:
- none, light, standard or strong,
- with increase of "quality vs speed" ratio.
-
- -I filetype : defines the input mesh format as follows:
- -IP input files are ascii files, named prefix.points
- and prefix.faces - this is the default type of files
- -IPb input files are binary files, named prefix.pointsb
- and prefix.facesb
- -IM input file is ascii file, named prefix.mesh
- where prefix is defined with -f option
-
- -a/-b : selects the output file type:
- -a for ascii (the default) and
- -b for binary.
-
- -On : saves a NOPO file in addition. NOPO is the mesh data
- structure of the Simail and Modulef software packages.
- -Om : saves a mesh file in addition.
- -Omn : saves both NOPO and mesh files.
-
- ==============================================================================
- TETMESH-GHS3D SOFTWARE 4.0-3 (December, 2006)
- END OF SESSION
- COPYRIGHT (C)1989-2006 INRIA ALL RIGHTS RESERVED
- ==============================================================================
- ( Distene SAS
- Phone: +33(0)1-69-26-62-10 Fax: +33(0)1-69-26-90-33
- EMail: support@distene.com )
-
-\endverbatim
-\n
-</li>
-<h1>Saving user's preferred MG-Tetra Parallel Advanced Parameters</h1><br>
-GHS3DPRL Plugin launches standalone binary executable tepal2med.<br>
-You may rename file tepal2med as tepal2med.exe for example, and replace
-tepal2med by a shell script at your convenience to overriding parameters.
-<br>... or else $PATH modification... .<br>Idem for file tepal.<br><br>
+<h1>Saving user's preferred GHS3DPRL Advanced Parameters</h1><br>
+GHS3DPRL Plugin launches standalone binary executable tetrahpc2med.<br>
+You may rename file tetrahpc2med as tetrahpc2med.exe for example, and replace
+tetrahpc2med by a shell script at your convenience to overriding parameters.
+<br>... or else $PATH modification... .<br>
<li>
-<b>Advanced tepal2med Parameters</b> - overriding parameter deletegroups<p>
-You may rename tepal2med as tepal2med.exe for example.
+<b>Advanced tetrahpc2med Parameters</b> - overriding parameter deletegroups<p>
+You may rename tetrahpc2med as tetrahpc2med.exe for example.
\code
#!/bin/bash
-#script tepal2med overriding parameter deletegroups
-#we have renamed binary executable tepal2med as tepal2med.exe
-#echo tepal2med initial parameters are $1 $2 $3 $4 ... or $*
+#script tetrahpc2med overriding parameter deletegroups
+#we have renamed binary executable tetrahpc2med as tetrahpc2med.exe
+#echo tetrahpc2med initial parameters are $1 $2 $3 $4 ... or $*
#$0 is ignored
-tepal2med.exe $* --deletegroups="(\bAll_Nodes|\bAll_Faces)"
-
-\endcode
-\n
-</li>
-<li>
-<b>Advanced Tepal_V1.4 Parameters</b> - overriding parameter component of ghs3d (to mesh holes). <p>
-You may rename tepal as tepal.exe for example.
-
-\code
-#!/bin/bash
-#script tepal overriding parameter component of tetmesh-ghs3d
-#we have renamed binary executable tepal as tepal.exe
-
-#optionnaly we could set licence only for us
-DISTENE_LICENSE_FILE="Use global envvar: DLIM8VAR"
-DLIM8VAR="dlim8 1:1:29030@is142356/0016175ef08c::a1ba1...etc...e19"
-SIMULOGD_LICENSE_FILE=29029@is142356
-
-tepal.exe $* --tetmesh_args "-c 0"
+tetrahpc2med.exe $* --deletegroups="(\bAll_Nodes|\bAll_Faces)"
\endcode
\n
</li>
-<li>
-<b>Advanced tepal Parameters</b> - overriding launching tepal on other host. <p>
-You may rename tepal as tepal.exe for example.
-
-\code
-#!/bin/bash
-#script tepal overriding launching tepal on other host (tepal run 64 bits only)
-#we have renamed binary executable tepal as tepal.exe
-#common file system (same path) otherwise scp... on input or result files
-#ssh -keygen -t rsa done and files id_rsa et id-rsa.pub move in ~/.ssh
-
-#example of typical command
-#tepal -f /home/myname/tmp/GHS3DPRL -n 4 > /home/myname/tmp/tepal.log
-#echo parameters $1 $2 $3 $4 ... or $*
-
-#tepal licence ought to be known on otherhost
-ssh otherhost "tepal.exe $* > /home/myname/tmp/tepal.log"
-
-#or more and more
-#ssh otherhost "tepal.exe $* --tetmesh_args \"-c 0\"" > /home/myname/tmp/tepal.log
-
-\endcode
-\n
-</li>
-
-<h1>Tepal_V2.0 and MPI use.</h1><br>
-This all new beta-version needs MPI, (openmpi-1.3.1 was used). To use it you have to proceed
-as done in "overriding parameter component of ghs3d".
-Advanced ghs3d Parameters (through Tepal_V1.4's --tetmesh_args) are not assumed yet.
-It meshes holes.
-\n You may rename tepal as tepal64_v2.exe for example, and replace tepal by a shell script like below.
+
+<h1>tetra_hpc and MPI use.</h1><br>
+This 2014 beta-version needs MPI, (openmpi was used). To use it you have to proceed as below.
<li>
-<b>example tepal_v2_mpirun.</b><p>
+<b>Obsolete example tepal_v2_mpirun.</b><p>
\code
algo2d.SetGeometricMesh(0)
-# 3D mesh with tepal
-# ------------------
+# 3D mesh with tetra-hpc (formerly tepal v3 (2014))
+# ----------------------------------------------------
algo3d = m.Tetrahedron(smeshBuilder.MG_Tetra_Parallel)
algo3d.SetNbPart(4)
algo3d.SetBackground(False)
algo3d.SetKeepFiles(False)
-algo3d.SetToMeshHoles(True)
+algo3d.SetToMergeSubdomains(False)
+algo3d.SetToTagSubdomains(False)
+algo3d.SetToOutputInterfaces(False)
+algo3d.SetToDiscardSubdomains(False)
# Launch meshers
# --------------
# ----------
if os.access(results+".xml", os.F_OK):
- print "Ok: tepal"
+ print "Ok: tetra_hpc"
else:
- print "KO: tepal"
+ print "KO: tetra_hpc"
\endcode
\n
</li>
- Meshing 3D geometric entities: volumes are split into tetrahedral (pyramidal) elements.
- Generating 3D meshes from 2D meshes, working without geometrical objects.
-\note GHS3DPRLPLUGIN plugin uses MG-Tetra (former GHS3D) commercial mesher and require a
+\note GHS3DPRLPLUGIN plugin uses MG-Tetra-hpc (formerly Tepal) commercial mesher and require a
license to be used within the Mesh module.
To manage parameters of the GHS3DPRLPLUGIN use \subpage ghs3dprl_hypo_page.
void SetBackground(in boolean value);
boolean GetBackground();
- void SetToMeshHoles(in boolean value);
- boolean GetToMeshHoles();
+ //void SetToMeshHoles(in boolean value);
+ //boolean GetToMeshHoles();
+
+ void SetToMergeSubdomains(in boolean value);
+ boolean GetToMergeSubdomains();
+
+ void SetToTagSubdomains(in boolean value);
+ boolean GetToTagSubdomains();
+
+ void SetToOutputInterfaces(in boolean value);
+ boolean GetToOutputInterfaces();
+
+ void SetToDiscardSubdomains(in boolean value);
+ boolean GetToDiscardSubdomains();
};
};
## To mesh "holes" in a solid or not. Default is to mesh.
# @param toMesh "mesh holes" flag value
- def SetToMeshHoles(self, toMesh):
- self.Parameters().SetToMeshHoles(toMesh)
+ #def SetToMeshHoles(self, toMesh):
+ # self.Parameters().SetToMeshHoles(toMesh)
+ # pass
+
+ ## To Merge Subdomains. Default is to no.
+ # @param toMesh "MergeSubdomains" flag value
+ def SetToMergeSubdomains(self, toMesh):
+ self.Parameters().SetToMergeSubdomains(toMesh)
+ pass
+
+ ## To Tag Subdomains. Default is to no.
+ # @param toMesh "TagSubdomains" flag value
+ def SetToTagSubdomains(self, toMesh):
+ self.Parameters().SetToTagSubdomains(toMesh)
+ pass
+
+ ## To Output Interfaces. Default is to no.
+ # @param toMesh "OutputInterfaces" flag value
+ def SetToOutputInterfaces(self, toMesh):
+ self.Parameters().SetToOutputInterfaces(toMesh)
+ pass
+
+ ## To Discard Subdomains. Default is to no.
+ # @param toMesh "DiscardSubdomains" flag value
+ def SetToDiscardSubdomains(self, toMesh):
+ self.Parameters().SetToDiscardSubdomains(toMesh)
pass
pass # end of GHS3DPRL_Algorithm class
_NbPart = hyp->GetNbPart();
_KeepFiles = hyp->GetKeepFiles();
_Background = hyp->GetBackground();
- _ToMeshHoles = hyp->GetToMeshHoles();
+ _ToMergeSubdomains = hyp->GetToMergeSubdomains();
+ _ToTagSubdomains = hyp->GetToTagSubdomains();
+ _ToOutputInterfaces = hyp->GetToOutputInterfaces();
+ _ToDiscardSubdomains = hyp->GetToDiscardSubdomains();
}
}
}
//=============================================================================
-// Here we are going to use the GHS3DPRL mesher
+// Here we are going to use the GHS3DPRL mesher for tetra-hpc (formerly tepal in v3 (2014))
bool GHS3DPRLPlugin_GHS3DPRL::Compute(SMESH_Mesh& theMesh,
const TopoDS_Shape& theShape)
+{
+ bool Ok=false;
+ TCollection_AsciiString pluginerror("ghs3dprl: ");
+ SMESHDS_Mesh* meshDS = theMesh.GetMeshDS();
+ //cout<<"GetMeshDS done\n";
+ if (_countSubMesh==0){
+ MESSAGE("GHS3DPRLPlugin_GHS3DPRL::Compute for tetra-hpc");
+ _countTotal=0;
+ TopExp_Explorer expf(meshDS->ShapeToMesh(), TopAbs_SOLID);
+ for ( ; expf.More(); expf.Next() ) _countTotal++;
+ }
+ _countSubMesh++;
+ //cout<<"Compute _countSubMesh "<<_countSubMesh<<endl;
+ //no stuff if multiples submesh, multiple call compute
+ //mesh all in one pass tepal (the last)
+ if (_countSubMesh != _countTotal ) return true;
+
+ //stuff on last call
+ if (_hypothesis==NULL){
+ pluginerror += "No existing parameters/hypothesis for GHS3DPRL";
+ cout <<"\n"<<pluginerror<<"\n\n";
+ error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
+ return false;
+ }
+ SetParameters(_hypothesis);
+ cout << "\n" << _name << " parameters :\n" << endl;
+ cout << " generic path/name of MED Files = " << _MEDName << endl;
+ cout << " number of partitions = " << _NbPart << endl;
+ cout << " merge subdomains = " << _ToMergeSubdomains << endl;
+ cout << " tag subdomains = " << _ToTagSubdomains << endl;
+ cout << " output interfaces = " << _ToOutputInterfaces << endl;
+ cout << " discard dubdomains = " << _ToDiscardSubdomains << endl;
+ cout << " keep intermediates files (from tetra-hpc) = " << _KeepFiles << endl;
+ cout << " background (from tetra-hpc) = " << _Background << "\n\n";
+
+ //string tmpDir=getTmpDir_new();
+ TCollection_AsciiString
+ tmpDir=getTmpDir(),
+ GHS3DPRL_In,GHS3DPRL_Out,GHS3DPRL_Outxml,
+ run_GHS3DPRL("tetrahpc2med "),rm("rm -f "),run_nokeep_files,
+ NbPart,fileskinmed(""),fileskinmesh(""),path,casenamemed; //_MEDName.c_str());
+
+ casenamemed += (char *)_MEDName.c_str();
+ int n=casenamemed.SearchFromEnd('/');
+ if (n>0) {
+ path=casenamemed.SubString(1,n);
+ casenamemed=casenamemed.SubString(n+1,casenamemed.Length());
+ }
+ else
+ path=tmpDir;
+
+ if (casenamemed.Length()>20){
+ casenamemed=casenamemed.SubString(1,20);
+ cerr<<"MEDName truncated (no more 20 characters) = "<<casenamemed<<endl;
+ }
+ cout<<"path="<<path<<endl;
+ cout<<"casenamemed="<<casenamemed<<endl;
+
+ map <int,int> aSmdsToGHS3DPRLIdMap;
+ map <int,const SMDS_MeshNode*> aGHS3DPRLIdToNodeMap;
+ GHS3DPRL_In = path + "GHS3DPRL";
+ GHS3DPRL_Out = path + casenamemed;
+ GHS3DPRL_Outxml = path + casenamemed + ".xml"; //master file
+ NbPart=_NbPart;
+ //tepal2med --casename=/home/whoami/tmp/GHS3DPRL --number=5 --medname=DOMAIN
+ // --limitswap=1000 --verbose=0 --test=no --menu=no --launchtepal=yes;
+
+ run_GHS3DPRL = run_GHS3DPRL +
+ " --casename=" + GHS3DPRL_In +
+ " --number=" + NbPart +
+ " --medname=" + GHS3DPRL_Out +
+ " --launchtetra=yes";
+ //no more meshhole option
+ //if (_ToMeshHoles) run_GHS3DPRL += " --meshholes=yes"; else run_GHS3DPRL += " --meshholes=no";
+ if (_ToMergeSubdomains) run_GHS3DPRL += " --merge_subdomains=yes"; else run_GHS3DPRL += " --merge_subdomains=no";
+ if (_ToTagSubdomains) run_GHS3DPRL += " --tag_subdomains=yes"; else run_GHS3DPRL += " --tag_subdomains=no";
+ if (_ToOutputInterfaces) run_GHS3DPRL += " --output_interfaces=yes"; else run_GHS3DPRL += " --output_interfaces=no";
+ if (_ToDiscardSubdomains) run_GHS3DPRL += " --discard_subdomains=yes"; else run_GHS3DPRL += " --discard_subdomains=no";
+ if (_Background) run_GHS3DPRL += " --background=yes"; else run_GHS3DPRL += " --background=no";
+ run_nokeep_files = rm +GHS3DPRL_In + "* " + path + "tetrahpc.log";
+ system( run_nokeep_files.ToCString() ); //clean files
+ run_nokeep_files = rm + GHS3DPRL_In + "* ";
+
+ cout<<"GHS3DPRL command : "<<run_GHS3DPRL.ToCString()<<endl;
+ fileskinmesh=path + "GHS3DPRL.mesh";
+ cout<<"Write input file for tetra_hpc.exe "<<fileskinmesh<<"...";
+ GHS3DPRL_Out = path + casenamemed;
+ removeFile( GHS3DPRL_Outxml ); //only the master xml file
+ //Ok=writeGHS3DPRLFiles(GHS3DPRL_In, meshDS, aSmdsToGHS3DPRLIdMap, aGHS3DPRLIdToNodeMap);
+ bool toCreateGroups = false;
+ theMesh.ExportGMF(fileskinmesh.ToCString(), meshDS, toCreateGroups );
+ cout<<" ...done\n";
+ //else {
+ // cout<<" ...NOT done\n";
+ // pluginerror = pluginerror + "problem writing input tepal files " + GHS3DPRL_In + ".mesh";
+
+ //Ecriture dans un fichier MED ?v2.? meme si not Ok
+ //create empty file -> avoid warning message
+ //med_idt fid=MEDouvrir((const char *)fileskinmed.ToCString(),MED_CREATION);
+ //med_err ret=MEDfermer(fid);
+ //fileskinmed=fileskinmed + "cp /home/wambeke/empty.med "+ path + "GHS3DPRL_skin.med";
+ //system( fileskinmed.ToCString() );
+ fileskinmed=path + "GHS3DPRL_skin.med";
+ cout<<"Write file "<<fileskinmed<<"...";
+ theMesh.ExportMED(fileskinmed.ToCString(),"SKIN_INITIAL",true,1);
+ cout<<" ...done\n";
+
+ /*
+ if (!Ok) {
+ error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
+ return false; //pb abandonne
+ }*/
+
+ //sometimes it is better to wait flushing files on slow filesystem...
+ system( "sleep 3" );
+ system( run_GHS3DPRL.ToCString() );
+ system( "sleep 3" );
+
+ //cout<<"!!!reprise plugin!!!"<<endl;
+
+ if (_Background) {
+ pluginerror = pluginerror + "backgrounding... plugin is not waiting for output files "+ casenamemed + "_*.med";
+ cout<<pluginerror<<endl;
+ error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
+ return false; //but it is not a problem but if true my message is overwritten
+ //return true; //but it is not a problem,
+ }
+
+ // read a result, GHS3DPRL_Out is the name of master file (previous xml format)
+ FILE * aResultFile = fopen( GHS3DPRL_Outxml.ToCString(), "r" );
+ if (aResultFile){
+ //Ok = readResult( aResultFile, meshDS, theShape, aGHS3DPRLIdToNodeMap, GHS3DPRL_Out, _nodeRefNumber );
+ Ok = true;
+ Ok = false; //but it is not a problem but if true my message is overwritten
+ fclose(aResultFile);
+ cout<<"GHS3DPRL OK output master file "<<casenamemed<<".xml exist !\n\n";
+ pluginerror = pluginerror + "new tetraedra not in memory, but stored in files "+ casenamemed + "_*.med";
+ cout<<pluginerror<<endl;
+ error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
+ if (!_KeepFiles) system( run_nokeep_files.ToCString() );
+ }
+ else{
+ Ok = false; //it is a problem AND my message is NOT overwritten
+ pluginerror = pluginerror + "output master file " + casenamemed + ".xml do not exist";
+ cout<<pluginerror<<endl;
+ error(COMPERR_ALGO_FAILED, pluginerror.ToCString() );
+ cout<<"GHS3DPRL KO output files "<<GHS3DPRL_Out<<" do not exist ! see intermediates files keeped:\n";
+ TCollection_AsciiString run_list_files("ls -alt ");
+ run_list_files += GHS3DPRL_Out + "* " + GHS3DPRL_In + "* " + path + "tetrahpc.log";
+ system( run_list_files.ToCString() );
+ cout<<endl;
+ }
+ _countSubMesh=0;
+
+
+ return Ok;
+}
+
+//=============================================================================
+// Here we are going to use the GHS3DPRL mesher (old obsolescent version tepal in v1 & v2 (before 2014))
+bool GHS3DPRLPlugin_GHS3DPRL::ComputeForTepal(SMESH_Mesh& theMesh,
+ const TopoDS_Shape& theShape)
{
bool Ok;
TCollection_AsciiString pluginerror("ghs3dprl: ");
cout << "\n" << _name << " parameters :\n" << endl;
cout << " generic path/name of MED Files = " << _MEDName << endl;
cout << " number of partitions = " << _NbPart << endl;
- cout << " mesh holes = " << _ToMeshHoles << endl;
+ //cout << " mesh holes = " << _ToMeshHoles << endl;
+ cout << " mesh holes = " << 1 << endl;
cout << " keep intermediates files (from tepal) = " << _KeepFiles << endl;
cout << " background (from tepal) = " << _Background << "\n\n";
" --number=" + NbPart +
" --medname=" + GHS3DPRL_Out +
" --launchtepal=yes";
- if (_ToMeshHoles) run_GHS3DPRL += " --meshholes=yes"; else run_GHS3DPRL += " --meshholes=no";
+ //if (_ToMeshHoles) run_GHS3DPRL += " --meshholes=yes"; else run_GHS3DPRL += " --meshholes=no";
+ if (1) run_GHS3DPRL += " --meshholes=yes"; else run_GHS3DPRL += " --meshholes=no";
if (_Background) run_GHS3DPRL += " --background=yes"; else run_GHS3DPRL += " --background=no";
run_nokeep_files = rm +GHS3DPRL_In + "* " + path + "tepal.log";
system( run_nokeep_files.ToCString() ); //clean files
Ok = false; //but it is not a problem but if true my message is overwritten
fclose(aResultFile);
cout<<"GHS3DPRL OK output master file "<<casenamemed<<".xml exist !\n\n";
- pluginerror = pluginerror + "new tetaedra not in memory, but stored in files "+ casenamemed + "_*.med";
+ pluginerror = pluginerror + "new tetraedra not in memory, but stored in files "+ casenamemed + "_*.med";
cout<<pluginerror<<endl;
error(COMPERR_ALGO_FAILED, pluginerror.ToCString());
if (!_KeepFiles) system( run_nokeep_files.ToCString() );
return Ok;
/*pid_t pid = fork();
if (pid > 0) {
- //Processus père
+ //Processus pere
cout<<"le pere est la\n";
system("echo le pere > lepere.tmp");
system("sleep 10");
} else if (pid == 0) {
//Processus fils
cout<<"le fils est la\n";
- //On rend le fils indépendant de tout terminal
+ //On rend le fils independant de tout terminal
setsid();
system("sleep 20");
system("echo le fils > lefils.tmp");
void SetParameters(const GHS3DPRLPlugin_Hypothesis* hyp);
virtual bool Compute(SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape);
+ const TopoDS_Shape& aShape);
+ virtual bool ComputeForTepal(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); //obsolescent
- virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
- MapShapeNbElems& aResMap);
+ virtual bool Evaluate(SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ MapShapeNbElems& aResMap);
ostream & SaveTo(ostream & save);
istream & LoadFrom(istream & load);
int _NbPart; //number of partitions
bool _KeepFiles; //tepal file .noboite binary or not
bool _Background; //true for big meshes
- bool _ToMeshHoles;
+ //ToMergeSubdomains ToTagSubdomains ToOutputInterfaces ToDiscardSubdomains
+ bool _ToMergeSubdomains;
+ bool _ToTagSubdomains;
+ bool _ToOutputInterfaces;
+ bool _ToDiscardSubdomains;
};
#endif
*
*/
//=============================================================================
-GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis (int hypId, int studyId,
- SMESH_Gen * gen)
+GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis (int hypId, int studyId, SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, studyId, gen),
_MEDName( GetDefaultMEDName() ),
_NbPart( GetDefaultNbPart() ),
_KeepFiles( GetDefaultKeepFiles() ),
_Background( GetDefaultBackground() ),
- _ToMeshHoles( GetDefaultToMeshHoles() )
+ _ToMergeSubdomains( GetDefaultToMergeSubdomains() ),
+ _ToTagSubdomains( GetDefaultToTagSubdomains() ),
+ _ToOutputInterfaces( GetDefaultToOutputInterfaces() ),
+ _ToDiscardSubdomains( GetDefaultToDiscardSubdomains() )
{
MESSAGE("GHS3DPRLPlugin_Hypothesis::GHS3DPRLPlugin_Hypothesis");
_name = GetHypType();
}
}
-void GHS3DPRLPlugin_Hypothesis::SetToMeshHoles(bool theVal) {
+/*void GHS3DPRLPlugin_Hypothesis::SetToMeshHoles(bool theVal) {
if (theVal != _ToMeshHoles) {
_ToMeshHoles = theVal;
NotifySubMeshesHypothesisModification();
}
+}*/
+
+void GHS3DPRLPlugin_Hypothesis::SetToMergeSubdomains(bool theVal) {
+ if (theVal != _ToMergeSubdomains) {
+ _ToMergeSubdomains = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+void GHS3DPRLPlugin_Hypothesis::SetToTagSubdomains(bool theVal) {
+ if (theVal != _ToTagSubdomains) {
+ _ToTagSubdomains = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+void GHS3DPRLPlugin_Hypothesis::SetToOutputInterfaces(bool theVal) {
+ if (theVal != _ToOutputInterfaces) {
+ _ToOutputInterfaces = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+void GHS3DPRLPlugin_Hypothesis::SetToDiscardSubdomains(bool theVal) {
+ if (theVal != _ToDiscardSubdomains) {
+ _ToDiscardSubdomains = theVal;
+ NotifySubMeshesHypothesisModification();
+ }
}
//save without any whitespaces!
save<<"MEDName="<<_MEDName<<";";
save<<"NbPart="<<_NbPart<<";";
- save<<"ToMeshHoles="<<(int) _ToMeshHoles<<";";
+ //save<<"ToMeshHoles="<<(int) _ToMeshHoles<<";";
+ save<<"ToMergeSubdomains="<<(int) _ToMergeSubdomains<<";";
+ save<<"ToTagSubdomains="<<(int) _ToTagSubdomains<<";";
+ save<<"ToOutputInterfaces="<<(int) _ToOutputInterfaces<<";";
+ save<<"ToDiscardSubdomains="<<(int) _ToDiscardSubdomains<<";";
save<<"KeepFiles="<<(int) _KeepFiles<<";";
save<<"Background="<<(int) _Background<<";";
return save;
if (str3=="MEDName") _MEDName = str4.c_str();
if (str3=="NbPart") _NbPart = atoi(str4.c_str());
if (str3=="KeepFiles") _KeepFiles = (bool) atoi(str4.c_str());
- if (str3=="ToMeshHoles") _ToMeshHoles = (bool) atoi(str4.c_str());
+ //if (str3=="ToMeshHoles") _ToMeshHoles = (bool) atoi(str4.c_str());
+ if (str3=="ToMergeSubdomains") _ToMergeSubdomains = (bool) atoi(str4.c_str());
+ if (str3=="ToTagSubdomains") _ToTagSubdomains = (bool) atoi(str4.c_str());
+ if (str3=="ToOutputInterfaces") _ToOutputInterfaces = (bool) atoi(str4.c_str());
+ if (str3=="ToDiscardSubdomains") _ToDiscardSubdomains = (bool) atoi(str4.c_str());
if (str3=="Background") _Background = (bool) atoi(str4.c_str());
}
return load;
*/
//================================================================================
bool GHS3DPRLPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh,
- const TopoDS_Shape& theShape)
+ const TopoDS_Shape& theShape)
{
return false;
}
}
//=============================================================================
-bool GHS3DPRLPlugin_Hypothesis::GetDefaultToMeshHoles()
+//bool GHS3DPRLPlugin_Hypothesis::GetDefaultToMeshHoles()
+//{
+// return false;
+//}
+
+//=============================================================================
+bool GHS3DPRLPlugin_Hypothesis::GetDefaultToMergeSubdomains()
+{
+ return false;
+}
+
+//=============================================================================
+bool GHS3DPRLPlugin_Hypothesis::GetDefaultToTagSubdomains()
+{
+ return false;
+}
+
+//=============================================================================
+bool GHS3DPRLPlugin_Hypothesis::GetDefaultToOutputInterfaces()
+{
+ return false;
+}
+
+//=============================================================================
+bool GHS3DPRLPlugin_Hypothesis::GetDefaultToDiscardSubdomains()
{
return false;
}
void SetBackground(bool theVal);
bool GetBackground() const { return _Background; }
-
- void SetToMeshHoles(bool theVal);
- bool GetToMeshHoles() const { return _ToMeshHoles; }
+
+ //ToMergeSubdomains ToTagSubdomains ToOutputInterfaces ToDiscardSubdomains
+ void SetToMergeSubdomains(bool theVal);
+ bool GetToMergeSubdomains() const { return _ToMergeSubdomains; }
+
+ void SetToTagSubdomains(bool theVal);
+ bool GetToTagSubdomains() const { return _ToTagSubdomains; }
+
+ void SetToOutputInterfaces(bool theVal);
+ bool GetToOutputInterfaces() const { return _ToOutputInterfaces; }
+
+ void SetToDiscardSubdomains(bool theVal);
+ bool GetToDiscardSubdomains() const { return _ToDiscardSubdomains; }
// the parameters default values
static int GetDefaultNbPart();
static bool GetDefaultKeepFiles();
static bool GetDefaultBackground();
- static bool GetDefaultToMeshHoles();
+ static bool GetDefaultToMergeSubdomains();
+ static bool GetDefaultToTagSubdomains();
+ static bool GetDefaultToOutputInterfaces();
+ static bool GetDefaultToDiscardSubdomains();
// Persistence
virtual std::ostream& SaveTo(std::ostream& save);
int _NbPart; // number of partitions
bool _KeepFiles; // keep intermediates tepal files or not
bool _Background; // tepal in background
- bool _ToMeshHoles;
-};
+ bool _ToMergeSubdomains;
+ bool _ToTagSubdomains;
+ bool _ToOutputInterfaces;
+ bool _ToDiscardSubdomains;
+ };
#endif
* GHS3DPRLPlugin_Hypothesis_i::SetNbPart
* GHS3DPRLPlugin_Hypothesis_i::SetKeepFiles
* GHS3DPRLPlugin_Hypothesis_i::SetBackground
- * GHS3DPRLPlugin_Hypothesis_i::SetToMeshHoles
+ * GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains
+ * GHS3DPRLPlugin_Hypothesis_i::SetToTagSubdomains
+ * GHS3DPRLPlugin_Hypothesis_i::SetToOutputInterfaces
+ * GHS3DPRLPlugin_Hypothesis_i::SetToDiscardSubdomains
*/
//=============================================================================
SMESH::TPythonDump() << _this() << ".SetBackground( " << theValue << " )";
}
-void GHS3DPRLPlugin_Hypothesis_i::SetToMeshHoles (CORBA::Boolean theValue)
+void GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains (CORBA::Boolean theValue)
{
- MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToMeshHoles");
+ MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToMergeSubdomains");
ASSERT(myBaseImpl);
- this->GetImpl()->SetToMeshHoles(theValue);
- SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << theValue << " )";
+ this->GetImpl()->SetToMergeSubdomains(theValue);
+ SMESH::TPythonDump() << _this() << ".SetToMergeSubdomains( " << theValue << " )";
+}
+
+void GHS3DPRLPlugin_Hypothesis_i::SetToTagSubdomains (CORBA::Boolean theValue)
+{
+ MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToTagSubdomains");
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetToTagSubdomains(theValue);
+ SMESH::TPythonDump() << _this() << ".SetToTagSubdomains( " << theValue << " )";
+}
+
+void GHS3DPRLPlugin_Hypothesis_i::SetToOutputInterfaces (CORBA::Boolean theValue)
+{
+ MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToOutputInterfaces");
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetToOutputInterfaces(theValue);
+ SMESH::TPythonDump() << _this() << ".SetToOutputInterfaces( " << theValue << " )";
+}
+
+void GHS3DPRLPlugin_Hypothesis_i::SetToDiscardSubdomains (CORBA::Boolean theValue)
+{
+ MESSAGE("GHS3DPRLPlugin_Hypothesis_i::SetToDiscardSubdomains");
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetToDiscardSubdomains(theValue);
+ SMESH::TPythonDump() << _this() << ".SetToDiscardSubdomains( " << theValue << " )";
}
//=============================================================================
* GHS3DPRLPlugin_Hypothesis_i::GetNbPart
* GHS3DPRLPlugin_Hypothesis_i::GetKeepFiles
* GHS3DPRLPlugin_Hypothesis_i::GetBackground
- * GHS3DPRLPlugin_Hypothesis_i::GetToMeshHoles
+ * GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains
+ * GHS3DPRLPlugin_Hypothesis_i::GetToTagSubdomains
+ * GHS3DPRLPlugin_Hypothesis_i::GetToOutputInterfaces
+ * GHS3DPRLPlugin_Hypothesis_i::GetToDiscardSubdomains
*/
//=============================================================================
MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetMEDName");
ASSERT(myBaseImpl);
CORBA::String_var c_s =
- CORBA::string_dup(this->GetImpl()->GetMEDName().c_str());
+ CORBA::string_dup(this->GetImpl()->GetMEDName().c_str());
return c_s._retn();
}
return this->GetImpl()->GetBackground();
}
-CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToMeshHoles()
+CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains()
+{
+ MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToMergeSubdomains");
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetToMergeSubdomains();
+}
+
+CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToTagSubdomains()
+{
+ MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToTagSubdomains");
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetToTagSubdomains();
+}
+
+CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToOutputInterfaces()
+{
+ MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToOutputInterfaces");
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->GetToOutputInterfaces();
+}
+
+CORBA::Boolean GHS3DPRLPlugin_Hypothesis_i::GetToDiscardSubdomains()
{
- MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToMeshHoles");
+ MESSAGE("GHS3DPRLPlugin_Hypothesis_i::GetToDiscardSubdomains");
ASSERT(myBaseImpl);
- return this->GetImpl()->GetToMeshHoles();
+ return this->GetImpl()->GetToDiscardSubdomains();
}
//=============================================================================
public:
// Constructor
GHS3DPRLPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
- int theStudyId,
- ::SMESH_Gen* theGenImpl);
+ int theStudyId,
+ ::SMESH_Gen* theGenImpl);
// Destructor
virtual ~GHS3DPRLPlugin_Hypothesis_i();
void SetBackground(CORBA::Boolean theVal);
CORBA::Boolean GetBackground();
- void SetToMeshHoles(CORBA::Boolean theVal);
- CORBA::Boolean GetToMeshHoles();
+ void SetToMergeSubdomains(CORBA::Boolean theVal);
+ CORBA::Boolean GetToMergeSubdomains();
+
+ void SetToTagSubdomains(CORBA::Boolean theVal);
+ CORBA::Boolean GetToTagSubdomains();
+
+ void SetToOutputInterfaces(CORBA::Boolean theVal);
+ CORBA::Boolean GetToOutputInterfaces();
+
+ void SetToDiscardSubdomains(CORBA::Boolean theVal);
+ CORBA::Boolean GetToDiscardSubdomains();
// Get implementation
::GHS3DPRLPlugin_Hypothesis* GetImpl();
// Algorithms
if (strcmp(aHypName, "GHS3DPRL_3D") == 0 ||
- strcmp(aHypName, "MG-Tetra Parallel") == 0)
+ strcmp(aHypName, "MG-Tetra Parallel") == 0)
aCreator = new GHS3DPRLPlugin_Creator_i<GHS3DPRLPlugin_GHS3DPRL_i>;
// Hypotheses
else if (strcmp(aHypName, "GHS3DPRL_Parameters") == 0 ||
: SMESHGUI_GenericHypothesisCreator( theHypType ),
myIs3D( true )
{
- printf("Hypo creator !!!!!!!!!!!!!!!!!!!!!!!!!! RNV");
+ //printf("Hypo creator GHS3DPRLPlugin !!!!!!!!!!!!!!!!!!!!!!!!!! RNV");
}
GHS3DPRLPluginGUI_HypothesisCreator::~GHS3DPRLPluginGUI_HypothesisCreator()
myBackground->setWhatsThis( tr( "GHS3DPRL_WhatsThis_Background" ) );
l->addWidget( myBackground, row++, 0, 1, 2 );
- myToMeshHoles = new QCheckBox( tr( "GHS3DPRL_ToMeshHoles" ), GroupC1 );
- myToMeshHoles->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToMeshHoles" ) );
- l->addWidget( myToMeshHoles, row++, 0, 1, 2 );
+ //myToMeshHoles = new QCheckBox( tr( "GHS3DPRL_ToMeshHoles" ), GroupC1 );
+ //myToMeshHoles->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToMeshHoles" ) );
+ //l->addWidget( myToMeshHoles, row++, 0, 1, 2 );
+
+ myToMergeSubdomains = new QCheckBox( tr( "GHS3DPRL_ToMergeSubdomains" ), GroupC1 );
+ myToMergeSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToMergeSubdomains" ) );
+ l->addWidget( myToMergeSubdomains, row++, 0, 1, 2 );
+
+ myToTagSubdomains = new QCheckBox( tr( "GHS3DPRL_ToTagSubdomains" ), GroupC1 );
+ myToTagSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToTagSubdomains" ) );
+ l->addWidget( myToTagSubdomains, row++, 0, 1, 2 );
+
+ myToOutputInterfaces = new QCheckBox( tr( "GHS3DPRL_ToOutputInterfaces" ), GroupC1 );
+ myToOutputInterfaces->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToOutputInterfaces" ) );
+ l->addWidget( myToOutputInterfaces, row++, 0, 1, 2 );
+
+ myToDiscardSubdomains = new QCheckBox( tr( "GHS3DPRL_ToDiscardSubdomains" ), GroupC1 );
+ myToDiscardSubdomains->setWhatsThis( tr( "GHS3DPRL_WhatsThis_ToDiscardSubdomains" ) );
+ l->addWidget( myToDiscardSubdomains, row++, 0, 1, 2 );
myIs3D = true;
myNbPart->setValue( data.myNbPart );
myKeepFiles->setChecked( data.myKeepFiles );
myBackground->setChecked( data.myBackground );
- myToMeshHoles->setChecked( data.myToMeshHoles );
+ //myToMeshHoles->setChecked( data.myToMeshHoles );
+ myToMergeSubdomains->setChecked( data.myToMergeSubdomains );
+ myToTagSubdomains->setChecked( data.myToTagSubdomains );
+ myToOutputInterfaces->setChecked( data.myToOutputInterfaces );
+ myToDiscardSubdomains->setChecked( data.myToDiscardSubdomains );
//myNbPart->setEnabled( true );
}
QString valStr;
valStr += tr( "GHS3DPRL_MEDName" ) + " = " + data.myMEDName + "; ";
valStr += tr( "GHS3DPRL_NbPart" ) + " = " + QString::number( data.myNbPart ) + "; ";
- valStr += tr( "GHS3DPRL_ToMeshHoles" ) + " = " + QString::number( data.myToMeshHoles ) + "; ";
+ //valStr += tr( "GHS3DPRL_ToMeshHoles" ) + " = " + QString::number( data.myToMeshHoles ) + "; ";
+ valStr += tr( "GHS3DPRL_ToMergeSubdomains" ) + " = " + QString::number( data.myToMergeSubdomains ) + "; ";
+ valStr += tr( "GHS3DPRL_ToTagSubdomains" ) + " = " + QString::number( data.myToTagSubdomains ) + "; ";
+ valStr += tr( "GHS3DPRL_ToOutputInterfaces" ) + " = " + QString::number( data.myToOutputInterfaces ) + "; ";
+ valStr += tr( "GHS3DPRL_ToDiscardSubdomains" ) + " = " + QString::number( data.myToDiscardSubdomains ) + "; ";
valStr += tr( "GHS3DPRL_KeepFiles" ) + " = " + QString::number( data.myKeepFiles ) + "; ";
valStr += tr( "GHS3DPRL_Background" ) + " = " + QString::number( data.myBackground ) + "; ";
h_data.myNbPart = h->GetNbPart();
h_data.myKeepFiles = h->GetKeepFiles();
h_data.myBackground = h->GetBackground();
- h_data.myToMeshHoles = h->GetToMeshHoles();
+ //h_data.myToMeshHoles = h->GetToMeshHoles();
+ h_data.myToMergeSubdomains = h->GetToMergeSubdomains();
+ h_data.myToTagSubdomains = h->GetToTagSubdomains();
+ h_data.myToOutputInterfaces = h->GetToOutputInterfaces();
+ h_data.myToDiscardSubdomains = h->GetToDiscardSubdomains();
return true;
}
h->SetNbPart( h_data.myNbPart );
h->SetKeepFiles( h_data.myKeepFiles );
h->SetBackground( h_data.myBackground );
- h->SetToMeshHoles( h_data.myToMeshHoles );
+ //h->SetToMeshHoles( h_data.myToMeshHoles );
+ h->SetToMergeSubdomains( h_data.myToMergeSubdomains );
+ h->SetToTagSubdomains( h_data.myToTagSubdomains );
+ h->SetToOutputInterfaces( h_data.myToOutputInterfaces );
+ h->SetToDiscardSubdomains( h_data.myToDiscardSubdomains );
}
catch ( const SALOME::SALOME_Exception& ex )
{
h_data.myNbPart = myNbPart->value();
h_data.myKeepFiles = myKeepFiles->isChecked();
h_data.myBackground = myBackground->isChecked();
- h_data.myToMeshHoles = myToMeshHoles->isChecked();
+ //h_data.myToMeshHoles = myToMeshHoles->isChecked();
+ h_data.myToMergeSubdomains = myToMergeSubdomains->isChecked();
+ h_data.myToTagSubdomains = myToTagSubdomains->isChecked();
+ h_data.myToOutputInterfaces = myToOutputInterfaces->isChecked();
+ h_data.myToDiscardSubdomains = myToDiscardSubdomains->isChecked();
return true;
}
int myNbPart;
bool myKeepFiles;
bool myBackground;
- bool myToMeshHoles;
+ //bool myToMeshHoles;
+ bool myToMergeSubdomains;
+ bool myToTagSubdomains;
+ bool myToOutputInterfaces;
+ bool myToDiscardSubdomains;
} GHS3DPRLHypothesisData;
/*!
QtxIntSpinBox* myNbPart;
QCheckBox* myKeepFiles;
QCheckBox* myBackground;
- QCheckBox* myToMeshHoles;
+ //QCheckBox* myToMeshHoles;
+ QCheckBox* myToMergeSubdomains;
+ QCheckBox* myToTagSubdomains;
+ QCheckBox* myToOutputInterfaces;
+ QCheckBox* myToDiscardSubdomains;
bool myIs3D;
};
</message>
<message>
<source>GHS3DPRL_Background</source>
- <translation>Tepal in background</translation>
+ <translation>Tetra_hpc in background</translation>
</message>
<message>
<source>GHS3DPRL_ToMeshHoles</source>
- <translation>To mesh holes</translation>
+ <translation>Mesh holes</translation>
+ </message>
+ <message>
+ <source>GHS3DPRL_ToMergeSubdomains</source>
+ <translation>Merge subdomains</translation>
+ </message>
+ <message>
+ <source>GHS3DPRL_ToTagSubdomains</source>
+ <translation>Tag subdomains</translation>
+ </message>
+ <message>
+ <source>GHS3DPRL_ToOutputInterfaces</source>
+ <translation>Output interfaces</translation>
+ </message>
+ <message>
+ <source>GHS3DPRL_ToDiscardSubdomains</source>
+ <translation>Discard subdomains</translation>
</message>
<message>
<source>GHS3DPRL_MEDName</source>
<name>@default</name>
<message>
<source>GHS3DPRL_3D_HYPOTHESIS</source>
- <translation>GHS3DPRL 3D</translation>
+ <translation>Paramètres MG-Tetra-hpc</translation>
</message>
<message>
<source>GHS3DPRL_3D_TITLE</source>
</message>
<message>
<source>GHS3DPRL_KeepFiles</source>
- <translation>Sauvegarder les fichiers</translation>
+ <translation>Garder les fichiers intermédiaires</translation>
</message>
<message>
<source>GHS3DPRL_Background</source>
- <translation>Tepal en arrière plan</translation>
+ <translation>Tetra_hpc en arrière plan</translation>
</message>
<message>
<source>GHS3DPRL_ToMeshHoles</source>
- <translation>Mailler les trous</translation>
+ <translation>Mailler les trous du maillage</translation>
+ </message>
+ <message>
+ <source>GHS3DPRL_ToMergeSubdomains</source>
+ <translation>Fusionner les sous domaines en fin</translation>
+ </message>
+ <message>
+ <source>GHS3DPRL_ToTagSubdomains</source>
+ <translation>Marquer les sous domaines</translation>
+ </message>
+ <message>
+ <source>GHS3DPRL_ToOutputInterfaces</source>
+ <translation>Gestion des interfaces entre les sous domaines</translation>
+ </message>
+ <message>
+ <source>GHS3DPRL_ToDiscardSubdomains</source>
+ <translation>Oublier les sous domaines</translation>
</message>
<message>
<source>GHS3DPRL_MEDName</source>
</message>
<message>
<source>GHS3DPRL_WhatsThis_KeepFiles</source>
- <translation>Préserver les fichiers Tepal intermédiaires (.faces,.points,.msg,.noboite...)</translation>
+ <translation>Préserver les fichiers intermédiaires (.faces,.points,.msg,.noboite...)</translation>
</message>
<message>
<source>GHS3DPRL_WhatsThis_Background</source>
- <translation>Lancer Tepal en arrière-plan (prend du temps pour un maillage de grand volume...)</translation>
+ <translation>Lancer MG-Tetra-hpc en arrière-plan (prend du temps pour un maillage de grand volume...)</translation>
</message>
<message>
<source>GHS3DPRL_WhatsThis_ToMeshHoles</source>
- <translation>Tepal maille les trous</translation>
+ <translation>MG-Tetra-hp maille les trous (obsolète)</translation>
</message>
<message>
<source>GHS3DPRL_WhatsThis_MEDName</source>
ghs3dprl_mesh_wrap.cxx
ghs3dprl_msg_parser.cxx
dlg_ghs3dmain.cxx
- tepal2med.cxx
)
# resource files / to be processed by uic
QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
# sources / to compile
-SET(tepal2med_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS})
+SET(tepal2med_SOURCES tepal2med.cxx ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS})
+SET(tetrahpc2med_SOURCES tetrahpc2med.cxx ${_other_SOURCES} ${_moc_SOURCES} ${_uic_HEADERS})
# --- rules ---
ADD_EXECUTABLE(tepal2med ${tepal2med_SOURCES})
+ADD_EXECUTABLE(tetrahpc2med ${tetrahpc2med_SOURCES})
TARGET_LINK_LIBRARIES(tepal2med ${_link_LIBRARIES})
-INSTALL(TARGETS tepal2med EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
+TARGET_LINK_LIBRARIES(tetrahpc2med ${_link_LIBRARIES})
+INSTALL(TARGETS tepal2med tetrahpc2med EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
return true;
}
+//************************************
+bool CVW_FindStringInFirstLines(const std::string &str,std::fstream &Ff, long &maxline)
+//find in file maximum maxline first lines with string str in first position of line
+//converts count value expected after " " in line found
+{
+ std::string line;
+ long nbLine=0;
+ do
+ {
+ if (getline(Ff,line))
+ {
+ nbLine++;
+ if (line[0]==str[0]) //faster
+ {
+ if (line.find(str)==0)
+ {
+ return true;
+ }
+ }
+ if (nbLine>=maxline)
+ {
+ std::cerr<<"Problem line '"<<str<<"' not found in first "<<maxline<<" lines of file\n"<<std::endl;
+ return false;
+ }
+ }
+ else
+ {
+ std::cerr<<"Problem line '"<<str<<"' not found in all file\n"<<std::endl;
+ return false;
+ }
+ } while (1);
+ return true;
+}
+
//************************************
bool ghs3dprl_mesh_wrap::ReadFileMSGnew(const QString FileName)
//read file .glo with no parser xml because big file (volume)
return true;
}
+//************************************
+bool ghs3dprl_mesh_wrap::TestExistingFileMESHnew(const QString FileName)
+//read file .glo with no parser xml because big file (volume)
+//no read of <receive> for speed (and so no test)
+{
+ QString tmp;
+ std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in);
+ std::string line;
+ long i,count,meshversion,maxline;
+ bool ok;
+
+ if (!Ff.is_open())
+ {
+ std::cerr<<"Problem File '"<<FileName.toLatin1().constData()<<"' not open\n"<<std::endl;
+ return false;
+ }
+
+ //Lit les donn�s au debut du fichier, 1 lignes maxi:
+ maxline=1;
+ if (!CVW_FindStringInFirstLines("MeshVersionFormatted",Ff,maxline)) return false;
+ if (verbose>2) std::cout<<"MeshVersionFormatted_"<<this->nofile<<" ok"<<std::endl;
+
+ //Ferme le fichier :
+ Ff.close();
+ this->nbfiles++;
+ return true;
+}
+
///************************************
bool ghs3dprl_mesh_wrap::ReadFileGLO(const QString FileName)
//read file .glo with no parser xml because big file (volume)
return true;
}
+//************************************
+bool ghs3dprl_mesh_wrap::ReadFileMESH(const QString FileName)
+//read file .mesh from tetra_hpc (with volume)
+{
+ std::string line(" ");
+ QString tmp;
+ std::fstream Ff(FileName.toLatin1().constData(),std::ios_base::in);
+ long Mversion=0,Mdim=0,Mvert=0,Mtria=0,Mtetra=0;
+ med_int garbage;
+ //long ne,np,npfixe,subnumber,reste;
+ bool ok;
+ if (verbose>=6)std::cout<<"Read File '"<<FileName.toLatin1().constData()<<std::endl;
+ if (!Ff.is_open()){
+ std::cerr<<"Problem File '"<<FileName.toLatin1().constData()<<"' not open\n"<<std::endl;
+ return false;
+ }
+
+ //lit les données :
+ if (getline(Ff,line) && (line.find("MeshVersionFormatted")==0))
+ {
+ tmp=line.c_str();
+ Mversion=tmp.section(' ',1,1).toLong(&ok);
+ }
+ else
+ {
+ std::cerr<<"Problem on line 1 of file: 'MeshVersionFormatted' expected"<<std::endl;
+ return false;
+ }
+
+ getline(Ff,line);
+
+ if (getline(Ff,line) && (line.find("Dimension 3")==0))
+ {
+ tmp=line.c_str();
+ Mdim=tmp.section(' ',1,1).toLong(&ok);
+ }
+ else
+ {
+ std::cerr<<"Problem on line 3 of file: Dimension 3 expected"<<std::endl;
+ return false;
+ }
+
+ getline(Ff,line);
+
+ if (!(getline(Ff,line) && (line.find("Vertices")==0)))
+ {
+ std::cerr<<"Problem on line 5 of file: 'Vertices' expected"<<std::endl;
+ return false;
+ }
+ if (getline(Ff,line))
+ {
+ tmp=line.c_str();
+ Mvert=tmp.toLong(&ok);
+ }
+ else
+ {
+ std::cerr<<"Problem on line 6 of file: a positive integer is expected"<<std::endl;
+ return false;
+ }
+ if (Mvert<=0)
+ {
+ std::cerr<<"Problem on line 6 of file: a positive integer is expected"<<std::endl;
+ return false;
+ }
+
+ med_float *tmflo=new med_float[Mvert*3];
+ for (int i=0; i<Mvert*3; i=i+3) Ff>>tmflo[i]>>tmflo[i+1]>>tmflo[i+2]>>garbage;
+ if (verbose>4) std::cout<<"Vertices "<<tmflo[0]<<" "<<tmflo[1]<<"... "<<tmflo[Mvert*3-1]<<std::endl;
+
+ CVWtab *montab=new CVWtab(Mvert*3,tmflo);
+ tmp=tmp.sprintf("NB%ld VC",this->nofile);
+ ok=this->insert_key(tmp,montab);
+
+ getline(Ff,line);
+ getline(Ff,line);
+
+ if (!(getline(Ff,line) && (line.find("Triangles")==0)))
+ {
+ std::cerr<<"Problem on line 'Triangles' of file: not found"<<line<<std::endl;
+ return false;
+ }
+ if (getline(Ff,line))
+ {
+ tmp=line.c_str();
+ Mtria=tmp.toLong(&ok);
+ }
+ else
+ {
+ std::cerr<<"Problem on line 'Triangles' of file: a positive integer is expected"<<std::endl;
+ return false;
+ }
+ if (Mtria<=0)
+ {
+ std::cerr<<"Problem on line 'Triangles' of file: a positive integer is expected"<<std::endl;
+ return false;
+ }
+
+ med_int *tmint=new med_int[Mtria*7]; //*7 as older files .faces
+ for (int i=0; i<Mtria*7; i=i+7) {
+ Ff>>tmint[i]>>tmint[i+1]>>tmint[i+2]>>garbage;
+ tmint[i+3]=0;
+ tmint[i+4]=0;
+ tmint[i+5]=0;
+ tmint[i+6]=0;
+ }
+ if (verbose>4) std::cout<<"Triangles "<<tmint[0]<<" "<<tmint[1]<<"... "<<
+ tmint[Mtria*7-5]<<" "<<tmint[Mtria*7-4]<<" "<<tmint[Mtria*7-3]<<" "<<
+ tmint[Mtria*7-2]<<" "<<tmint[Mtria*7-1]<<std::endl;
+
+ montab=new CVWtab(Mtria*7,tmint);
+ tmp=tmp.sprintf("FC%ld",this->nofile);
+ ok=this->insert_key(tmp,montab);
+
+ getline(Ff,line);
+ getline(Ff,line);
+
+ if (!(getline(Ff,line) && (line.find("Tetrahedra")==0)))
+ {
+ std::cerr<<"Problem on line 'Tetrahedra' of file: not found"<<std::endl;
+ return false;
+ }
+ if (getline(Ff,line))
+ {
+ tmp=line.c_str();
+ Mtetra=tmp.toLong(&ok);
+ }
+ else
+ {
+ std::cerr<<"Problem on line 'Tetrahedra' of file: a positive integer is expected"<<std::endl;
+ return false;
+ }
+ if (Mtetra<=0)
+ {
+ std::cerr<<"Problem on line 'Tetrahedra' of file: a positive integer is expected"<<std::endl;
+ return false;
+ }
+
+ if (verbose>=2)
+ {
+ std::cout<<"MeshVersionFormatted="<<Mversion<<std::endl;
+ std::cout<<"MeshDimension="<<Mdim<<std::endl;
+ std::cout<<"MeshNumberOfVertices="<<Mvert<<std::endl;
+ std::cout<<"MeshNumberOfTriangles="<<Mtria<<std::endl;
+ std::cout<<"MeshNumberOfTetrahedra="<<Mtetra<<std::endl;
+ }
+
+ tmint=new med_int[Mtetra*4];
+ for (int i=0; i<Mtetra*4; i=i+4) Ff>>tmint[i]>>tmint[i+1]>>tmint[i+2]>>tmint[i+3]>>garbage;
+ if (verbose>4) std::cout<<"Tetrahedra "<<tmint[0]<<" "<<tmint[1]<<"... "<<tmint[Mtetra*4-1]<<std::endl;
+
+ montab=new CVWtab(Mtetra*4,tmint);
+ tmp=tmp.sprintf("NB%ld EV",this->nofile);
+ ok=this->insert_key(tmp,montab);
+
+ //swap on file if too big for memory in one cpu
+ //default 1GOctet/8(for double)/10(for arrays in memory at the same time)
+ if (Mvert*3>this->nbelem_limit_swap)
+ this->SwapOutOfMemory_key_mesh_wrap(QRegExp("NB",Qt::CaseSensitive,QRegExp::RegExp));
+ //beware record 6 lenght 1
+ //ferme le fichier :
+ Ff.close();
+ this->nbfiles++;
+ return true;
+}
+
//************************************
bool ghs3dprl_mesh_wrap::ReadFileNOBOITE(const QString FileName)
//read file .noboite (volume)
//Creating child nodes
//Version tag
med_int majeur,mineur,release;
- //Quelle version de MED est utilis�
+ //Quelle version de MED est utilisee
MEDlibraryNumVersion(&majeur,&mineur,&release);
if (verbose>0) fprintf(stdout,"Files write with MED V%d.%d.%d\n",majeur,mineur,release);
node = xmlNewChild(root_node, 0, BAD_CAST "version",0);
//Description tag
node = xmlNewChild(root_node,0, BAD_CAST "description",0);
- xmlNewProp(node, BAD_CAST "what", BAD_CAST "tetrahedral mesh by tepal");
+ xmlNewProp(node, BAD_CAST "what", BAD_CAST "tetrahedral mesh by MeshGems-Tetra-hpc (formerly tepal)");
#ifdef WIN32
SYSTEMTIME present;
GetLocalTime ( &present );
cmd.toLatin1().constData()<<"> does not exist\n"; }
//define family 0 if not existing, no groups
- families.add("0","");
+ //La famille FAMILLE_ZERO n'a pas été trouvée, elle est obligatoire
+ families.add("0","FAMILLE_ZERO");
//define family Group_of_New_Nodes (which not exists before tetrahedra)
famallnodes=0;
if (QString("All_Nodes").contains(deletegroups)==0){
MEDfileClose(fid); //but loop on others domains
}
+
MEDfileClose(fidjoint); //no error
if (verbose>0)std::cout<<"\nTotalNumberOftetrahedra="<<nbtetrastotal<<std::endl;
key=key.sprintf("NB%d VC",idom); //files.NoBoite Vertex Coordinates
tab=this->restore_key(key); //tab1=this->mestab[key1];
if (!tab) {
- tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".noboite";
- ok=this->ReadFileNOBOITE(tmp);
+ if (!for_tetrahpc) {
+ tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".noboite";
+ ok=this->ReadFileNOBOITE(tmp);
+ }
+ if (for_tetrahpc) {
+ tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".mesh";
+ ok=this->ReadFileMESH(tmp);
+ }
tab=this->restore_key(key); //tab1=this->mestab[key1];
if (!tab) return false;
}
key1=key1.sprintf("GL%d VE",idom); //global numerotation
tab1=this->restore_key(key1); //tab1=this->mestab[key1];
if (!tab1) {
- tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".glo";
- ok=this->ReadFileGLO(tmp);
+ if (!for_tetrahpc) {
+ tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".glo";
+ ok=this->ReadFileGLO(tmp);
+ }
+ if (for_tetrahpc) {
+ tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".glo";
+ ok=this->ReadFileGLO(tmp);
+ }
if (!ok) {std::cerr<<"Problem file "<<tmp.toLatin1().constData()<<std::endl; return false;}
tab1=this->restore_key(key1); //tab1=this->mestab[key1];
if (!tab1) return false;
//qt3 if (this->nb_key_mesh_wrap(QRegExp(tmp,true,true))<=0) {
if (this->nb_key_mesh_wrap(QRegExp(tmp,Qt::CaseSensitive,QRegExp::RegExp))<=0) {
this->nofile=idom;
- /*old version with xml parser too slow
- ghs3dprl_msg_parser handler;
- handler.mailw=this;
- QXmlSimpleReader reader;
- reader.setContentHandler(&handler);
- tmp=pathini+casename+tmp.sprintf(format,nbfilestot,idom)+".msg";
- QFile File(tmp);
- QXmlInputSource source(&File);
- reader.parse(source);
- File.close();*/
- tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".msg";
+
+ if (!for_tetrahpc) {
+ tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,idom)+".msg";
+ }
+ if (for_tetrahpc) {
+ tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),idom)+".msg";
+ }
+
ok=this->ReadFileMSGnew(tmp);
if (!ok) {
std::cerr<<"Problem in file "<<tmp.toLatin1().constData()<<std::endl;
tab2=this->restore_key(key1);
//if not yet loaded (first time) try to load necessary file msg of neighbourg
if (!tab2) {
- tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,ineig)+".msg";
+
+ if (!for_tetrahpc) {
+ tmp=pathini+casename+tmp.sprintf(format.toLatin1().constData(),nbfilestot,ineig)+".msg";
+ }
+ if (for_tetrahpc) {
+ tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),ineig)+".msg";
+ }
+
this->nofile=ineig; //neighbourg file
ok=this->ReadFileMSGnew(tmp);
this->nofile=idom; //restaure initial domain
//two indices for one correspondence
arrayi=new med_int[nb*2];
arraynodes=new med_float[nbnodesneig*3]; //for file DOMAIN_join.med
- inodes=new med_int[nbnodes]; //for file DOMAIN_join.med
+ inodes=new med_int[nbnodes]; //for file DOMAIN_join.med
med_int * fammore=new med_int[nbnodes];
- for (i=0; i<nbnodes ; i++) {fammore[i]=0; inodes[i]=-1;}
- ii=0; jj=0; k=0;
+ for (i=0; i<nbnodes ; i++) {fammore[i]=0; inodes[i]=-2;} //precautions
+ ii=0; jj=0; k=1;
for (i=0; i<nb ; i++){
//no need because <send> equals <receive> tab1->tmint[i]==tab2->tmint[i]
- j=tab1->tmint[i]-1; //contents of tab1 1 to nb
- inodes[j]=k; k++; //indices 0->n-1 of nodes of joint from nodes of domain
+ j=tab1->tmint[i]-1; //contents of tab1 1->nb, j 0->nb-1
+ inodes[j]=k; k++; //contents of inodes 1->n ,nodes of joint from nodes of domain
arraynodes[jj]=tab->tmflo[j*3]; jj++;
arraynodes[jj]=tab->tmflo[j*3+1]; jj++;
arraynodes[jj]=tab->tmflo[j*3+2]; jj++;
key1=key1.sprintf("MS%d NE%d FA SE",ineig,idom); //SE or RE identicals
tab2=this->restore_key(key1);
if (!tab2) std::cerr<<"Problem existing triangles of joint in domain "<<idom<<
- " with none in neighbourg "<<ineig<<" files .msg"<<std::endl;
+ " with none in neighbourg "<<ineig<<" files .msg"<<std::endl;
nb=tab1->size; nbtria3neig=tab2->size;
if (nb!=nbtria3neig) {
std::cerr<<"Problem in file "<<tmp.toLatin1().constData()<<
tab=this->restore_key(key); //tab1=this->mestab[key1];
med_int nb=tab1->size; nbtria3neig=nb;
- if (verbose>4)
- std::cout<<"NumberOfTrianglesOfJoint_"<<idom<<"_"<<ineig<<"="<<nb<<std::endl;
- arrayi=new med_int[nb*2];
+ //if (verbose>=0) std::cout<<"NumberOfTrianglesOfJoint_"<<idom<<"_"<<ineig<<"="<<nb<<std::endl;
+ arrayi=new med_int[nb*2]; //correspondance indices triangles in 2 domains
arrayfaces=new med_int[nbtria3neig*3]; //for file DOMAIN_join.med
+ for (i=0; i<nbtria3neig*3 ; i++) arrayfaces[i]=-1; //precaution
fammore=new med_int[nbtria3];
for (i=0; i<nbtria3 ; i++) fammore[i]=0;
ii=0; jj=0;
for (i=0; i<nb ; i++){
arrayi[ii]=tab1->tmint[i]; ii++;
+ arrayi[ii]=tab2->tmint[i]; ii++; //correspondance indices triangles in 2 domains
+
fammore[tab1->tmint[i]-1]=famjoint;
//famtria3[tab1->tmint[i]-1]=famjoint;
- arrayi[ii]=tab2->tmint[i]; ii++;
- //std::cout<<arrayi[ii-1]<<"="<<arrayi[ii-2]<<std::endl;
- k=(tab1->tmint[i]-1)*7; //indice of node connectivity
- arrayfaces[jj]=inodes[tab->tmint[k]-1]+1; jj++;
- arrayfaces[jj]=inodes[tab->tmint[k+1]-1]+1; jj++;
- arrayfaces[jj]=inodes[tab->tmint[k+2]-1]+1; jj++;
+
+ k=tab1->tmint[i]-1; //indice of node connectivity
+ //std::cout<<"k="<<k<<std::endl;
+ k=k*7; //indice of node connectivity in tab of triangles
+
+ arrayfaces[jj]=inodes[tab->tmint[k]-1]; jj++;
+ arrayfaces[jj]=inodes[tab->tmint[k+1]-1]; jj++;
+ arrayfaces[jj]=inodes[tab->tmint[k+2]-1]; jj++;
+ }
+ int happens=0;
+ for (i=0; i<nbtria3neig*3 ; i++) {
+ if (arrayfaces[i]<=0) {
+ std::cerr<<"Problem file X_joints.med unknown node in joint "<<idom<<"_"<<ineig<<" face "<<i/3+1<<std::endl; //precaution
+ happens=1;
+ }
+ }
+ /*TODO DEBUG may be bug distene?
+ if (happens==1) {
+ std::cout<<"\nNumberOfTrianglesOfJoint_"<<idom<<"_"<<ineig<<"="<<nb<<std::endl;
+ for (i=0; i<nbnodes ; i++) std::cout<<"inode i "<<i+1<<" "<<inodes[i]<<std::endl;
+ for (i=0; i<tab1->size ; i++) std::cout<<"triangle i "<<i+1<<" "<<tab1->tmint[i]<<std::endl;
+ for (i=0; i<tab->size ; i=i+7) std::cout<<"conn i "<<i/7+1<<" : "<<tab->tmint[i]<<" "<<tab->tmint[i+1]<<" "<<tab->tmint[i+2]<<std::endl;
}
+ */
if (namejoint.contains(deletegroups)==0){
ok=set_one_more_family(famtria3,fammore,nbtria3);
}
err=MEDmeshEntityNumberWr(fidjoint,namejnt,MED_NO_DT,MED_NO_IT,MED_NODE,MED_UNDEF_GEOMETRY_TYPE,nbnodesneig,arrayi);
delete[] arrayi;
if (err<0) std::cerr<<"Problem MEDmeshEntityNumberWr of nodes "<<namejnt<<std::endl;
-
+ //families zero in file fidjoint ???
+ //La famille FAMILLE_ZERO n'a pas été trouvée, elle est obligatoire
+ nb=create_family_zero(fidjoint,namejnt);
+
//write tria3
if (nbtria3neig>0) {
//for (i=0; i<nbtria3neig ; i++) std::cout<<i+1<<" "<<
}
if (verbose>5)std::cout<<std::endl;
err=MEDfamilyCr(fid,nomfinal,nomfam,num,ngro,gro);
- if (err<0) std::cerr<<"Problem MEDfamilyCr"<<std::endl;
delete[] gro;
if (err<0) std::cerr<<"Problem MEDfamilyCr of "<<nomfam<<std::endl;
}
return ires;
}
+med_int ghs3dprl_mesh_wrap::create_family_zero(med_idt fid, QString nameMesh)
+{
+ med_int pas,ires;
+ ires=0;
+ char nomfam[MED_NAME_SIZE+1]="FAMILLE_ZERO"; //it.current()->name;
+ char attdes[MED_COMMENT_SIZE+1]="_NO_DESCRIPTION";
+
+ char *gro;
+ med_int i,attide=1,attval=1,natt=1,num=0,ngro=0;
+
+ gro=new char[MED_LNAME_SIZE*ngro+2];
+ if (verbose>3)std::cout<<"\ncreate_family_ZERO "<<nameMesh.toLatin1().constData()<<std::endl;
+ err=MEDfamilyCr(fid,nameMesh.toLatin1().constData(),nomfam,num,ngro,gro);
+ if (err<0) std::cerr<<"Problem MEDfamilyCr FAMILLE_ZERO of "<<nameMesh.toLatin1().constData()<<std::endl;
+ delete[] gro;
+ return ires;
+}
+
+
+
class ghs3dprl_mesh_wrap
{
public:
- QString medname,casename,path,pathini,filemed,format;
+ QString medname,casename,path,pathini,filemed,format,format_tetra;
+ bool for_tetrahpc; //to know what files to read: .noboite or .mesh
QRegExp deletegroups; //regular expression
long
nbtetrastotal,
//family level
bool set_one_more_family(med_int *fami, med_int *more, med_int nb);
- med_int create_families(med_idt fid,int sign);
+ med_int create_families(med_idt fid, int sign);
+ med_int create_family_zero(med_idt fid, QString nameMesh);
void add_family(med_int num,QString newgro);
void cout_families_and_groups();
bool idom_nodes();
//hight level
long SwapOutOfMemory_key_mesh_wrap(const QRegExp &rxp,long ifgreaterthan=0);
bool ReadFileMSGnew(const QString FileName);
+ bool TestExistingFileMESHnew(const QString FileName);
bool ReadFileGLO(const QString FileName);
bool ReadFileFACES(const QString FileName);
+ bool ReadFileMESH(const QString FileName);
bool ReadFileNOBOITE(const QString FileName);
bool ReadFileNOBOITEB(const QString FileName);
bool ReadFilePOINTS(const QString FileName);
ret = MEDfileClose(fid);
return false;
}
- if (mdim != 3){
- std::cerr<<"Problem mesh dimension should be 3: "<<mdim<<"\n";
+ //changed with version med: a triangles mesh in 3d is dim 2 now and 3 before 2014
+ if (mdim != 2 && mdim != 3){
+ std::cerr<<"Problem mesh dimension should be 2 or 3: "<<mdim<<"\n";
ret = MEDfileClose(fid);
return false;
}
med_float *coo=new med_float[nnoe*sdim];
/* table des numeros de familles des noeuds profil : (nombre de noeuds) */
med_int *famnodesskin=new med_int[nnoe];
- med_int *pfltab=new med_int[1]; //inutilise car on lit tout
+ //med_int *pfltab=new med_int[1]; //inutilise car on lit tout
//lecture des noeuds : coordonnees
ret=MEDmeshNodeCoordinateRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_FULL_INTERLACE,coo);
//mdim,coo,mode_coo,MED_ALL,pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo);
}
std::cout<<std::endl;
}
-
+ //std::cout<<"\ncvw1 conn nbtria3 "<<nbtria3<<"dt "<<MED_NO_DT<<"it "<<MED_NO_IT<<"cell "<<MED_CELL<<"tria3 "<<MED_TRIA3<<std::endl;
med_int *conn3=new med_int[nbtria3*3];
ret=MEDmeshElementConnectivityRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
- MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,pfltab);
+ MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,conn3);
//MEDconnLire(fid,mymailw->nommaa,mdim,conn3,mode_coo,pfltab,0,MED_MAILLE,MED_TRIA3,MED_NOD);
if (ret < 0){
std::cerr<<"Problem reading MED_TRIA3\n";
QString path,pathini,casename,casenamemed,fileskinmed,
tmp,cmd,format,
test,menu,launchtepal,background,deletegroups,
- version="V2.0 (MED3)";
+ version="V3.0 (MED3+tepalv1)";
char *chelp=NULL,
*ccasename=NULL,
if (menu=="yes") {
QApplication a(argc,argv);
dlg_ghs3dmain *m = new dlg_ghs3dmain();
- m->setWindowTitle("tepal2med 2.1");
+ m->setWindowTitle("tepal2med 3.0");
m->show();
a.exec();
if ( m->result() == QDialog::Accepted ) {
int nbf=format.length();
format=format.sprintf(".%%.%dd.%%.%dd",nbf,nbf);
mymailw->format=format;
+ mymailw->format_tetra=format; //here is tepal: not used
+ mymailw->for_tetrahpc=false; //to know what files to read: .noboite or .mesh
//something like "/home/wambeke/tmp/GHS3DPRL_skin.med"
fileskinmed=pathini+casename+"_skin.med";
--- /dev/null
+// Copyright (C) 2007-2013 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.
+//
+// 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
+//
+
+// ---
+// File : tetrahpc2med.cxx
+// Author : Christian VAN WAMBEKE (CEA)
+// ---
+//
+/*
+** prog principal de ghs3dprl
+*/
+
+#include <stdio.h> /* printf clrscr fopen fread fwrite fclose */
+#include <string>
+#include <cstring>
+#include <cstdlib>
+#include <iostream>
+#include <sstream>
+#include <fstream>
+#include <vector>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
+#include <qstring.h>
+
+#include <QXmlSimpleReader>
+#include <QXmlInputSource>
+#include <QApplication>
+
+#include "ghs3dprl_msg_parser.h"
+#include "dlg_ghs3dmain.h"
+
+#ifdef WIN32
+#include <io.h>
+#include <windows.h>
+#define F_OK 0
+#endif
+
+//#include "MEDMEM_Exception.hxx"
+//#include "MEDMEM_define.hxx"
+
+extern "C" {
+#include <med.h>
+//#include <med_config.h>
+//#include <med_utils.h>
+//#include <med_misc.h>
+}
+
+//************************************
+med_idt ouvre_fichier_MED(char *fichier,int verbose)
+{
+ med_idt fid = 0;
+ med_err ret = 0;
+ med_int majeur,mineur,release;
+
+ /* on regarde si le fichier existe */
+ ret = (int) access(fichier,F_OK);
+ if (ret < 0) return fid;
+
+ /* on regarde s'il s'agit d'un fichier au format HDF5 */
+ med_bool hdfok,medok;
+ ret = MEDfileCompatibility(fichier,&hdfok,&medok);
+ if (ret < 0){
+ std::cerr<<"File "<<fichier<<" not MED or HDF V5 formatted\n";
+ return fid;
+ }
+
+ /* Quelle version de MED est utilise par mdump ? */
+ MEDlibraryNumVersion(&majeur,&mineur,&release);
+ if (verbose>0)fprintf(stdout,"\nReading %s with MED V%d.%d.%d",
+ fichier,majeur,mineur,release);
+
+ /* Ouverture du fichier MED en lecture seule */
+ fid = MEDfileOpen(fichier,MED_ACC_RDONLY);
+ if (ret < 0) return fid;
+
+ MEDfileNumVersionRd(fid, &majeur, &mineur, &release);
+ if (majeur < 2 || majeur == 2 && mineur < 2) {
+ fprintf(stderr,"File %s from MED V%d.%d.%d not assumed\n",
+ fichier,majeur,mineur,release);
+ //" version est ant�ieure �la version 2.2";
+ ret = MEDfileClose(fid);
+ fid=0; }
+ else {
+ if (verbose>0)fprintf(stdout,", file from MED V%d.%d.%d\n",majeur,mineur,release); }
+
+ return fid;
+}
+
+//************************************
+bool ReadFileMED(QString nomfilemed,ghs3dprl_mesh_wrap *mymailw)
+{
+ med_err ret;
+ med_idt fid=0;
+ med_int i,j,sdim,mdim,nmaa,edim,majeur_lu,mineur_lu,release_lu,nprofils,nstep;
+ med_mesh_type type_maillage;
+ char dtunit[MED_SNAME_SIZE+1];
+ char axisname[MED_SNAME_SIZE+1];
+ char axisunit[MED_SNAME_SIZE*3+1];
+ med_sorting_type sortingtype;
+ med_axis_type axistype;
+ int numero=1;
+ QString key,tmp;
+ med_bool chan;
+ med_bool tran;
+
+ //version qt3
+ char* chaine = (char*)malloc((nomfilemed.length()+1)*sizeof(char));
+ strncpy(chaine,nomfilemed.toLatin1().constData(),nomfilemed.length()+1);
+ //std::cout<<"*** ReadFileMED *** "<<chaine<<"\n";
+
+ fid=ouvre_fichier_MED(chaine,mymailw->verbose);
+ free(chaine);
+ if (fid == 0) {
+ std::cerr<<"Problem opening file "<<nomfilemed.toLatin1().constData()<<"\n";
+ return false;
+ }
+
+ nmaa = MEDnMesh(fid);
+ if (nmaa <= 0){
+ std::cerr<<"No meshes in "<<nomfilemed.toLatin1().constData()<<"\n";
+ ret = MEDfileClose(fid);
+ return false;
+ }
+ if (nmaa > 1) std::cout<<"More than one mesh in "<<nomfilemed.toLatin1().constData()<<", first one taken\n";
+ ret = MEDmeshInfo(fid,numero,mymailw->nommaa,&sdim,&mdim,&type_maillage,mymailw->maillage_description,
+ dtunit,&sortingtype,&nstep,&axistype,axisname,axisunit);
+ if (ret < 0){
+ std::cerr<<"Problem MEDmeshInfo in "<<nomfilemed.toLatin1().constData()<<"\n";
+ ret = MEDfileClose(fid);
+ return false;
+ }
+ //changed with version med: a triangles mesh in 3d is dim 2 now and 3 before 2014
+ if (mdim != 2 && mdim != 3){
+ std::cerr<<"Problem mesh dimension should be 2 or 3: "<<mdim<<"\n";
+ ret = MEDfileClose(fid);
+ return false;
+ }
+ if (sdim != 3){
+ std::cerr<<"Problem space dimension should be 3: "<<sdim<<"\n";
+ ret = MEDfileClose(fid);
+ return false;
+ }
+ if (type_maillage != MED_UNSTRUCTURED_MESH){
+ std::cerr<<"Problem type mesh should be MED_NON_STRUCTURE: "<<type_maillage<<std::endl;
+ ret = MEDfileClose(fid);
+ return false;
+ }
+
+ //lecture nb de noeuds
+ //cf med-3.0.0_install/share/doc/html/maillage_utilisateur.html
+ med_int nnoe=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_NODE,MED_NO_GEOTYPE,MED_COORDINATE,MED_NO_CMODE,&chan,&tran);
+ //(med_geometrie_element)0,(med_connectivite)0);
+ if (nnoe<1){
+ std::cerr<<"Problem number of Vertices < 1\n";
+ ret = MEDfileClose(fid);
+ return false;
+ }
+
+ //nombre d'objets MED : mailles, faces, aretes , ...
+ med_int nmailles[MED_N_CELL_GEO],nbtria3;
+ med_int nfaces[MED_N_FACE_GEO];
+ med_int naretes[MED_N_EDGE_FIXED_GEO],nbseg2;
+ //med_int nmailles[MED_NBR_GEOMETRIE_MAILLE],nbtria3;
+ //med_int nfaces[MED_NBR_GEOMETRIE_FACE];
+ //med_int naretes[MED_NBR_GEOMETRIE_ARETE],nbseg2;
+ //polygones et polyedres familles equivalences joints
+ med_int nmpolygones,npolyedres,nfpolygones,nfam,nequ,njnt;
+
+ //Combien de mailles, faces ou aretes pour chaque type geometrique ?
+ /*for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++){
+ nmailles[i]=MEDnEntMaa(fid,mymailw->nommaa,MED_CONN,MED_MAILLE,typmai[i],typ_con);
+ //lecture_nombre_mailles_standards(fid,nommaa,typmai[i],typ_con,i);
+ if (mymailw->verbose>6) std::cout<<"NumberOf"<<nommai[i]<<"="<<nmailles[i]<<std::endl;
+ }*/
+
+ nbtria3=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_CELL,MED_TRIA3,MED_CONNECTIVITY,MED_NODAL,&chan,&tran);
+ nbseg2=MEDmeshnEntity(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_CELL,MED_SEG2,MED_CONNECTIVITY,MED_NODAL,&chan,&tran);
+
+ //combien de familles ?
+ nfam=MEDnFamily(fid,mymailw->nommaa);
+ if (mymailw->verbose>2) {
+ std::cout<<"\nNumberOfFamilies="<<nfam<<std::endl;
+ std::cout<<"NumberOfVertices="<<nnoe<<std::endl;
+ std::cout<<"NumberOfMED_SEG2="<<nbseg2<<std::endl;
+ std::cout<<"NumberOfMED_TRIA3="<<nbtria3<<"\n\n";
+ }
+ if (nbtria3<3){
+ std::cerr<<"Problem number of MED_TRIA3 < 3, not a skin of a volume\n";
+ ret = MEDfileClose(fid);
+ return false;
+ }
+
+med_int ifamdelete=0,idelete;
+std::vector<med_int> famdelete = std::vector<med_int>(nfam);
+{
+ med_int ngro;
+ char *gro;
+ char nomfam[MED_NAME_SIZE+1];
+ med_int numfam;
+ char str1[MED_COMMENT_SIZE+1];
+ char str2[MED_LNAME_SIZE+1];
+ med_err ret = 0;
+
+ for (i=0;i<nfam;i++) famdelete[i]=0;
+ for (i=0;i<nfam;i++) {
+
+ //nombre de groupes
+ ngro = MEDnFamilyGroup(fid,mymailw->nommaa,i+1);
+ if (ngro < 0){
+ std::cerr<<"Problem reading number of groups of family\n";
+ continue;
+ }
+
+ //atributs obsolete MED3
+ //allocation memoire par exces
+ gro = (char*) malloc(MED_LNAME_SIZE*(ngro+1));
+
+ ret = MEDfamilyInfo(fid,mymailw->nommaa,i+1,nomfam,&numfam,gro);
+ if (ret < 0){
+ std::cerr<<"Problem reading informations of family\n";
+ continue;
+ }
+
+ if (mymailw->verbose>8) {
+ std::cout<<"Family "<<numfam<<" have "<<ngro<<" groups\n";
+ //affichage des resultats
+ for (j=0;j<ngro;j++) {
+ if (j==0) std::cout<<" Groups :\n";
+ strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ str2[MED_LNAME_SIZE] = '\0';
+ fprintf(stdout," name = %s\n",str2);
+ }
+ if (i==nfam-1) std::cout<<std::endl;
+ }
+ QString sfam,sgro;
+ sfam=sfam.sprintf("%d",numfam);
+ idelete=0;
+ for (j=0;j<ngro;j++){
+ strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ str2[MED_LNAME_SIZE]='\0';
+ sgro=str2;
+ if (sgro.contains(mymailw->deletegroups)>0) {
+ //std::cout<<"idelete++ "<<sgro<<std::endl;
+ idelete++;
+ }
+ }
+
+ if (idelete==ngro && ngro>0) { //only delete family whith all delete groups
+ //std::cout<<"famdelete++ "<<numfam<<" "<<ifamdelete<<" "<<ngro<<std::endl;
+ famdelete[ifamdelete]=numfam;
+ ifamdelete++;
+ }
+
+ else {
+ for (j=0;j<ngro;j++){
+ strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ str2[MED_LNAME_SIZE]='\0';
+ sgro=str2;
+ QRegExp qgroup=QRegExp("Group_Of_All",Qt::CaseSensitive,QRegExp::RegExp);
+ if (sgro.contains(mymailw->deletegroups)==0){
+ if (sgro.contains(qgroup)>0) {
+ sgro="Skin_"+sgro; //pas sur que ce soit pertinent
+ }
+ if (mymailw->verbose>8) std::cout<<"families.add("<<sfam.toLatin1().constData()<<
+ ","<<sgro.toLatin1().constData()<<")\n";
+ mymailw->families.add(sfam,sgro);
+ }
+ else {
+ //sgro="Skin_"+sgro; //pas sur que ce soit pertinent
+ //std::cout<<"--deletegroups matches \""<<sfam<<","<<sgro<<"\"\n";
+ if (mymailw->verbose>3) std::cout<<"--deletegroups matches \""<<
+ sgro.toLatin1().constData()<<
+ "\" in family "<<numfam<<std::endl;
+ }
+ }
+ }
+
+ /*for (j=0;j<ngro;j++){
+ strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
+ str2[MED_LNAME_SIZE]='\0';
+ sgro=str2;
+ //std::cout<<"families.add("<<sfam<<","<<sgro<<")\n";
+ if (sgro.contains(mymailw->deletegroups)==0){
+ //sgro="Skin_"+sgro; //pas sur que ce soit pertinent
+ std::cout<<"families.add("<<sfam<<","<<sgro<<")\n";
+ mymailw->families.add(sfam,sgro);
+ }
+ else {
+ std::cout<<"--deletegroups matches \""<<sgro<<"\"\n";
+ famdelete[ifamdelete]=numfam
+ ifamdelete++;
+ }
+ }*/
+
+ //on libere la memoire
+ free(gro);
+ }
+}
+
+//std::cout<<"famdelete"; for (j=0;j<ifamdelete;j++) std::cout<<" "<<famdelete[j]; std::cout<<std::endl;
+
+if (mymailw->verbose>3){
+ std::cout<<"\nFamiliesAndGroupsOf "<<nomfilemed.toLatin1().constData()<<std::endl;
+ mymailw->families.write();
+}
+ /* Allocations memoires */
+ /* table des coordonnees profil : (space dimension * nombre de noeuds ) */
+ med_float *coo=new med_float[nnoe*sdim];
+ /* table des numeros de familles des noeuds profil : (nombre de noeuds) */
+ med_int *famnodesskin=new med_int[nnoe];
+ //med_int *pfltab=new med_int[1]; //inutilise car on lit tout
+ //lecture des noeuds : coordonnees
+ ret=MEDmeshNodeCoordinateRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_FULL_INTERLACE,coo);
+ //mdim,coo,mode_coo,MED_ALL,pfltab,0,&rep,mymailw->nomcoo,mymailw->unicoo);
+ if (ret < 0){
+ std::cerr<<"Problem reading nodes\n";
+ ret = MEDfileClose(fid);
+ //return false;
+ }
+ ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_NODE,MED_NONE,famnodesskin);
+ //famnodesskin,nnoe,MED_NOEUD,(med_geometrie_element) 0);
+ if (ret < 0){
+ std::cerr<<"Problem reading families of nodes\n";
+ ret = MEDfileClose(fid);
+ return false;
+ }
+ if (mymailw->verbose>9) {
+ std::cout<<"\nVertices: no x y z family\n";
+ for (i=0;i<nnoe*mdim;i=i+3) {
+ fprintf(stdout,"%5d %13.5e %13.5e %13.5e %5d \n",
+ (i/3+1), coo[i], coo[i+1], coo[i+2], famnodesskin[i/3]);
+ }
+ std::cout<<std::endl;
+ }
+
+ med_int *conn2=new med_int[nbseg2*2];
+ ret=MEDmeshElementConnectivityRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_CELL,MED_SEG2,MED_NODAL,MED_FULL_INTERLACE,conn2);
+ //mdim,conn2,mode_coo,pfltab,0,MED_MAILLE,MED_SEG2,MED_NOD);
+ if (ret < 0){
+ std::cerr<<"Problem reading MED_SEG2\n";
+ ret = MEDfileClose(fid);
+ //return false;
+ }
+ med_int *famseg2skin=new med_int[nbseg2];
+ ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_CELL,MED_SEG2,famseg2skin);
+ //MEDfamLire(fid,mymailw->nommaa,famseg2skin,nbseg2,MED_MAILLE,MED_SEG2);
+ if (ret < 0){
+ std::cerr<<"Problem reading families of MED_SEG2\n";
+ ret = MEDfileClose(fid);
+ return false;
+ }
+ if (mymailw->verbose>9) {
+ std::cout<<"\nConnectivity MED_SEG2: no node1 node2 family\n";
+ for (i=0;i<nbseg2*2;i=i+2) {
+ fprintf(stdout,"%5d %5d %5d %5d \n",
+ (i/2+1), conn2[i], conn2[i+1], famseg2skin[i/2]);
+ }
+ std::cout<<std::endl;
+ }
+ //std::cout<<"\ncvw1 conn nbtria3 "<<nbtria3<<"dt "<<MED_NO_DT<<"it "<<MED_NO_IT<<"cell "<<MED_CELL<<"tria3 "<<MED_TRIA3<<std::endl;
+ med_int *conn3=new med_int[nbtria3*3];
+ ret=MEDmeshElementConnectivityRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,
+ MED_CELL,MED_TRIA3,MED_NODAL,MED_FULL_INTERLACE,conn3);
+ //MEDconnLire(fid,mymailw->nommaa,mdim,conn3,mode_coo,pfltab,0,MED_MAILLE,MED_TRIA3,MED_NOD);
+ if (ret < 0){
+ std::cerr<<"Problem reading MED_TRIA3\n";
+ ret = MEDfileClose(fid);
+ //return false;
+ }
+ med_int *famtria3skin=new med_int[nbtria3];
+ ret=MEDmeshEntityFamilyNumberRd(fid,mymailw->nommaa,MED_NO_DT,MED_NO_IT,MED_CELL,MED_TRIA3,famtria3skin);
+ //MEDfamLire(fid,mymailw->nommaa,famtria3skin,nbtria3,MED_MAILLE,MED_TRIA3);
+ if (ret < 0){
+ std::cerr<<"Problem reading families of MED_TRIA3\n";
+ ret = MEDfileClose(fid);
+ return false;
+ }
+ if (mymailw->verbose>9) {
+ std::cout<<"\nConnectivity MED_TRIA3: no node1 node2 node3 family\n";
+ for (i=0;i<nbtria3*3;i=i+3) {
+ fprintf(stdout,"%5d %5d %5d %5d %5d \n",
+ (i/3+1), conn3[i], conn3[i+1], conn3[i+2], famtria3skin[i/3]);
+ }
+ std::cout<<std::endl;
+ }
+
+ /*liberation memoire?
+ delete[] coo;
+ delete[] nomnoe;
+ delete[] numnoe;
+ delete[] nufano;*/
+
+ if (ifamdelete>0) {
+ //std::cout<<"!!!!!!!!nodes "<<famnodesskin[0]<<" "<<nnoe<<famdelete[1]<<std::endl;
+ for (i=0;i<nnoe;i++) {
+ for (j=0;j<ifamdelete;j++) {
+ if (famnodesskin[i]==famdelete[j]) {
+ //std::cout<<"nodes "<<famnodesskin[i]<<" "<<i<<" "<<famdelete[j]<<std::endl;
+ famnodesskin[i]=0; }
+ }
+ }
+ for (i=0;i<nbseg2;i++) {
+ for (j=0;j<ifamdelete;j++) {
+ if (famseg2skin[i]==famdelete[j]) famseg2skin[i]=0;
+ }
+ }
+ for (i=0;i<nbtria3;i++) {
+ for (j=0;j<ifamdelete;j++) {
+ if (famtria3skin[i]==famdelete[j]) famtria3skin[i]=0;
+ }
+ }
+ }
+ //stocks data for future use
+ CVWtab *montab;
+ bool ok;
+
+ montab=new CVWtab(nnoe*mdim,coo);
+ tmp="SKIN_VERTICES_COORDINATES";
+ ok=mymailw->insert_key(tmp,montab);
+
+ montab=new CVWtab(nnoe,famnodesskin);
+ tmp="SKIN_VERTICES_FAMILIES";
+ ok=mymailw->insert_key(tmp,montab);
+
+ montab=new CVWtab(nbseg2*2,conn2);
+ tmp="SKIN_SEG2_CONNECTIVITIES";
+ ok=mymailw->insert_key(tmp,montab);
+
+ montab=new CVWtab(nbtria3,famseg2skin);
+ tmp="SKIN_SEG2_FAMILIES";
+ ok=mymailw->insert_key(tmp,montab);
+
+ montab=new CVWtab(nbtria3*3,conn3);
+ tmp="SKIN_TRIA3_CONNECTIVITIES";
+ ok=mymailw->insert_key(tmp,montab);
+
+ montab=new CVWtab(nbtria3,famtria3skin);
+ tmp="SKIN_TRIA3_FAMILIES";
+ ok=mymailw->insert_key(tmp,montab);
+
+ //if (mymailw->verbose>6) ok=mymailw->list_keys_mesh_wrap();
+
+ ret = MEDfileClose(fid);
+ if (ret < 0){
+ std::cerr<<"Problem closing "<<nomfilemed.toLatin1().constData()<<"\n";
+ return false;
+ }
+ return true;
+}
+
+
+//************************************
+int main(int argc, char *argv[])
+{
+ bool ok;
+ int i,nb,nbfiles,limit_swap,nbelem_limit_swap,limit_swap_defaut,verbose;
+ QString path,pathini,casename,casenamemed,fileskinmed,
+ tmp,cmd,format,format_tetra,
+ test,menu,launchtetra,background,deletegroups,
+ ToMergeSubdomains,ToTagSubdomains,ToOutputInterfaces,ToDiscardSubdomains,
+ version="V3.0 (MED3+tetra-hpc)";
+
+ char *chelp=NULL,
+ *ccasename=NULL,
+ *cnumber=NULL,
+ *cmedname=NULL,
+ *climitswap=NULL,
+ *cverbose=NULL,
+ *ctest=NULL,
+ *cmenu=NULL,
+ *claunchtetra=NULL,
+ *cToMergeSubdomains=NULL,
+ *cToTagSubdomains=NULL,
+ *cToOutputInterfaces=NULL,
+ *cToDiscardSubdomains=NULL,
+ *cbackground=NULL,
+ *cdeletegroups=NULL;
+
+ for (i = 0; i < argc; i++){
+ if (!strncmp (argv[i], "--help", sizeof ("--help"))) chelp = &(argv[i][0]);
+ else if (!strncmp (argv[i], "--casename=", sizeof ("--casename"))) ccasename = &(argv[i][sizeof ("--casename")]);
+ else if (!strncmp (argv[i], "--number=", sizeof ("--number"))) cnumber = &(argv[i][sizeof ("--number")]);
+ else if (!strncmp (argv[i], "--medname=", sizeof ("--medname"))) cmedname = &(argv[i][sizeof ("--medname")]);
+ else if (!strncmp (argv[i], "--limitswap=", sizeof ("--limitswap"))) climitswap = &(argv[i][sizeof ("--limitswap")]);
+ else if (!strncmp (argv[i], "--verbose=", sizeof ("--verbose"))) cverbose = &(argv[i][sizeof ("--verbose")]);
+ else if (!strncmp (argv[i], "--test=", sizeof ("--test"))) ctest = &(argv[i][sizeof ("--test")]);
+ else if (!strncmp (argv[i], "--menu=", sizeof ("--menu"))) cmenu = &(argv[i][sizeof ("--menu")]);
+ else if (!strncmp (argv[i], "--launchtetra=", sizeof ("--launchtetra"))) claunchtetra = &(argv[i][sizeof ("--launchtetra")]);
+ else if (!strncmp (argv[i], "--merge_subdomains=", sizeof ("--merge_subdomains"))) cToMergeSubdomains = &(argv[i][sizeof ("--")]);
+ else if (!strncmp (argv[i], "--tag_subdomains=", sizeof ("--tag_subdomains"))) cToTagSubdomains = &(argv[i][sizeof ("--")]);
+ else if (!strncmp (argv[i], "--output_interfaces=", sizeof ("--output_interfaces"))) cToOutputInterfaces = &(argv[i][sizeof ("--")]);
+ else if (!strncmp (argv[i], "--discard_subdomains=", sizeof ("--discard_subdomains"))) cToDiscardSubdomains = &(argv[i][sizeof ("--")]);
+ else if (!strncmp (argv[i], "--background=", sizeof ("--background"))) cbackground = &(argv[i][sizeof ("--background")]);
+ else if (!strncmp (argv[i], "--deletegroups=", sizeof ("--deletegroups"))) cdeletegroups = &(argv[i][sizeof ("--deletegroups")]);
+ }
+
+ if (argc < 2 || chelp){
+ std::cout<<"tetrahpc2med "<<version.toLatin1().constData()<<" Available options:\n"
+ " --help : produces this help message\n"<<
+ " --casename : path and name of input tetrahpc2med files which are\n"<<
+ " - output files of GHS3DPRL_Plugin .mesh\n"<<
+ " - output file of GHS3DPRL_Plugin casename_skin.med (optional)\n"<<
+ " with initial skin and its initial groups\n"<<
+ " --number : number of partitions\n"<<
+ " --medname : path and name of output MED files\n"<<
+ " --limitswap : max size of working cpu memory (Mo) (before swapping on .temp files)\n"<<
+ " --verbose : trace of execution (0->6)\n"<<
+ " --test : more tests about joints, before generation of output files\n"<<
+ " --menu : a GUI menu for option number\n"<<
+ " --launchtetra : also launch tetra-hpc on files casename.mesh and option number\n"<<
+ " --merge_subdomains : merge the subdomains into one mesh and write the output .mesh(b) file\n"<<
+ " --tag_subdomains : use the parallel subdomain index as tag into the merged output mesh\n"<<
+ " to identify the parallel subdomains (used in combination with the merge_subdomains option)\n"<<
+ " --output_interfaces : write the parallel subdomains interface triangles into the merged output mesh\n"<<
+ " (used in combination with the merge_subdomains option)\n"<<
+ " --discard_subdomains : discard the parallel subdomains informations output (mesh, global numbering and interfaces)\n"<<
+ " --background : force background mode from launch tetra-hpc and generation of final MED files (big meshes)\n"<<
+ " --deletegroups : regular expression (see QRegExp) which matches unwanted groups in final MED files\n"<<
+ " (try --deletegroups=\"(\\bJOINT)\"\n"<<
+ " (try --deletegroups=\"(\\bAll_Nodes|\\bAll_Faces)\"\n"<<
+ " (try --deletegroups=\"((\\bAll_|\\bNew_)(N|F|T))\"\n";
+ std::cout<<"example:\n tetrahpcl2med --casename=/tmp/GHS3DPRL --number=2 --medname=DOMAIN "<<
+ "--limitswap=1000 --verbose=0 --test=yes --menu=no --launchtetra=no\n\n";
+ return 1; //no output files
+ }
+
+ if (!ccasename){
+ std::cerr<<"--casename: a path/name is expected\n\n";
+ return 1;
+ }
+ casename=ccasename;
+ if (!cnumber){
+ std::cerr<<"--number: an integer is expected\n\n";
+ return 1;
+ }
+ tmp=cnumber;
+ nbfiles=tmp.toLong(&ok,10);
+ if (!ok){
+ std::cerr<<"--number: an integer is expected\n\n";
+ return 1;
+ }
+ if (nbfiles<=0){
+ std::cerr<<"--number: a positive integer is expected\n\n";
+ return 1;
+ }
+ if (nbfiles>2048){ //delirium in 2014
+ std::cerr<<"--number: a positive integer <= 2048 is expected\n\n";
+ return 1;
+ }
+ if (!cmedname) cmedname=ccasename;
+ casenamemed=cmedname;
+ limit_swap_defaut=1000; //1000Mo
+ limit_swap=limit_swap_defaut;
+ if (climitswap){
+ tmp=climitswap;
+ limit_swap=tmp.toLong(&ok,10);
+ if (!ok){
+ std::cerr<<"--limitswap: an integer is expected. try 1000\n\n";
+ return 1;
+ }
+ if (limit_swap<1 || limit_swap>32000){
+ std::cerr<<"--limitswap: [1->32000] expected. try 1000\n\n";
+ return 1;
+ }
+ }
+ //default 1GOctet/8(for float)
+ nbelem_limit_swap=limit_swap*1000000; //100%
+ CVWtab::memorymax=nbelem_limit_swap;
+
+ verbose=1; //default
+ if (cverbose){
+ tmp=cverbose;
+ verbose=tmp.toLong(&ok,10);
+ if (!ok){
+ std::cerr<<"--verbose: an integer is expected\n\n";
+ return 1;
+ }
+ if (verbose<0){
+ std::cerr<<"--verbose: a positive integer is expected\n\n";
+ return 1;
+ }
+ }
+
+ test="no"; //default
+ if (ctest){
+ tmp=ctest;
+ if (tmp=="yes") test="yes";
+ }
+
+ menu="no"; //default
+ if (cmenu){
+ tmp=cmenu;
+ if (tmp=="yes") menu="yes";
+ }
+
+ launchtetra="no"; //default
+ if (claunchtetra){
+ tmp=claunchtetra;
+ if (tmp=="yes") launchtetra="yes";
+ }
+
+ ToMergeSubdomains="no"; //default
+ if (cToMergeSubdomains){
+ tmp=cToMergeSubdomains;
+ if (tmp=="yes") ToMergeSubdomains="yes";
+ }
+
+ ToTagSubdomains="no"; //default
+ if (cToTagSubdomains){
+ tmp=cToTagSubdomains;
+ if (tmp=="yes") ToTagSubdomains="yes";
+ }
+
+ ToOutputInterfaces="no"; //default
+ if (cToOutputInterfaces){
+ tmp=cToOutputInterfaces;
+ if (tmp=="yes") ToOutputInterfaces="yes";
+ }
+
+ ToDiscardSubdomains="no"; //default
+ if (cToDiscardSubdomains){
+ tmp=cToDiscardSubdomains;
+ if (tmp=="yes") ToDiscardSubdomains="yes";
+ }
+
+ background="no"; //default
+ if (cbackground){
+ tmp=cbackground;
+ if (tmp=="yes") background="yes";
+ }
+
+
+ // We must always have an application
+ if (menu=="yes") {
+ QApplication a(argc,argv);
+ dlg_ghs3dmain *m = new dlg_ghs3dmain();
+ m->setWindowTitle("tetrahpc2med 3.0");
+ m->show();
+ a.exec();
+ if ( m->result() == QDialog::Accepted ) {
+ std::cout<<"parameters "<<m->KeepFiles()<<" "<<m->NbPart()<<std::endl;
+ nbfiles=m->NbPart();
+ }
+ else {
+ return 1;
+ }
+ delete m;
+ }
+
+ int n=casenamemed.count('/');
+ if (n>0)
+ path=casenamemed.section('/',-n-1,-2)+"/";
+ else
+ path="./";
+ casenamemed=casenamemed.section('/',-1);
+ if (casenamemed.length()>20){
+ std::cerr<<"--medname truncated (no more 20 characters)"<<std::endl;
+ casenamemed.truncate(20);
+ }
+
+ n=casename.count('/');
+ if (n>0)
+ pathini=casename.section('/',-n-1,-2)+"/";
+ else
+ pathini="./";
+ casename=casename.section('/',-1);
+ if (casename.length()>20){
+ std::cerr<<"--casename truncated (no more 20 characters)"<<std::endl;
+ casename.truncate(20);
+ }
+
+ /*std::cout<<"CaseNameMed="<<casenamemed<<std::endl;
+ std::cout<<"PathMed="<<path<<std::endl;*/
+
+ deletegroups="(\\bxyz)"; //default improbable name
+ if (cdeletegroups){
+ deletegroups=cdeletegroups;
+ }
+
+ //verbose=5;
+ if (verbose>0)
+ std::cout<<"tetrahpc2med "<<version.toLatin1().constData()<<" parameters:"<<
+ "\n --casename="<<pathini.toLatin1().constData()<<casename.toLatin1().constData()<<
+ "\n --number="<<nbfiles<<
+ "\n --medname="<<path.toLatin1().constData()<<casenamemed.toLatin1().constData()<<
+ "\n --limitswap="<<limit_swap<<
+ "\n --verbose="<<verbose<<
+ "\n --test="<<test.toLatin1().constData()<<
+ "\n --menu="<<menu.toLatin1().constData()<<
+ "\n --launchtetra="<<launchtetra.toLatin1().constData()<<
+ "\n --merge_subdomains="<<ToMergeSubdomains.toLatin1().constData()<<
+ "\n --tag_subdomains="<<ToTagSubdomains.toLatin1().constData()<<
+ "\n --output_interfaces="<<ToOutputInterfaces.toLatin1().constData()<<
+ "\n --discard_subdomains="<<ToDiscardSubdomains.toLatin1().constData()<<
+ "\n --background="<<background.toLatin1().constData()<<
+ "\n --deletegroups=\""<<deletegroups.toLatin1().constData()<<"\"\n";
+
+ //utile si appel par plugin ghs3dprl sur big meshes et tetrahpc sur plusieurs jours
+#ifndef WIN32
+ if (background=="yes"){
+ pid_t pid = fork();
+ if (pid > 0) {
+ //Process father
+ exit(0); //temporary ok for plugin
+ }
+ //process children
+ //On rend le fils independant de tout terminal
+ //from here everything in background: tetrahpc AND generation of final MED files
+ setsid();
+ system("sleep 10"); //for debug
+ }
+#else
+ printf("background mode is not supported on win32 platform !\n");
+#endif
+
+ //"tetrahpc -f exemple1 -n 4"
+ if (launchtetra=="yes"){
+ //tetra_hpc.exe --help
+ //mpirun -n 3 mg-tetra_hpc.exe --in GHS3DPRL.mesh --out TOTO.mesh
+
+ //direct mpirun cause problem: invalid
+ //cmd="mpirun -n "+cmd.sprintf("%d",nbfiles)+" mg-tetra_hpc.exe --in "+
+
+ //call tetra_hpc.bash is script which assumes mpirun after compilation openmpi etc...
+ cmd="mg-tetra_hpc.bash -n "+cmd.sprintf("%d",nbfiles)+" --in "+
+ pathini+casename+".mesh --out "+
+ pathini+casename+".mesh"+
+ " --merge_subdomains "+ToMergeSubdomains+
+ " --tag_subdomains "+ToTagSubdomains+
+ " --output_interfaces "+ToOutputInterfaces+
+ " --discard_subdomains "+ToDiscardSubdomains+
+ " > "+path+"tetrahpc.log";
+ std::cout<<"\nlaunchtetra command: background="<<cbackground<<
+ "\n "<<cmd.toLatin1().constData()<<std::endl;
+ system(cmd.toLatin1().constData()); // run
+ //sometimes it is better to wait flushing files on slow filesystem...
+ system("sleep 3");
+ }
+ ghs3dprl_mesh_wrap *mymailw=new ghs3dprl_mesh_wrap;
+ //no constructor, later maybe
+ mymailw->nbfiles=0;
+ mymailw->nbfilestot=nbfiles;
+ //for huge cases big array swap in huge binary files
+ mymailw->nbelem_limit_swap=nbelem_limit_swap;
+ mymailw->verbose=verbose;
+ mymailw->casename=casename;
+ mymailw->medname=casenamemed;
+ mymailw->path=path;
+ mymailw->pathini=pathini;
+ mymailw->deletegroups=QRegExp(deletegroups,Qt::CaseSensitive,QRegExp::RegExp);
+ ghs3dprl_msg_parser handler;
+ //constructor later maybe
+ //handler.verbose=true;
+ handler.mailw=mymailw;
+ mymailw->families.no=1;
+ //std::cout<<"coucou1 "<<mymailw->families.no<<std::endl;
+ //mymailw->families.add(casename,casenamemed);
+ format=format.sprintf("%d",nbfiles);
+ int nbf=format.length();
+ format=format.sprintf(".%%0%dd.%%0%dd",nbf,nbf);
+ format_tetra=".%05d";
+ if (verbose>10)std::cout<<"format "<<format.toLatin1().constData()<<std::endl;
+ if (verbose>10)std::cout<<"format_tetra "<<format_tetra.toLatin1().constData()<<std::endl;
+ mymailw->format=format;
+ mymailw->format_tetra=format_tetra;
+ mymailw->for_tetrahpc=true; //to know what files to read: .noboite or .mesh
+
+ //something like "/home/wambeke/tmp/GHS3DPRL_skin.med"
+ fileskinmed=pathini+casename+"_skin.med";
+ //fileskinmed="/home/wambeke/tmp/GHS3DPRL_skin.med";
+ /*for debug
+ {
+ char ctmp[fileskinmed.length()+1] ; strcpy(ctmp,fileskinmed);
+ int res=dumpMED(&ctmp[0],1);
+ }*/
+ int ret = access(fileskinmed.toLatin1().constData(),F_OK); //on regarde si le fichier existe
+ if (ret >= 0) {
+ ok=ReadFileMED(fileskinmed,mymailw); }
+ else {
+ if (verbose>0)std::cout<<"Initial skin file <"<<fileskinmed.toLatin1().constData()<<"> does not exist\n"; }
+
+
+//if test quickly read all files before (or only small files)
+ if (test=="yes"){
+ if (verbose>0) std::cout<<"\nReading output files of tetrahpc as input files of tetrahpc2med...\n";
+ //only read beginning of files .xxxxx.mesh
+ //supposed big files big arrays so only see first lines
+ mymailw->nbfiles=0;
+ for (int i=1; i<=nbfiles; i++){
+ mymailw->nofile=i;
+ tmp=pathini+casename+tmp.sprintf(format_tetra.toLatin1().constData(),i)+".mesh";
+ if (verbose>0) std::cout<<"FileName="<<tmp.toLatin1().constData()<<std::endl;
+ ok=mymailw->TestExistingFileMESHnew(tmp);
+ }
+ if (verbose>0)
+ std::cout<<"NumberOfFilesMESHTested="<<mymailw->nbfiles<<": ok\n\n";
+ if (mymailw->nbfiles != nbfiles){
+ std::cerr<<"NumberOfFiles != NumberOfFilesTested is unexpected\n\n";
+ return 1;
+ }
+ } //end if test
+
+ ok=mymailw->Write_MEDfiles_v2(true); //deletekeys=true
+
+ nb=mymailw->remove_all_keys_mesh_wrap();
+ if (verbose>3)std::cout<<"***remove_all_key_mesh_wrap*** "<<nb<<" keys removed\n";
+ if (verbose>0)std::cout<<std::endl<<"===end of "<<argv[0]<<"==="<<std::endl;
+
+ //for debug
+ //int res=dumpMED("/home/wambeke/tmp/DOMAIN_1.med",1);
+
+ return 0; //ok
+}