def addToKillList(command_pid, command):
my_port = findFileDict()
- filedict=os.getenv("HOME")+'/'+os.getenv('USER')+"_"+str(my_port)+'_SALOME_pidict'
+ from killSalomeWithPort import getPiDict
+ filedict=getPiDict(my_port)
try:
fpid=open(filedict, 'r')
process_ids=pickle.load(fpid)
def killList():
my_port = findFileDict()
- filedict=os.getenv("HOME")+'/'+os.getenv('USER')+"_"+str(my_port)+'_SALOME_pidict'
+ from killSalomeWithPort import getPiDict
+ filedict=getPiDict(my_port)
try:
fpid=open(filedict, 'r')
process_ids=pickle.load(fpid)
#!/usr/bin/env python
-import os, string, sys
+import os, string, sys, re
-from killSalomeWithPort import killMyPort
+from killSalomeWithPort import killMyPort, getPiDict
def killAllPorts():
user = os.getenv('USER')
+ filedict = "^%s$"%(getPiDict('(\d*)',full=False))
+ fnamere = re.compile(filedict)
for file in os.listdir(os.getenv("HOME")):
- l = string.split(file, "_")
- if len(l) >= 4:
- if file[:len(user)] == user:
- if l[len(l)-2] == "SALOME" and l[len(l)-1] == "pidict":
- killMyPort(l[len(l)-3])
+ mo = re.match(fnamere,file)
+ if mo and len(mo.groups()):
+ killMyPort(mo.groups()[0])
pass
if __name__ == "__main__":
#!/usr/bin/env python
import os, sys, pickle, signal, commands
+def getPiDict(port,appname='salome',full=True):
+ filedict = []
+ filedict.append( os.getenv('USER') ) # user name
+ filedict.append( os.getenv('HOSTNAME') ) # host name
+ filedict.append( str(port) ) # port number
+ filedict.append( appname.upper() ) # application name
+ filedict.append( 'pidict' ) # constant part
+
+ filedict = '_'.join(filedict)
+ if full:
+ filedict = os.getenv("HOME") + '/' + filedict
+ return filedict
+
########## kills all salome processes with the given port ##########
def killMyPort(port):
- filedict=os.getenv("HOME")+'/'+os.getenv('USER')+"_"+port+'_SALOME_pidict'
+ filedict=getPiDict(port)
found = 0
try:
fpid=open(filedict, 'r')
root_dir = os.environ.get( 'GUI_ROOT_DIR', root_dir ) # GUI_ROOT_DIR or KERNEL_ROOT_DIR or "" if both not found
filename = root_dir+'/bin/salome/VERSION'
str = open( filename, "r" ).readline() # str = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0"
- match = re.search( r':\s+([\d\.]+)\s*$', str )
+ match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', str )
if match :
return match.group( 1 )
return ''
print "--- erreur au lancement Salome ---"
#print process_id
-
-# filedict = '/tmp/' + os.getenv('USER') + "_" + str(args['port']) \
-# + '_' + args['appname'].upper() + '_pidict'
-# replaced args['appname'] by "SALOME" because in killSalome.py use of 'SALOME' in file name is hardcoded.
- filedict = os.getenv("HOME") + '/' + os.getenv('USER') + "_" + str(args['port']) \
- + '_' + 'SALOME' + '_pidict'
+
+ from killSalomeWithPort import getPiDict
+ filedict = getPiDict(args['port'])
+
process_ids = []
try:
fpid=open(filedict, 'r')
The directory is only a skeleton, the user has to edit several files to
configure his own application.
+---- Liste des fichiers a modifier
+
Directory ${APPLI} must be created on each computer of the application.
The easiest way is to use the same relative path (to ${HOME}) on each computer.
(Sometimes it is not possible to use the same path everywhere, for instance
alphanumeric order (after edition, think to remove backup files). the envd
script is used by run scripts.
+
2.1 Proposal for env.d scripts
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Each user can define his own configuration for these scripts, following the
envSALOME.sh
Sets all the MODULE_ROOT_DIR that can be used in the SALOME application.
+SalomeAppConfig
2.2 User run scripts
~~~~~~~~~~~~~~~~~~~~
AC_SUBST(CAS_CPPFLAGS)
AC_SUBST(CAS_CXXFLAGS)
AC_SUBST(CAS_KERNEL)
+AC_SUBST(CAS_MATH)
AC_SUBST(CAS_VIEWER)
+AC_SUBST(CAS_TKTopAlgo)
AC_SUBST(CAS_MODELER)
AC_SUBST(CAS_OCAF)
+AC_SUBST(CAS_OCAFVIS)
AC_SUBST(CAS_DATAEXCHANGE)
AC_SUBST(CAS_LDFLAGS)
AC_SUBST(CAS_LDPATH)
AC_MSG_WARN(Opencascade libraries not found)
else
AC_MSG_RESULT(yes)
- CAS_KERNEL="$CAS_LDPATH -lTKernel -lTKMath"
+ CAS_KERNEL="$CAS_LDPATH -lTKernel"
+ CAS_MATH="$CAS_LDPATH -lTKMath"
- # E.A. compatibility version 4 and 5.x
- CAS_OCAF="$CAS_LDPATH -lPTKernel -lTKPShape -lTKCDF -lTKCAF -lTKShapeSchema -lTKPCAF -lFWOSPlugin -lTKStdSchema"
- if test $OCC_VERSION_MAJOR -lt 5 ; then
- CAS_OCAF="$CAS_OCAF -lTKPAppStd"
- fi
- if test -f $CASROOT/$casdir/lib/libPAppStdPlugin.so ; then
- # this library is absent in CASCADE 5.2.3
- CAS_OCAF="$CAS_OCAF -lPAppStdPlugin"
- CAS_STDPLUGIN="PAppStdPlugin"
- fi
- if test -f $CASROOT/$casdir/lib/libStdPlugin.so ; then
- # this libraries are only for CASCADE 5.2.3
- CAS_STDPLUGIN="StdPlugin"
- CAS_OCAF="$CAS_OCAF -lStdPlugin -lStdLPlugin -lTKLCAF -lTKPLCAF -lTKStdLSchema"
- fi
+ CAS_OCAF="$CAS_LDPATH -lTKernel -lTKCDF -lTKLCAF"
+ CAS_OCAFVIS="$CAS_LDPATH -lTKCAF -lStdPlugin"
- CAS_VIEWER="$CAS_LDPATH -lTKOpenGl -lTKV3d -lTKService"
- CAS_MODELER="$CAS_LDPATH -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo -lTKPrim -lTKBO -lTKBool -lTKHLR -lTKFillet -lTKOffset -lTKFeat"
+ CAS_TKV3d="$CAS_LDPATH -lTKV3d"
+ CAS_VIEWER="$CAS_TKV3d -lTKService"
- # E.A. compatibility version 4 and 5.x
- CAS_DATAEXCHANGE="$CAS_LDPATH -lTKXSBase -lTKIGES -lTKSTEP -lTKShHealing"
- if test $OCC_VERSION_MAJOR -lt 5 ; then
- CAS_DATAEXCHANGE="$CAS_DATAEXCHANGE -lTKShHealingStd"
- fi
+ CAS_TKBRep="$CAS_LDPATH -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep"
+
+ CAS_TKTopAlgo="$CAS_TKBRep -lTKGeomAlgo -lTKTopAlgo"
+ CAS_TKPrim="$CAS_TKTopAlgo -lTKPrim"
+
+ CAS_MODELER="$CAS_TKPrim -lTKBO -lTKBool -lTKHLR -lTKFillet -lTKOffset -lTKFeat"
+ CAS_DATAEXCHANGE="$CAS_LDPATH -lTKIGES -lTKSTEP"
- CAS_LDFLAGS="$CAS_KERNEL $CAS_OCAF $CAS_VIEWER $CAS_MODELER $CAS_DATAEXCHANGE"
+ CAS_LDFLAGS="$CAS_KERNEL $CAS_MATH $CAS_OCAF $CAS_OCAFVIS $CAS_VIEWER $CAS_MODELER $CAS_DATAEXCHANGE"
fi
#OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@
#OCC_LIBS=@CAS_LDFLAGS@
CAS_KERNEL=@CAS_KERNEL@
+CAS_MATH=@CAS_MATH@
CAS_OCAF=@CAS_OCAF@
+CAS_OCAFVIS=@CAS_OCAFVIS@
+CAS_TKTopAlgo=@CAS_TKTopAlgo@
CAS_VIEWER=@CAS_VIEWER@
CAS_MODELER=@CAS_MODELER@
CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@
CPPFLAGS += $(OCC_INCLUDES)
CXXFLAGS += $(OCC_CXXFLAGS)
-LDFLAGS+= $(CAS_KERNEL)
+LDFLAGS+= $(CAS_KERNEL) $(CAS_MATH)
@CONCLUDE@
long ndim = hdf_dataset->nDim(); //Get number of dimesions
hdf_size *dim = new hdf_size[ndim];
hdf_type type = hdf_dataset->GetType();
- int nbAttr = hdf_dataset->nAttributes(), j;
+ hdf_byte_order order = hdf_dataset->GetOrder();
+ int nbAttr = hdf_dataset->nAttributes();
TCollection_AsciiString anIdent(ident, '\t');
TCollection_AsciiString anIdentChild(ident+1, '\t');
delete dim;
/*fprintf(fp, "%s%li:", anIdentChild.ToCString(), size);*/
- fprintf(fp, "%li:", size);
+// fprintf(fp, "%li:", size);
+ fprintf(fp, "%li %i:", size, order);
if (type == HDF_STRING) {
char* val = new char[size];
{
char name[HDF_NAME_MAX_LEN+1];
hdf_type type;
+ hdf_byte_order order;
int nbDim, nbAttr;
long i, size;
sizeArray[i] = dim;
}
- HDFdataset* hdf_dataset = new HDFdataset(new_name, father,type, sizeArray, nbDim);
+ // order (2-d member) was not written in earlier versions
+ char tmp;
+ int nbRead = fscanf(fp, "%li %i%c", &size, &order, &tmp);
+ if ( nbRead < 2 ) { // fscanf stops before ":"
+ fscanf(fp, "%c", &tmp);
+ order = H5T_ORDER_NONE;
+ }
+ if ( type != HDF_FLOAT64 ) // use order only for FLOAT64
+ order = H5T_ORDER_NONE;
+
+ HDFdataset* hdf_dataset = new HDFdataset(new_name, father,type, sizeArray, nbDim, order);
delete new_name;
delete sizeArray;
hdf_dataset->CreateOnDisk();
- char tmp;
- fscanf(fp, "%li%c", &size, &tmp);
-
if (type == HDF_STRING) {
char *val = new char[size+1];
fread(val, 1, size, fp);
}
HDFdataset::HDFdataset(char *name, HDFcontainerObject *father,hdf_type type,
- hdf_size dim[], int dimsize)
+ hdf_size dim[], int dimsize, hdf_byte_order order)
: HDFinternalObject(name)
{
int i;
_type = type;
_ndim = dimsize;
_dim = new hdf_size[dimsize];
+ _byte_order = order;
_size = 1;
_attribute = NULL;
for (i=0;i<dimsize;i++)
_type = HDF_NONE;
_ndim = -1;
_dim = 0;
+ _byte_order = H5T_ORDER_ERROR;
_size = -1;
_attribute = NULL;
}
void HDFdataset::CreateOnDisk()
{
- if ((_id = HDFdatasetCreate(_fid,_name,_type,_dim,_ndim)) < 0)
+ if ((_id = HDFdatasetCreate(_fid,_name,_type,_dim,_ndim,_byte_order)) < 0)
throw HDFexception("Can't create dataset");
}
return _size;
}
+hdf_byte_order HDFdataset::GetOrder()
+{
+ if (_byte_order < 0 )
+ if ((_byte_order = HDFdatasetGetOrder( _id )) < 0)
+ throw HDFexception("Can't determine the byte order of the dataset");
+ return _byte_order;
+}
+
hdf_object_type HDFdataset::GetObjectType()
{
return HDF_DATASET;
hdf_idt _fid;
hdf_type _type;
hdf_size *_dim;
+ hdf_byte_order _byte_order;
int _size;
int _ndim;
char* _attribute;
public:
HDFdataset(char *name, HDFcontainerObject *father,hdf_type type,
- hdf_size dim[],int dimsize);
+ hdf_size dim[],int dimsize, hdf_byte_order order = H5T_ORDER_NONE);
HDFdataset(char *name,HDFcontainerObject *father);
virtual ~HDFdataset();
void GetDim(hdf_size dim[]);
int GetSize();
hdf_object_type GetObjectType();
+ hdf_byte_order GetOrder();
int nAttributes();
char* GetAttributeName(unsigned idx);
* - name (IN) : dataset name
* - type (IN) : dataset type (HDF_STRING,HDF_INT32,HDF_INT64,HDF_FLOAT64)
* - dimd (IN) : dataset size
+ * - order(IN) : byte order (H5T_ORDER_NONE, H5T_ORDER_LE, H5T_ORDER_BE)
* - Result :
* - if success : returns dataset ID
* - if failure : -1
*/
hdf_idt HDFdatasetCreate(hdf_idt pid,char *name,hdf_type type,
- hdf_size *dimd, int ndim)
+ hdf_size *dimd, int ndim, hdf_byte_order order)
{
hdf_idt dataset, dataspace = 0;
hdf_err ret;
- int type_hdf;
+ hdf_idt type_hdf, new_type_hdf = -1;
switch(type)
{
break;
case HDF_STRING :
- if((type_hdf = H5Tcopy(H5T_C_S1)) < 0)
+ if((new_type_hdf = H5Tcopy(H5T_C_S1)) < 0)
return -1;
- if((ret = H5Tset_size(type_hdf,1)) < 0)
+ if((ret = H5Tset_size(new_type_hdf,1)) < 0)
return -1;
break;
return -1;
}
+ /* set order */
+ if ( order != H5T_ORDER_ERROR &&
+ order != H5T_ORDER_NONE &&
+ type != HDF_STRING )
+ {
+ if (( new_type_hdf = H5Tcopy( type_hdf )) < 0 )
+ return -1;
+ if (( ret = H5Tset_order (new_type_hdf, order )) < 0 )
+ return -1;
+ }
+
if ((dataset = H5Dopen(pid,name)) < 0)
{
if ((dataspace = H5Screate_simple(ndim, dimd, NULL)) < 0)
return -1;
- if ((dataset = H5Dcreate(pid,name,type_hdf,dataspace, H5P_DEFAULT)) < 0)
+ if ((dataset = H5Dcreate(pid,name,
+ new_type_hdf < 0 ? type_hdf : new_type_hdf,
+ dataspace, H5P_DEFAULT)) < 0)
return -1;
}
else
return -1;
+ if ( ! (new_type_hdf < 0) && (ret = H5Tclose(new_type_hdf)) < 0)
+ return -1;
if ((ret = H5Sclose(dataspace)) < 0)
- return -1;
+ return -1;
return dataset;
}
--- /dev/null
+/*----------------------------------------------------------------------------
+SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
+
+ Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+
+
+
+ File : HDFdatasetGetOrder.c
+Module : SALOME
+----------------------------------------------------------------------------*/
+
+#include "hdfi.h"
+#include <hdf5.h>
+
+hdf_byte_order
+HDFdatasetGetOrder(hdf_idt dataset_id)
+{
+ hdf_idt type_id;
+ hdf_byte_order order;
+
+ if ((type_id = H5Dget_type(dataset_id)) < 0)
+ return -1;
+
+ order = H5Tget_order(type_id);
+
+ H5Tclose(type_id);
+
+ return order;
+}
typedef hid_t hdf_idt;
typedef herr_t hdf_err;
typedef hbool_t hdf_bool;
+typedef H5T_order_t hdf_byte_order;
typedef int hdf_int32;
typedef long hdf_int64;
HDFdatasetGetSize.c \
HDFdatasetGetType.c \
HDFdatasetGetnDim.c \
+ HDFdatasetGetOrder.c \
HDFattrOpen.c \
HDFattrClose.c \
HDFattrWrite.c \
#BIN = test9 test8
CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) -DPCLINUX
-LDFLAGS+= $(CAS_LDPATH) -lTKernel $(HDF5_LIBS)
-
+LDFLAGS+= $(CAS_KERNEL) $(HDF5_LIBS)
@CONCLUDE@
extern
hdf_idt HDFdatasetCreate(hdf_idt pid,char *name,hdf_type type,
- hdf_size *dimd, int ndim);
+ hdf_size *dimd, int ndim, hdf_byte_order order);
extern
hdf_err HDFdatasetWrite(hdf_idt id, void *val);
extern
int HDFdatasetGetSize(hdf_idt id);
+extern
+hdf_byte_order HDFdatasetGetOrder(hdf_idt id);
+
/* Attribute interface */
extern
hdf_idt HDFattrOpen(hdf_idt pid,char *name);
CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) $(BOOST_CPPFLAGS)
CXXFLAGS+=$(OCC_CXXFLAGS) $(BOOST_CPPFLAGS)
-LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace -lSalomeDSImpl -lSalomeGenericObj $(CAS_LDPATH) -lTKernel -lTKCAF -lTKBO -lTKStdSchema -lSalomeGenericObj -lSalomeLifeCycleCORBA
+LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace -lSalomeDSImpl -lSalomeGenericObj $(CAS_KERNEL) -lSalomeGenericObj -lSalomeLifeCycleCORBA
# _CS_gbo_090604 Ajout Spécifique Calibre 3, pour l'utilisation de la version 5.12 de la bibliothèque OCC.
# La bibliothèque OCC5.12 a été compilée sur Calibre 3 avec l'extention Xmu (impossible de compiler sans).
#
LDXMUFLAGS= -L/usr/X11R6/lib -lXmu
LDFLAGS+=$(LDXMUFLAGS)
-LDFLAGSFORBIN= $(LDFLAGS) -lTKLCAF -lTKMath -lRegistry -lSalomeNotification -lSalomeContainer -lSalomeResourcesManager -lSALOMEBasics
+LDFLAGSFORBIN= $(LDFLAGS) $(CAS_OCAF) -lRegistry -lSalomeNotification -lSalomeContainer -lSalomeResourcesManager -lSALOMEBasics
@CONCLUDE@
{
SALOMEDS::Locker lock;
TCollection_AsciiString ior;
- if(!Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentIOR(ior)) return false;
+ if(!Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentIOR(ior)) {
+ IOR = CORBA::string_dup("");
+ return false;
+ }
IOR = CORBA::string_dup(ior.ToCString());
return true;
}
CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES)
CXXFLAGS+=$(OCC_CXXFLAGS)
-LDFLAGS+= $(HDF5_LIBS) -lSalomeHDFPersist $(CAS_LDPATH) -lTKCAF -lTKBO -lTKLCAF -lTKMath -lTKStdSchema -lTKernel
+LDFLAGS+= $(HDF5_LIBS) -lSalomeHDFPersist $(CAS_OCAF)
# _CS_gbo_090604 Ajout Spécifique Calibre 3, pour l'utilisation de la version 5.12 de la bibliothèque OCC.
# La bibliothèque OCC5.12 a été compilée sur Calibre 3 avec l'extention Xmu (impossible de compiler sans).
CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) $(BOOST_CPPFLAGS)
CXXFLAGS+=$(OCC_CXXFLAGS) $(BOOST_CPPFLAGS)
-LDFLAGS+= -lOpUtil $(CAS_LDPATH) -lTKernel
+LDFLAGS+= -lOpUtil $(CAS_KERNEL)
@CONCLUDE@