-dnl Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
dnl
dnl define macros :
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
using namespace std;
/* read MESH */
MESH * myMesh = new MESH(MED_DRIVER,MedFile,MeshName) ;
- // myMesh->read() ;
// we need a support :
- SUPPORT * mySupport = new SUPPORT(myMesh,"Support on all CELLs",MED_CELL);
+ const SUPPORT * mySupport = myMesh->getSupportOnAll(MED_CELL);
/* create FIELD on mySupport, with 3 components */
int NumberOfCompoennts = 3 ;
}
// save this new field
- int id = myField.addDriver(MED_DRIVER) ;
+ myField.write(MED_DRIVER,filename) ;
return 0 ;
}
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
######################################################################
myMesh = MESH(MED_DRIVER,MedFile,meshName)
-mySupport = SUPPORT(myMesh,"Support on all CELLs",MED_CELL)
+mySupport = myMesh.getSupportOnAll(MED_CELL)
numberOfComponents = 3
myField = FIELDDOUBLE(mySupport,numberOfComponents)
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
using namespace std;
/* read FIELD */
// we need a support :
- SUPPORT * mySupport = new SUPPORT(myMesh,"Support on all Cells",MED_CELL);
+ const SUPPORT * mySupport = myMesh->getSupportOnAll(MED_CELL);
FIELD<double> myField(mySupport,MED_DRIVER,MedFile,FieldName) ;
// myField.read() ;
cout << endl ;
}
- delete mySupport;
- delete myMesh;
+ myMesh->removeReference();
return 0 ;
}
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
######################################################################
MedFile = "pointe.med"
meshName = "maa1"
-fieldName = "fieldcelldouble"
+fieldName = "fieldcelldoublescalar"
myMesh = MESH(MED_DRIVER,MedFile,meshName)
-mySupport = SUPPORT(myMesh,"Support on CELLs",MED_CELL)
+mySupport = myMesh.getSupportOnAll(MED_CELL)
-myField = FIELDDOUBLE(mySupport,MED_DRIVER,MedFile,fieldName)
+myField = FIELDDOUBLE(mySupport,MED_DRIVER,MedFile,fieldName,-1,-1)
numberOfComponents = myField.getNumberOfComponents()
" (and order number ",orderNumber,")"
numberOfValue = mySupport.getNumberOfElements(MED_ALL_ELEMENTS)
-value = myField.getValue(MED_FULL_INTERLACE)
+value = myField.getValue()
for i in range(numberOfValue):
print " * ",value[i*numberOfComponents:(i+1)*numberOfComponents]
myElementConnectivity);
\end{verbatim}
-%%%%%%%%%%% WITH POLY METHODS %%%%%%%%%%%%
-
-\item The listed above methods do not take into account information about
- \verb+polygonal+ and \verb+polyhedral+ cells contained in a MESH object. To get
- full information about cell types, use the same methods with
- \verb+WithPoly+ postfix:
-\begin{itemize}
-\item use \method{getNumberOfTypesWithPoly} to get the number of
- geometric types for a mesh entity;
-\item use \method{getTypesWithPoly} to get all geometric types for a mesh entity;
-\item use \method{getNumberOfElementsWithPoly} to get the number of cells;
-\item use \method{getElementTypeWithPoly} to get the geometric type of
- one element.
-\end{itemize}
-There are separate methods to get number of polygons and polyhedrons:
-\method{getNumberOfPolygons} and \method{getNumberOfPolyhedron}
-
-To get connectivity of polygonal elements, use \method{getPolygonsConnectivity} along with
-\method{getPolygonsConnectivityIndex} (see example \myref{MESHconnectivities.cxx}).
-
-To get nodal connectivity of polyhedral elements, it is necessary use together
-3 methods: \method{getPolyhedronConnectivity}, \method{getPolyhedronFacesIndex}
-and \method{getPolyhedronIndex} (see example \myref{MESHconnectivities.cxx}).
-
\end{enumerate}
Here is a small C++ example program which the Python version may be found in
\item \method{setNumberOfElements} to set the number of elements for
each geometric type. This method allocates connectivities array ;
\item \method{setConnectivity} to set the connectivity in MED\_FULL\_INTERLACE
-mode for each geometric type (use \method{setPolygonsConnectivity} and
-\method{setPolyhedraConnectivity} for poly elements);
+mode for each geometric type;
\end{itemize}
\textbf{C++ Example~:}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Med.hxx"
using namespace MEDMEM ;
using namespace MED_EN ;
main () {
const char * fileName = "pointe.med";
- const char * fieldName = "fieldcelldouble";
+ const char * fieldName = "fieldcelldoublescalar";
const char * meshName = "maa1";
try {
// Test creation of drivers at object Creation time
- //This test failed due to inadequate Support implementation
- // FIELD<double> myField (MED_DRIVER,fileName,fieldName);
+ FIELD<double> myField (MED_DRIVER,fileName,fieldName);
MESH myMesh (MED_DRIVER,fileName,meshName);
- MED myMed (MED_DRIVER,fileName);
// Test removal of drivers
- //myField.rmDriver();
+ myField.rmDriver();
myMesh.rmDriver ();
- myMed.rmDriver ();
} catch (MEDEXCEPTION& ex){
- MESSAGE(ex.what()) ;
+ MESSAGE_MED(ex.what()) ;
}
}
+
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
######################################################################
print "Creation of MESH object"
myMesh = MESH(MED_DRIVER,medFile,meshName)
- print "Creation of MED object"
- myMed = MED(MED_DRIVER,medFile)
-
- print "Test the driver removal dor MESH"
+ print "Test the driver removal for MESH"
myMesh.rmDriver()
- print "Test the driver removal dor MED"
- myMed.rmDriver()
-
print "End of Python script"
except:
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Med.hxx"
-#include "MEDMEM_MedMedDriver.hxx"
#include "MEDMEM_MedMeshDriver.hxx"
using namespace MEDMEM ;
const char * fileName = "pointe.med";
const char * fileName2 = "Field&MeshGeneratedPointe.med";
const char * fileName3 = "MedGeneratedPointe.med";
- const char * fieldName = "fieldcelldouble";
+ const char * fieldName = "fieldcelldoublescalar";
const char * meshName = "maa1";
try {
MED_FIELD_RDONLY_DRIVER<double> myRdOnlyDriver(fileName,myField);
myRdOnlyDriver.setFieldName(fieldName);
myRdOnlyDriver.open();
- //This test failed due to inadequate Support implementation
- // myRdOnlyDriver.read();
+ myRdOnlyDriver.read();
// try { myRdOnlyDriver.write(); } catch (MEDEXCEPTION& ex)
// { MESSAGE(ex.what()); }
MED_FIELD_WRONLY_DRIVER<double> myWrOnlyDriver(fileName2,myField);
myWrOnlyDriver.open();
- //This test failed due to inadequate Support implementation
- // myWrOnlyDriver.write();
+ myWrOnlyDriver.write();
// try myWrOnlyDriver.read(); catch (MEDEXCEPTION& ex)
// { MESSAGE(ex.what()); }
myRdOnlyDriver.close();
myWrOnlyDriver.write();
// try myWrOnlyDriver.read(); catch (MEDEXCEPTION& ex)
// { MESSAGE(ex.what()); }
- // myRdOnlyDriver.close();
- //While we use H5close() in the MESH/FIELD drivers, the next
- //line will fail, because all files are previously closed !
+ myRdOnlyDriver.close();
myWrOnlyDriver.close();
delete myMesh;
}
- {
- MED * myMed = new MED();
- MED_MED_RDONLY_DRIVER myRdOnlyDriver(fileName,myMed);
- myRdOnlyDriver.open();
- myRdOnlyDriver.readFileStruct();
- myRdOnlyDriver.close();
- myMed->updateSupport(); // DOIT ETRE SUPPRIMEE
- // myRdOnlyDriver.read();
- // try { myRdOnlyDriver.write(); } catch (MEDEXCEPTION& ex)
- // { MESSAGE(ex.what()); }
- //MED_MED_WRONLY_DRIVER myWrOnlyDriver(fileName3,myMed);
- //myWrOnlyDriver.open();
- //myWrOnlyDriver.write(); // Not implemented yet.
- //myWrOnlyDriver.close();
- delete myMed;
- }
} catch (MEDEXCEPTION& ex){
cout << "MAIN BLOCK EXCEPTION" << endl;
- MESSAGE(ex.what()) ;
+ MESSAGE_MED(ex.what()) ;
}
}
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
######################################################################
medFile = "pointe.med"
medFile2 = "Field&MeshGeneratedPointe.med"
-fieldName = "fieldcelldouble"
+fieldName = "fieldcelldoublescalar"
meshName = "maa1"
try:
try:
myMesh = MESH()
+
myRdOnlyDriver = MED_MESH_RDONLY_DRIVER(medFile,myMesh)
myRdOnlyDriver.setMeshName(meshName)
myRdOnlyDriver.open()
myRdOnlyDriver.read()
myRdOnlyDriver.close()
- myWrOnlyDriver = MED_MESH_WRONLY_DRIVER(medFile,myMesh)
+ myWrOnlyDriver = MED_MESH_WRONLY_DRIVER(medFile2,myMesh)
myWrOnlyDriver.setMeshName(meshName)
myWrOnlyDriver.open()
myWrOnlyDriver.write()
-
myWrOnlyDriver.close()
print "Invoking mesh drivers OK"
print "there is a problem in invoking mesh drivers !!"
print "Please consult the error standart output of the python execution !!"
-try:
- myMed = MED()
- myRdOnlyDriver = MED_MED_RDONLY_DRIVER(medFile,myMed)
- myRdOnlyDriver.open()
- myRdOnlyDriver.readFileStruct()
- myRdOnlyDriver.close()
- myMed.updateSupport()
-
- print "Invoking Med drivers OK"
-except :
- print "There is a problem in invoking MED drivers !!"
- print "Please consult the error standart output of the python execution !!"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Med.hxx"
using namespace MEDMEM ;
using namespace MED_EN ;
const char * fileName = "pointe.med";
const char * fileName2 = "fieldCellDoubleOfpointe.med";
- const char * fieldName = "fieldcelldouble";
+ const char * fieldName = "fieldcelldoublescalar";
const char * meshName = "maa1";
try {
// Test creation of drivers from the standard driver method of an object
FIELD<double> * myField = new FIELD<double>();
int myDriver1 = myField->addDriver(MED_DRIVER, fileName, fieldName);
- //myField->read();
+ myField->read();
//This test failed due to inadequate Support implementation
myField->rmDriver(); // TESTER LA VALIDITE DE myDriver2 !!!!
int myDriver2 = myField->addDriver(MED_DRIVER, fileName2, fieldName);
- //myField->write(myDriver2);
+ myField->write(myDriver2);
//This test failed due to inadequate Support implementation
myField->rmDriver(myDriver2);
myMesh->read();
myMesh->rmDriver();
- MED * myMed = new MED();
- int myDriver4 = myMed->addDriver(MED_DRIVER, fileName);
- myMed->readFileStruct();
- myMed->rmDriver();
- delete myField;
- delete myMesh;
- delete myMed;
+ myMesh->removeReference();
+ myField->removeReference();
} catch (MEDEXCEPTION& ex){
- MESSAGE(ex.what()) ;
+ MESSAGE_MED(ex.what()) ;
}
}
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
######################################################################
from libMEDMEM_Swig import *
medFile = "pointe.med"
-medFile2 = "fieldCellDoubleOfpointe.me"
-fieldName = "fieldcelldouble"
+medFile2 = "fieldCellDoubleOfpointe.med"
+fieldName = "fieldcelldoublescalar"
meshName = "maa1"
try:
- myField = FIEDLDOUBLE()
+ myField = FIELDDOUBLE()
- myDriver1 = myField->addDriver(MED_DRIVER,medFile,fieldName)
+ myDriver1 = myField.addDriver(MED_DRIVER,medFile,fieldName)
myField.rmDriver()
- myDriver2 = myField->addDriver(MED_DRIVER,medFile2,fieldName)
+ myDriver2 = myField.addDriver(MED_DRIVER,medFile2,fieldName)
myField.rmDriver(myDriver2)
myMesh = MESH()
- myDriver3 = myMesh->addDriver(MED_DRIVER,medFile,meshName)
+ myDriver3 = myMesh.addDriver(MED_DRIVER,medFile,meshName)
myMesh.read()
myMesh.rmDriver()
- myMed = MED()
- myMed.readFileStruct()
- myMed.rmDriver()
-
except:
print "There is a problem somewhere !!"
print "Please consult the error standart output of the python execution !!"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDMEM_Meshing.hxx"
// filename to save the generated MESH
string filename = "meshing.med" ;
- MESHING myMeshing ;
- myMeshing.setName("meshing") ;
+ MESHING* myMeshing = new MESHING;
+ myMeshing->setName("meshing") ;
// define coordinates
0.0, 0.0, 5.0
};
- myMeshing.setCoordinates(SpaceDimension,NumberOfNodes,Coordinates,"CARTESIAN",MED_FULL_INTERLACE);
+ myMeshing->setCoordinates(SpaceDimension,NumberOfNodes,Coordinates,"CARTESIAN",MED_FULL_INTERLACE);
string Names[3] = { "X","Y","Z" } ;
- myMeshing.setCoordinatesNames(Names);
+ myMeshing->setCoordinatesNames(Names);
string Units[3] = { "cm","cm","cm" } ;
- myMeshing.setCoordinatesUnits(Units) ;
+ myMeshing->setCoordinatesUnits(Units) ;
// define conectivities
medGeometryElement Types[NumberOfTypes] = {MED_TETRA4,MED_PYRA5,MED_HEXA8} ;
const int NumberOfElements[NumberOfTypes] = {12,2,2} ;
- myMeshing.setNumberOfTypes(NumberOfTypes,MED_CELL);
- myMeshing.setTypes(Types,MED_CELL);
- myMeshing.setNumberOfElements(NumberOfElements,MED_CELL);
+ myMeshing->setNumberOfTypes(NumberOfTypes,MED_CELL);
+ myMeshing->setTypes(Types,MED_CELL);
+ myMeshing->setNumberOfElements(NumberOfElements,MED_CELL);
const int sizeTetra = 12*4 ;
int ConnectivityTetra[sizeTetra]=
2,10,6,9
};
- myMeshing.setConnectivity(ConnectivityTetra,MED_CELL,MED_TETRA4);
+ myMeshing->setConnectivity(MED_CELL,MED_TETRA4,ConnectivityTetra);
int ConnectivityPyra[2*5]=
{
15,18,17,16,19
};
- myMeshing.setConnectivity(ConnectivityPyra,MED_CELL,MED_PYRA5);
+ myMeshing->setConnectivity(MED_CELL,MED_PYRA5,ConnectivityPyra);
int ConnectivityHexa[2*8]=
{
15,16,17,18,11,12,13,14
};
- myMeshing.setConnectivity(ConnectivityHexa,MED_CELL,MED_HEXA8);
+ myMeshing->setConnectivity(MED_CELL,MED_HEXA8,ConnectivityHexa);
// face part
medGeometryElement FacesTypes[NumberOfFacesTypes] = {MED_TRIA3,MED_QUAD4} ;
const int NumberOfFacesElements[NumberOfFacesTypes] = {4,4} ;
- myMeshing.setNumberOfTypes(NumberOfFacesTypes,MED_FACE);
- myMeshing.setTypes(FacesTypes,MED_FACE);
- myMeshing.setNumberOfElements(NumberOfFacesElements,MED_FACE);
+ myMeshing->setNumberOfTypes(NumberOfFacesTypes,MED_FACE);
+ myMeshing->setTypes(FacesTypes,MED_FACE);
+ myMeshing->setNumberOfElements(NumberOfFacesElements,MED_FACE);
const int sizeTria = 3*4 ;
int ConnectivityTria[sizeTria]=
1,3,6
};
- myMeshing.setConnectivity(ConnectivityTria,MED_FACE,MED_TRIA3);
+ myMeshing->setConnectivity(MED_FACE,MED_TRIA3,ConnectivityTria);
int ConnectivityQua[4*4]=
{
12,8,9,13
};
- myMeshing.setConnectivity(ConnectivityQua,MED_FACE,MED_QUAD4);
+ myMeshing->setConnectivity(MED_FACE,MED_QUAD4,ConnectivityQua);
// edge part
// Node :
{
- GROUP myGroup ;
- myGroup.setName("SomeNodes");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_NODE);
- myGroup.setNumberOfGeometricType(1);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("SomeNodes");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_NODE);
+ myGroup->setNumberOfGeometricType(1);
medGeometryElement myTypes[1] = {MED_NONE};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[1] = {4} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[1+1] = {1,5} ;
const int value[4]= { 1,4,5,7} ;
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
{
- GROUP myGroup ;
- myGroup.setName("OtherNodes");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_NODE);
- myGroup.setNumberOfGeometricType(1);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("OtherNodes");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_NODE);
+ myGroup->setNumberOfGeometricType(1);
medGeometryElement myTypes[1] = {MED_NONE};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[1] = {3} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[1+1] = {1,4} ;
const int value[3]= { 2,3,6} ;
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
// Cell :
{
- GROUP myGroup ;
- myGroup.setName("SomeCells");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_CELL);
- myGroup.setNumberOfGeometricType(3);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("SomeCells");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_CELL);
+ myGroup->setNumberOfGeometricType(3);
medGeometryElement myTypes[3] = {MED_TETRA4,MED_PYRA5,MED_HEXA8};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[3] = {4,1,2} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[3+1] = {1,5,6,8} ;
const int value[4+1+2]=
{
13,
15,16
};
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
{
- GROUP myGroup ;
- myGroup.setName("OtherCells");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_CELL);
- myGroup.setNumberOfGeometricType(2);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("OtherCells");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_CELL);
+ myGroup->setNumberOfGeometricType(2);
medGeometryElement myTypes[] = {MED_TETRA4,MED_PYRA5};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[] = {4,1} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[3+1] = {1,5,6} ;
const int value[4+1]=
{
3,4,5,9,
14
};
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
// Face :
{
- GROUP myGroup ;
- myGroup.setName("SomeFaces");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_FACE);
- myGroup.setNumberOfGeometricType(2);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("SomeFaces");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_FACE);
+ myGroup->setNumberOfGeometricType(2);
medGeometryElement myTypes[2] = {MED_TRIA3,MED_QUAD4};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[2] = {2,3} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[2+1] = {1,3,6} ;
const int value[2+3]=
{
2,4,
5,6,8
} ;
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
{
- GROUP myGroup ;
- myGroup.setName("OtherFaces");
- myGroup.setMesh(&myMeshing);
- myGroup.setEntity(MED_FACE);
- myGroup.setNumberOfGeometricType(1);
+ GROUP* myGroup = new GROUP;
+ myGroup->setName("OtherFaces");
+ myGroup->setMesh(myMeshing);
+ myGroup->setEntity(MED_FACE);
+ myGroup->setNumberOfGeometricType(1);
medGeometryElement myTypes[1] = {MED_TRIA3};
- myGroup.setGeometricType(myTypes);
+ myGroup->setGeometricType(myTypes);
const int myNumberOfElements[1] = {2} ;
- myGroup.setNumberOfElements(myNumberOfElements);
+ myGroup->setNumberOfElements(myNumberOfElements);
const int index[1+1] = {1,3} ;
const int value[2]=
{
1,3
} ;
- myGroup.setNumber(index,value);
+ myGroup->setNumber(index,value);
- myMeshing.addGroup(myGroup);
+ myMeshing->addGroup(*myGroup);
+ myGroup->removeReference();
}
// all rigtht, we save it !
- int id = myMeshing.addDriver(MED_DRIVER,filename,myMeshing.getName());
- myMeshing.write(id) ;
-
+ int id = myMeshing->addDriver(MED_DRIVER,filename,myMeshing->getName());
+ myMeshing->write(id) ;
+ myMeshing->removeReference();
}
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
###################################################################################
numberOfNodes = 19
-coordinates = []
-
-coordinate = [0.0, 0.0, 0.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [0.0, 0.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [2.0, 0.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [0.0, 2.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-2.0, 0.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [0.0, -2.0, 1.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, 1.0, 2.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, 1.0, 2.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, -1.0, 2.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, -1.0, 2.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, 1.0, 3.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, 1.0, 3.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, -1.0, 3.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, -1.0, 3.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, 1.0, 4.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, 1.0, 4.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [-1.0, -1.0, 4.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [1.0, -1.0, 4.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
-coordinate = [0.0, 0.0, 5.0]
-coordinates.append(coordinate[0])
-coordinates.append(coordinate[1])
-coordinates.append(coordinate[2])
+coordinates = [
+ 0.0, 0.0, 0.0 ,
+ 0.0, 0.0, 1.0 ,
+ 2.0, 0.0, 1.0 ,
+ 0.0, 2.0, 1.0 ,
+ -2.0, 0.0, 1.0 ,
+ 0.0, -2.0, 1.0 ,
+ 1.0, 1.0, 2.0 ,
+ -1.0, 1.0, 2.0 ,
+ -1.0, -1.0, 2.0,
+ 1.0, -1.0, 2.0 ,
+ 1.0, 1.0, 3.0 ,
+ -1.0, 1.0, 3.0 ,
+ -1.0, -1.0, 3.0,
+ 1.0, -1.0, 3.0 ,
+ 1.0, 1.0, 4.0 ,
+ -1.0, 1.0, 4.0 ,
+ -1.0, -1.0, 4.0,
+ 1.0, -1.0, 4.0 ,
+ 0.0, 0.0, 5.0]
myMeshing.setCoordinates(spaceDimension,numberOfNodes,coordinates,"CARTESIAN",MED_FULL_INTERLACE)
myMeshing.setTypes(types,entity)
myMeshing.setNumberOfElements(numberOfElements,entity)
-connectivityTetra = []
-
-connectivity = [1,2,3,6]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [1,2,4,3]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [1,2,5,4]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [1,2,6,5]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,7,4,3]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,8,5,4]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,9,6,5]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,10,3,6]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,7,3,10]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,8,4,7]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,9,5,8]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-connectivity = [2,10,6,9]
-connectivityTetra.append(connectivity[0])
-connectivityTetra.append(connectivity[1])
-connectivityTetra.append(connectivity[2])
-connectivityTetra.append(connectivity[3])
-
-myMeshing.setConnectivity(connectivityTetra,entity,types[0])
-
-connectivityPyra = []
-connectivity = [7,8,9,10,2]
-connectivityPyra.append(connectivity[0])
-connectivityPyra.append(connectivity[1])
-connectivityPyra.append(connectivity[2])
-connectivityPyra.append(connectivity[3])
-connectivityPyra.append(connectivity[4])
-connectivity = [15,18,17,16,19]
-connectivityPyra.append(connectivity[0])
-connectivityPyra.append(connectivity[1])
-connectivityPyra.append(connectivity[2])
-connectivityPyra.append(connectivity[3])
-connectivityPyra.append(connectivity[4])
-
-myMeshing.setConnectivity(connectivityPyra,entity,types[1])
-
-connectivityHexa = []
-connectivity = [11,12,13,14,7,8,9,10]
-connectivityHexa.append(connectivity[0])
-connectivityHexa.append(connectivity[1])
-connectivityHexa.append(connectivity[2])
-connectivityHexa.append(connectivity[3])
-connectivityHexa.append(connectivity[4])
-connectivityHexa.append(connectivity[5])
-connectivityHexa.append(connectivity[6])
-connectivityHexa.append(connectivity[7])
-connectivity = [15,16,17,18,11,12,13,14]
-connectivityHexa.append(connectivity[0])
-connectivityHexa.append(connectivity[1])
-connectivityHexa.append(connectivity[2])
-connectivityHexa.append(connectivity[3])
-connectivityHexa.append(connectivity[4])
-connectivityHexa.append(connectivity[5])
-connectivityHexa.append(connectivity[6])
-connectivityHexa.append(connectivity[7])
-
-myMeshing.setConnectivity(connectivityHexa,entity,types[2])
+connectivityTetra = [
+ 1,2,3,6 ,
+ 1,2,4,3 ,
+ 1,2,5,4 ,
+ 1,2,6,5 ,
+ 2,7,4,3 ,
+ 2,8,5,4 ,
+ 2,9,6,5 ,
+ 2,10,3,6,
+ 2,7,3,10,
+ 2,8,4,7 ,
+ 2,9,5,8 ,
+ 2,10,6,9]
+
+myMeshing.setConnectivity(entity,types[0],connectivityTetra)
+
+connectivityPyra = [
+ 7,8,9,10,2,
+ 15,18,17,16,19]
+
+myMeshing.setConnectivity(entity,types[1],connectivityPyra)
+
+connectivityHexa = [
+ 11,12,13,14,7,8,9,10,
+ 15,16,17,18,11,12,13,14]
+
+myMeshing.setConnectivity(entity,types[2],connectivityPyra)
# face part
myMeshing.setTypes(types,entity)
myMeshing.setNumberOfElements(numberOfElements,entity)
-connectivityTria = []
-connectivity = [1,4,3]
-connectivityTria.append(connectivity[0])
-connectivityTria.append(connectivity[1])
-connectivityTria.append(connectivity[2])
-connectivity = [1,5,4]
-connectivityTria.append(connectivity[0])
-connectivityTria.append(connectivity[1])
-connectivityTria.append(connectivity[2])
-connectivity = [1,6,5]
-connectivityTria.append(connectivity[0])
-connectivityTria.append(connectivity[1])
-connectivityTria.append(connectivity[2])
-connectivity = [1,3,6]
-connectivityTria.append(connectivity[0])
-connectivityTria.append(connectivity[1])
-connectivityTria.append(connectivity[2])
-
-myMeshing.setConnectivity(connectivityTria,entity,types[0])
-
-connectivityQuad = []
-connectivity = [7,8,9,10]
-connectivityQuad.append(connectivity[0])
-connectivityQuad.append(connectivity[1])
-connectivityQuad.append(connectivity[2])
-connectivityQuad.append(connectivity[3])
-connectivity = [11,12,13,14]
-connectivityQuad.append(connectivity[0])
-connectivityQuad.append(connectivity[1])
-connectivityQuad.append(connectivity[2])
-connectivityQuad.append(connectivity[3])
-connectivity = [11,7,8,12]
-connectivityQuad.append(connectivity[0])
-connectivityQuad.append(connectivity[1])
-connectivityQuad.append(connectivity[2])
-connectivityQuad.append(connectivity[3])
-connectivity = [12,8,9,13]
-connectivityQuad.append(connectivity[0])
-connectivityQuad.append(connectivity[1])
-connectivityQuad.append(connectivity[2])
-connectivityQuad.append(connectivity[3])
-
-myMeshing.setConnectivity(connectivityQuad,entity,types[1])
-
-meshDimension = spaceDimension # because there 3D cells in the mesh
-myMeshing.setMeshDimension(meshDimension)
+connectivityTria = [
+ 1,4,3,
+ 1,5,4,
+ 1,6,5,
+ 1,3,6]
+
+myMeshing.setConnectivity(entity,types[0],connectivityPyra)
+
+connectivityQuad = [
+ 7,8,9,10 ,
+ 11,12,13,14,
+ 11,7,8,12 ,
+ 12,8,9,13]
+
+myMeshing.setConnectivity(entity,types[1],connectivityQuad)
# edge part
myMeshing.addGroup(myGroup)
-# saving of the generated mesh in MED 2.1, 2.2 and VTK format
+# saving of the generated mesh in MED and VTK format
-medFileVersion = getMedFileVersionForWriting()
-print "Med File Version For Writing ",medFileVersion
+myMeshing.write(MED_DRIVER,med22FileName)
-if (medFileVersion == V22):
- setMedFileVersionForWriting(V21)
-
-idMedV21 = myMeshing.addDriver(MED_DRIVER,med21FileName,myMeshing.getName())
-myMeshing.write(idMedV21)
-
-medFileVersion = getMedFileVersionForWriting()
-if (medFileVersion == V21):
- setMedFileVersionForWriting(V22)
-
-idMedV22 = myMeshing.addDriver(MED_DRIVER,med22FileName,myMeshing.getName())
-myMeshing.write(idMedV22)
-
-idVtk = myMeshing.addDriver(VTK_DRIVER,vtkFileName,myMeshing.getName())
-myMeshing.write(idVtk)
+myMeshing.write(VTK_DRIVER,vtkFileName)
# we build now 8 fields : 4 fields double (integer) :
# 2 fields on nodes (cells) :
# 1 scalar (vector)
-supportOnNodes = SUPPORT(myMeshing,"On_All_Nodes",MED_NODE)
+supportOnNodes = myMeshing.getSupportOnAll(MED_NODE)
numberOfNodes = supportOnNodes.getNumberOfElements(MED_ALL_ELEMENTS)
-supportOnCells = SUPPORT(myMeshing,"On_All_Cells",MED_CELL)
+supportOnCells = myMeshing.getSupportOnAll(MED_CELL)
numberOfCells = supportOnCells.getNumberOfElements(MED_ALL_ELEMENTS)
fieldDoubleScalarOnNodes = FIELDDOUBLE(supportOnNodes,1)
fieldIntVectorOnCells.setValueIJ(i+1,2,valueInt2)
fieldIntVectorOnCells.setValueIJ(i+1,3,valueInt3)
-medFileVersion = getMedFileVersionForWriting()
-print "Med File Version For Writing ",medFileVersion
-
-if (medFileVersion == V22):
- setMedFileVersionForWriting(V21)
-
-idMedV21 = fieldDoubleScalarOnNodes.addDriver(MED_DRIVER,med21FileName,fieldDoubleScalarOnNodes.getName())
-fieldDoubleScalarOnNodes.write(idMedV21)
-
-idMedV21 = fieldIntScalarOnNodes.addDriver(MED_DRIVER,med21FileName,fieldIntScalarOnNodes.getName())
-fieldIntScalarOnNodes.write(idMedV21)
-
-idMedV21 = fieldDoubleVectorOnNodes.addDriver(MED_DRIVER,med21FileName,fieldDoubleVectorOnNodes.getName())
-fieldDoubleVectorOnNodes.write(idMedV21)
-
-idMedV21 = fieldIntVectorOnNodes.addDriver(MED_DRIVER,med21FileName,fieldIntVectorOnNodes.getName())
-fieldIntVectorOnNodes.write(idMedV21)
-
-idMedV21 = fieldDoubleScalarOnCells.addDriver(MED_DRIVER,med21FileName,fieldDoubleScalarOnCells.getName())
-fieldDoubleScalarOnCells.write(idMedV21)
-
-idMedV21 = fieldIntScalarOnCells.addDriver(MED_DRIVER,med21FileName,fieldIntScalarOnCells.getName())
-fieldIntScalarOnCells.write(idMedV21)
-
-idMedV21 = fieldDoubleVectorOnCells.addDriver(MED_DRIVER,med21FileName,fieldDoubleVectorOnCells.getName())
-fieldDoubleVectorOnCells.write(idMedV21)
-
-idMedV21 = fieldIntVectorOnCells.addDriver(MED_DRIVER,med21FileName,fieldIntVectorOnCells.getName())
-fieldIntVectorOnCells.write(idMedV21)
-
-medFileVersion = getMedFileVersionForWriting()
-if (medFileVersion == V21):
- setMedFileVersionForWriting(V22)
-
-idMedV22 = fieldDoubleScalarOnNodes.addDriver(MED_DRIVER,med22FileName,fieldDoubleScalarOnNodes.getName())
-fieldDoubleScalarOnNodes.write(idMedV22)
-
-idMedV22 = fieldIntScalarOnNodes.addDriver(MED_DRIVER,med22FileName,fieldIntScalarOnNodes.getName())
-fieldIntScalarOnNodes.write(idMedV22)
-
-idMedV22 = fieldDoubleVectorOnNodes.addDriver(MED_DRIVER,med22FileName,fieldDoubleVectorOnNodes.getName())
-fieldDoubleVectorOnNodes.write(idMedV22)
-
-idMedV22 = fieldIntVectorOnNodes.addDriver(MED_DRIVER,med22FileName,fieldIntVectorOnNodes.getName())
-fieldIntVectorOnNodes.write(idMedV22)
-
-idMedV22 = fieldDoubleScalarOnCells.addDriver(MED_DRIVER,med22FileName,fieldDoubleScalarOnCells.getName())
-fieldDoubleScalarOnCells.write(idMedV22)
-
-idMedV22 = fieldIntScalarOnCells.addDriver(MED_DRIVER,med22FileName,fieldIntScalarOnCells.getName())
-fieldIntScalarOnCells.write(idMedV22)
-
-idMedV22 = fieldDoubleVectorOnCells.addDriver(MED_DRIVER,med22FileName,fieldDoubleVectorOnCells.getName())
-fieldDoubleVectorOnCells.write(idMedV22)
+fieldIntScalarOnNodes.write(MED_DRIVER,med21FileName)
+fieldDoubleVectorOnNodes.write(MED_DRIVER,med21FileName)
+fieldIntVectorOnNodes.write(MED_DRIVER,med21FileName)
+fieldDoubleScalarOnCells.write(MED_DRIVER,med21FileName)
+fieldIntScalarOnCells.write(MED_DRIVER,med21FileName)
+fieldDoubleVectorOnCells.write(MED_DRIVER,med21FileName)
+fieldIntVectorOnCells.write(MED_DRIVER,med21FileName)
-idMedV22 = fieldIntVectorOnCells.addDriver(MED_DRIVER,med22FileName,fieldIntVectorOnCells.getName())
-fieldIntVectorOnCells.write(idMedV22)
idVtk = fieldDoubleScalarOnNodes.addDriver(VTK_DRIVER,vtkFileName,fieldDoubleScalarOnNodes.getName())
fieldDoubleScalarOnNodes.writeAppend(idVtk)
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDMEM_Mesh.hxx"
using namespace MEDMEM ;
using namespace MED_EN ;
-int main (int argc, char ** argv) {
-
-// const string MedFile = "polyedres.med" ;
-// const string MeshName = "Erreur orientation" ;
-// const string MedFile = "polygones.med" ;
-// const string MeshName = "Bord" ;
+int main (int argc, char ** argv)
+{
+ // const string MedFile = "polyedres.med" ;
+ // const string MeshName = "Erreur orientation" ;
+ // const string MedFile = "polygones.med" ;
+ // const string MeshName = "Bord" ;
const string MedFile = "pointe.med" ;
const string MeshName = "maa1" ;
MESH myMesh(MED_DRIVER,MedFile,MeshName) ;
- myMesh.read() ;
cout << "Mesh name : " << myMesh.getName() << endl << endl ;
medGeometryElement myType = Types[i] ;
int NumberOfElements = myMesh.getNumberOfElements(MED_CELL,myType);
int NomberOfNodesPerCell = Types[i]%100 ;
- const int * Connectivity =
- myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,
- MED_CELL,
- myType);
+ const int * Connectivity = myMesh.getConnectivity(MED_NODAL,MED_CELL,myType);
for (int j=0; j<NumberOfElements; j++){
cout << "Element "<< j+1 <<" : " ;
for (int k=0; k<NomberOfNodesPerCell; k++)
// this example use global access with index array
int NumberOfElements = myMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS);
const int * DescendingConnectivity =
- myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_DESCENDING,
- MED_CELL,
- MED_ALL_ELEMENTS);
+ myMesh.getConnectivity(MED_DESCENDING,MED_CELL,MED_ALL_ELEMENTS);
const int * DescendingConnectivityIndex =
myMesh.getConnectivityIndex(MED_DESCENDING,MED_CELL);
for (int i=0; i<NumberOfElements; i++) {
NumberOfConstituents =
myMesh.getNumberOfElements(ConstituentEntity,MED_ALL_ELEMENTS);
-
+
if (MeshDimension==1) {
- MESSAGE("ERROR : MeshDimension = 1 !");
- MESSAGE("We could not see Reverse Descending Connectivity.") ;
+ MESSAGE_MED("ERROR : MeshDimension = 1 !");
+ MESSAGE_MED("We could not see Reverse Descending Connectivity.") ;
} else {
for (int i=0; i<NumberOfConstituents; i++) {
cout << Constituent << " " << i+1 << " : " ;
int IndexBegin = ReverseDescendingConnectivityIndex[i] ;
int IndexEnd = ReverseDescendingConnectivityIndex[i+1] ;
for (int j=IndexBegin;j<IndexEnd;j++)
- // Index value begin at 1 so use j-1
+ // Index value begin at 1 so use j-1
cout << ReverseDescendingConnectivity[j-1] << " " ;
cout << endl ;
}
cout << "Show "<< Constituent <<" Connectivity (Nodal) :" << endl ;
// this example use global access with index array
const int * ConstituentConnectivity =
- myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,
- ConstituentEntity,
- MED_ALL_ELEMENTS);
+ myMesh.getConnectivity(MED_NODAL,ConstituentEntity,MED_ALL_ELEMENTS);
const int * ConstituentConnectivityIndex =
myMesh.getConnectivityIndex(MED_NODAL,ConstituentEntity);
for (int i=0; i<NumberOfConstituents; i++) {
cout << endl ;
}
- int nbPolygons = myMesh.getNumberOfPolygons();
- if ( nbPolygons > 0 )
- {
- cout << "Show Connectivity (Nodal) of POLYGONS:" << endl ;
- const int* Connectivity = myMesh.getPolygonsConnectivity(MED_NODAL,MED_CELL);
- const int* ConnectivityIndex = myMesh.getPolygonsConnectivityIndex(MED_NODAL,MED_CELL);
- for (int j=0; j<nbPolygons; j++){
- cout << "Polygon "<< j+1 <<" : " ;
- int IndexBegin = ConnectivityIndex[j];
- int IndexEnd = ConnectivityIndex[j+1];
- for (int k=IndexBegin; k<IndexEnd; k++)
- cout << Connectivity[k-1]<<" ";
- cout << endl ;
- }
- }
-
- int nbPolyhedrons = myMesh.getNumberOfPolyhedron();
- if ( nbPolyhedrons > 0 )
- {
- cout << "Show Connectivity (Nodal) of POLYHEDRONS:" << endl ;
- const int* Connectivity = myMesh.getPolyhedronConnectivity(MED_NODAL);
- const int* FaceIndex = myMesh.getPolyhedronFacesIndex();
- const int* Index = myMesh.getPolyhedronIndex(MED_NODAL);
- for (int j=0; j<nbPolyhedrons; j++){
- cout << "Polyhedron "<< j+1 <<" : " << endl;
- int FaceIndexBegin = Index[j];
- int FaceIndexEnd = Index[j+1];
- for (int k=FaceIndexBegin; k<FaceIndexEnd; k++) {
- cout << " Face " << k - FaceIndexBegin + 1 << " : ";
- int IndexBegin = FaceIndex[k-1];
- int IndexEnd = FaceIndex[k];
- for (int i=IndexBegin; i<IndexEnd; i++)
- cout << Connectivity[i-1]<<" ";
- cout << endl ;
- }
- }
- }
-
return 0 ;
}
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
from libMEDMEM_Swig import *
type = cellType.getType()
numberOfElements = myMesh.getNumberOfElements(MED_CELL,type)
numberOfNodesPerCell = cellType.getNumberOfNodes()
- connectivity = myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,MED_CELL,type)
+ connectivity = myMesh.getConnectivity(MED_NODAL,MED_CELL,type)
print "For Type ",nameType," : "
for j in range(numberOfElements):
print "Element ",(j+1)," : ",connectivity[j*numberOfNodesPerCell:
# This example use global access with index array
numberOfElements = myMesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS)
-descendingConnectivity = myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_DESCENDING,MED_CELL,
- MED_ALL_ELEMENTS)
-descendingConnectivityIndex = myMesh.getConnectivityIndex(MED_DESCENDING,
- MED_CELL)
+descendingConnectivity = myMesh.getConnectivity(MED_DESCENDING,MED_CELL,MED_ALL_ELEMENTS)
+descendingConnectivityIndex = myMesh.getConnectivityIndex(MED_DESCENDING,MED_CELL)
for i in range(numberOfElements):
indexBegin = descendingConnectivityIndex[i]
print "Show ",constituent," Connectivity (Nodal) :"
- constituentConnectivity = myMesh.getConnectivity(MED_FULL_INTERLACE,
- MED_NODAL,
- constituentEntity,
- MED_ALL_ELEMENTS)
- constituentConnectivityIndex = myMesh.getConnectivityIndex(MED_NODAL,
- constituentEntity)
+ constituentConnectivity = myMesh.getConnectivity(MED_NODAL,constituentEntity,MED_ALL_ELEMENTS)
+ constituentConnectivityIndex = myMesh.getConnectivityIndex(MED_NODAL,constituentEntity)
for i in range(numberOfConstituents):
indexBegin = constituentConnectivityIndex[i]
pass
pass
-nbPolygons = myMesh.getNumberOfPolygons()
-if nbPolygons > 0 :
- print ""
- print " Show Connectivity (Nodal) of POLYGONS:"
- print ""
- connectivity = myMesh.getPolygonsConnectivity(MED_NODAL,MED_CELL)
- index = myMesh.getPolygonsConnectivityIndex(MED_NODAL,MED_CELL)
- for j in range(nbPolygons):
- print " Polygon",(j+1)," ",connectivity[ index[j]-1 : index[j+1]-1 ]
- pass
- pass
-
-nbPolyhedrons = myMesh.getNumberOfPolyhedron()
-if nbPolyhedrons > 0 :
- print ""
- print " Show Connectivity (Nodal) of POLYHEDRONS:"
- print ""
- connectivity = myMesh.getPolyhedronConnectivity(MED_NODAL)
- fIndex = myMesh.getPolyhedronFacesIndex()
- index = myMesh.getPolyhedronIndex(MED_NODAL)
- for j in range(nbPolyhedrons):
- print " Polyhedra",(j+1)
- iF1, iF2 = index[ j ]-1, index[ j+1 ]-1
- for f in range( iF2 - iF1 ):
- iN1, iN2 = fIndex[ iF1+f ]-1, fIndex[ iF1+f+1 ]-1
- print " Face",f+1," ",connectivity[ iN1 : iN2 ]
- pass
- pass
- pass
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDMEM_Mesh.hxx"
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
from libMEDMEM_Swig import *
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
using namespace std;
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
from libMEDMEM_Swig import *
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
MEDMEM_InvokingDriverByAttachingItToAnObject.py \
MEDMEM_InvokingDriverFromStandardObjectMethod.cxx \
MEDMEM_InvokingDriverFromStandardObjectMethod.py \
- MEDMEM_MedAddingAnExistingObject.cxx \
MEDMEM_UsersGuide.lyx \
MESHconnectivities.cxx \
MESHconnectivities.py \
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
SUBDIRS = MEDMEM salome doxygen
dev_docs:
(cd salome && $(MAKE) $(AM_MAKEFLAGS) dev_docs)
+usr_docs:
+ (cd doxygen && $(MAKE) $(AM_MAKEFLAGS) html-local)
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# -* Makefile *-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Doxyfile 1.4.6
#---------------------------------------------------------------------------
# Project related configuration options
-body {
- font-family: Arial, Helvetica, sans-serif;
- background-color: #ffffff;
-}
-
-h1 {
- text-align: center;
- text-decoration: none;
- border: none;
- line-height: 25px;
- text-align: center;
-// text-transform:uppercase;
- background: #D9f4fd;
- font-size: 12pt;
- font-weight: bold;
- border: 1px solid #CCCCCC;
- margin-top: 50px;
- -moz-border-radius: 8px;
- -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
+/* The standard CSS for doxygen */
+
+body, table, div, p, dl {
+ font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
+ font-size: 12px;
+}
+
+/* @group Heading Levels */
+
+h1 {
+ font-size: 150%;
}
h2 {
- font-size: 12pt;
- font-weight: bold;
+ font-size: 120%;
}
-table {
- font-size: 10pt;
- padding-left: 20px;
+h3 {
+ font-size: 100%;
}
-CAPTION {
- font-weight: bold
+dt {
+ font-weight: bold;
}
-/* Link in the top navbar */
-A.qindex {}
+div.multicol {
+ -moz-column-gap: 1em;
+ -webkit-column-gap: 1em;
+ -moz-column-count: 3;
+ -webkit-column-count: 3;
+}
-A.qindexRef {}
+p.startli, p.startdd, p.starttd {
+ margin-top: 2px;
+}
-/* Link to any cross-referenced Doxygen element inside a code section
- (ex: header)
-*/
-A.code {
- text-decoration: none;
- font-weight: normal;
- color: #4444ee
+p.endli {
+ margin-bottom: 0px;
}
-A.codeRef {
- font-weight: normal;
- color: #4444ee
+p.enddd {
+ margin-bottom: 4px;
}
-A:hover {
- text-decoration: none;
- background-color: lightblue;
+p.endtd {
+ margin-bottom: 2px;
}
-div.contents {
- font-family: Arial, Helvetica, sans-serif;
- font-size: 10pt;
- padding: 20px;
+/* @end */
+
+caption {
+ font-weight: bold;
}
-div.navpath {
- font-size: 11pt;
+span.legend {
+ font-size: 70%;
+ text-align: center;
}
-div.header {
- background: url("head.png");
- background-color: #175783;
- border: 1px solid;
- height: 80px;
- background-repeat: no-repeat;
- margin-bottom:20px;
+h3.version {
+ font-size: 90%;
+ text-align: center;
}
-div.tabs {
- text-align: justify;
- margin-left : 2px;
- margin-right : 2px;
- margin-top : 2px;
- margin-bottom : 2px
- font-weight: bold;
- color: #FFFFFF;
+div.qindex, div.navtab{
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ padding: 2px;
}
-div.footer {
- background-color: #D9f4fd;
- border: 1px solid #AAAAAA;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 11px;
- padding: 10px;
+div.qindex, div.navpath {
+ width: 100%;
+ line-height: 140%;
}
-div.div-footer {
- background-color: #D9f4fd;
- border: 1px solid #AAAAAA;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 11px;
- padding: 10px;
- text-align: center;
-}
-
-DL.el {
- margin-left: -1cm
-}
-
-/* A code fragment (ex: header) */
-div.fragment {
- border: none;
-}
-
-/* In the alpha list (coumpound index), style of an alphabetical index letter */
-DIV.ah {
- background-color: #CCCCCC;
- font-weight: bold;
- color: #ffffff;
- margin-bottom: 3px;
- margin-top: 3px
-}
-
-/* Method name (+ type) */
-TD.md {
- background-color: lightblue;
- font-weight: bold;
-}
-
-/* Method parameter (some of them) */
-TD.mdname1 {
- background-color: lightblue;
- font-weight: bold; color: #602020;
-}
-
-/* Method parameter (some of them) */
-TD.mdname {
- background-color: lightblue;
- font-weight: bold;
- color: #602020;
- width: 600px;
-}
-
-/* Separator between methods group (usually empty, seems not supported by IE) */
-DIV.groupHeader {
- margin-left: 16px;
- margin-top: 12px;
- margin-bottom: 6px;
- font-weight: bold
-}
-
-DIV.groupText {
- margin-left: 16px;
- font-style: italic;
- font-size: smaller
-}
-
-/*div.div-page {
- background-color: #FFFFFF;
- margin-left: 1em;
- margin-right: 1em;
- margin-top: 1em;
- margin-bottom: 0.1em;
-
- padding-left: 1em;
- padding-right: 1em;
- padding-top: 0.5em;
- padding-bottom: 0.5em;
-
- border: 2px solid #0D299A;
- border-width: 2px;
- border-color: #0D299A;
-}*/
-
-div.tabs {
- text-align: justify;
- margin-left : 2px;
- margin-right : 2px;
- margin-top : 2px;
- margin-bottom : 2px
- font-weight: bold;
- color: #FFFFFF;
-}
-
-/* In File List, Coumpound List, etc, 1st column of the index */
-TD.indexkey {
- background-color: #DDDDEE;
- font-weight: bold;
- padding-right : 10px;
- padding-top : 2px;
- padding-left : 10px;
- padding-bottom : 2px;
- margin-left : 0px;
- margin-right : 0px;
- margin-top : 2px;
- margin-bottom : 2px
-}
-
-/* In File List, Coumpound List, etc, 2nd column of the index */
-TD.indexvalue {
- background-color: #EEEEFF;
- font-style: italic;
- padding-right : 10px;
- padding-top : 2px;
- padding-left : 10px;
- padding-bottom : 2px;
- margin-left : 0px;
- margin-right : 0px;
- margin-top : 2px;
- margin-bottom : 2px
-}
-
-span.keyword { color: #008000 }
-span.keywordtype { color: #604020 }
-span.keywordflow { color: #e08000 }
-span.comment { color: #800000 }
-span.preprocessor { color: #806020 }
-span.stringliteral { color: #002080 }
-span.charliteral { color: #008080 }
-
-/* @group Code Colorization */
+div.navtab {
+ margin-right: 15px;
+}
+
+/* @group Link Styling */
+
+a {
+ color: #3D578C;
+ font-weight: normal;
+ text-decoration: none;
+}
+
+.contents a:visited {
+ color: #4665A2;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+a.qindex {
+ font-weight: bold;
+}
+
+a.qindexHL {
+ font-weight: bold;
+ background-color: #9CAFD4;
+ color: #ffffff;
+ border: 1px double #869DCA;
+}
+
+.contents a.qindexHL:visited {
+ color: #ffffff;
+}
+
+a.el {
+ font-weight: bold;
+}
+
+a.elRef {
+}
+
+a.code {
+ color: #4665A2;
+}
+
+a.codeRef {
+ color: #4665A2;
+}
+
+/* @end */
+
+dl.el {
+ margin-left: -1cm;
+}
.fragment {
font-family: monospace, fixed;
- font-size: 10pt;
+ font-size: 105%;
}
pre.fragment {
- width: 95%;
- border: 1px solid #CCCCCC;
- -moz-border-radius: 8px;
- -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
- background-color:#EEF3F5;
+ border: 1px solid #C4CFE5;
+ background-color: #FBFCFD;
padding: 4px 6px;
- margin: 20px;
+ margin: 4px 8px 4px 2px;
+ overflow: auto;
+ word-wrap: break-word;
+ font-size: 9pt;
+ line-height: 125%;
+}
+
+div.ah {
+ background-color: black;
+ font-weight: bold;
+ color: #ffffff;
+ margin-bottom: 3px;
+ margin-top: 3px;
+ padding: 0.2em;
+ border: solid thin #333;
+ border-radius: 0.5em;
+ -webkit-border-radius: .5em;
+ -moz-border-radius: .5em;
+ box-shadow: 2px 2px 3px #999;
+ -webkit-box-shadow: 2px 2px 3px #999;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
+ background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
+}
+
+div.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ font-weight: bold;
}
-/* Top Navigation style */
+div.version {
+ border:1px solid #0000FF;
+ color: #CCCCCC;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 9pt;
+ text-align: center;
+ width:100px;
+ -moz-border-radius: 8px;
+ margin: 5px;
+}
+
+div.footer1 {
+ background-color: #DFE5F1;
+ border: 1px solid #AAAAAA;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ padding: 10px;
+ margin-top: 15px;
+}
+
+
+div.groupText {
+ margin-left: 16px;
+ font-style: italic;
+}
-div.navigation {
- margin-bottom:20px;
+body {
+ background: white;
+ color: black;
+ margin: 0;
}
-/* Left navigation panel style */
+div.contents {
+ margin-top: 10px;
+ margin-left: 10px;
+ margin-right: 10px;
+}
-body.ftvtree {
- background-color: #D9f4fd;
- margin: 10px;
+td.indexkey {
+ background-color: #EBEFF6;
+ font-weight: bold;
+ border: 1px solid #C4CFE5;
+ margin: 2px 0px 2px 0;
+ padding: 2px 10px;
}
-div.directory {
- margin: 0;
+td.indexvalue {
+ background-color: #EBEFF6;
+ border: 1px solid #C4CFE5;
+ padding: 2px 10px;
+ margin: 2px 0px;
}
-div.directory.p {
- margin: 0;
+tr.memlist {
+ background-color: #EEF1F7;
}
-h3.swap {
- font-size: 10pt;
- margin-bottom: 0;
+p.formulaDsp {
+ text-align: center;
}
-/* Link to any cross-referenced Doxygen element */
-a.el {
- text-decoration: none;
- font-family: Arial, Helvetica, sans-serif;
- font-weight: bold;
- font-size: 10pt;
- color: #551a8b;
+img.formulaDsp {
+
}
-a.el:hover {
- background-color: transparent;
- color: #551acc;
+img.formulaInl {
+ vertical-align: middle;
}
-a {
-// text-decoration: none;
- font-family: Arial, Helvetica, sans-serif;
- font-weight: bold;
- font-size: 10pt;
- color: #551a8b;
+div.center {
+ text-align: center;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px;
}
-a:hover {
- background-color: transparent;
- color: #551acc;
+div.center img {
+ border: 0px;
}
-a.elRef {
- font-weight: normal;
+address.footer {
+ text-align: right;
+ padding-right: 12px;
}
+img.footer {
+ border: 0px;
+ vertical-align: middle;
+}
-#MSearchBox {
- -moz-border-radius:8px 8px 8px 8px;
- background-color:white;
- border:1px solid #84B0C7;
- margin:0;
- padding:0;
- white-space:nowrap;
+/* @group Code Colorization */
+
+span.keyword {
+ color: #008000
}
-div.directory img {
- vertical-align:-30%;
+span.keywordtype {
+ color: #604020
}
-div.directory p {
- white-space:nowrap;
- margin: 0;
+span.keywordflow {
+ color: #e08000
}
-div.directory-alt div {
- display: none;
- margin: 0px;
+span.comment {
+ color: #800000
}
+span.preprocessor {
+ color: #806020
+}
-div.directory div {
- display: none;
- margin: 0px;
+span.stringliteral {
+ color: #002080
}
-div.version {
- background-color:#ffffde;
- border:1px solid #cccccc;
- font-family: Arial, Helvetica, sans-serif;
- font-size: 9pt;
- text-align: center;
- width:100px;
- -moz-border-radius: 8px;
- // -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
+span.charliteral {
+ color: #008080
}
+span.vhdldigit {
+ color: #ff00ff
+}
+
+span.vhdlchar {
+ color: #000000
+}
+
+span.vhdlkeyword {
+ color: #700070
+}
+
+span.vhdllogic {
+ color: #ff0000
+}
+
+/* @end */
+
+/*
+.search {
+ color: #003399;
+ font-weight: bold;
+}
+
+form.search {
+ margin-bottom: 0px;
+ margin-top: 0px;
+}
+
+input.search {
+ font-size: 75%;
+ color: #000080;
+ font-weight: normal;
+ background-color: #e8eef2;
+}
+*/
+
+td.tiny {
+ font-size: 75%;
+}
+
+.dirtab {
+ padding: 4px;
+ border-collapse: collapse;
+ border: 1px solid #A3B4D7;
+}
+
+th.dirtab {
+ background: #EBEFF6;
+ font-weight: bold;
+}
+
+hr {
+ height: 0px;
+ border: none;
+ border-top: 1px solid #4A6AAA;
+}
+
+hr.footer {
+ height: 1px;
+}
/* @group Member Descriptions */
+table.memberdecls {
+ border-spacing: 0px;
+ padding: 0px;
+}
+
.mdescLeft, .mdescRight,
.memItemLeft, .memItemRight,
.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
- background-color: #FAFAFA;
- border: none;
- margin: 4px;
- padding: 1px 0 0 8px;
+ background-color: #F9FAFC;
+ border: none;
+ margin: 4px;
+ padding: 1px 0 0 8px;
}
.mdescLeft, .mdescRight {
- padding: 0px 8px 4px 8px;
- color: #555;
+ padding: 0px 8px 4px 8px;
+ color: #555;
}
.memItemLeft, .memItemRight, .memTemplParams {
- border-top: 1px solid #ccc;
+ border-top: 1px solid #C4CFE5;
}
.memItemLeft, .memTemplItemLeft {
}
.memTemplParams {
- color: #606060;
+ color: #4665A2;
white-space: nowrap;
}
/* @end */
+/* @group Member Details */
+
/* Styles for detailed member documentation */
.memtemplate {
- font-size: 80%;
- color: #606060;
- font-weight: normal;
- margin-left: 3px;
+ font-size: 80%;
+ color: #4665A2;
+ font-weight: normal;
+ margin-left: 9px;
}
.memnav {
- background-color: #e8eef2;
- border: 1px solid #84b0c7;
- text-align: center;
- margin: 2px;
- margin-right: 15px;
- padding: 2px;
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
}
.memitem {
- padding: 0;
- margin-bottom: 10px;
+ padding: 0;
+ margin-bottom: 10px;
}
.memname {
white-space: nowrap;
font-weight: bold;
-}
-
-.memproto, .memdoc {
- border: 1px solid #84b0c7;
+ margin-left: 6px;
}
.memproto {
- padding: 0;
- background-color: #d5e1e8;
+ border-top: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 6px 0px 6px 0px;
+ color: #253555;
font-weight: bold;
- -webkit-border-top-left-radius: 8px;
- -webkit-border-top-right-radius: 8px;
- -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
- -moz-border-radius-topleft: 8px;
- -moz-border-radius-topright: 8px;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ /* opera specific markup */
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ border-top-right-radius: 8px;
+ border-top-left-radius: 8px;
+ /* firefox specific markup */
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ -moz-border-radius-topright: 8px;
+ -moz-border-radius-topleft: 8px;
+ /* webkit specific markup */
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -webkit-border-top-right-radius: 8px;
+ -webkit-border-top-left-radius: 8px;
+ background-image:url('nav_f.png');
+ background-repeat:repeat-x;
+ background-color: #E2E8F2;
}
-
-
.memdoc {
+ border-bottom: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
padding: 2px 5px;
- background-color: #eef3f5;
+ background-color: #FBFCFD;
border-top-width: 0;
- -webkit-border-bottom-left-radius: 8px;
- -webkit-border-bottom-right-radius: 8px;
- -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ /* opera specific markup */
+ border-bottom-left-radius: 8px;
+ border-bottom-right-radius: 8px;
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ /* firefox specific markup */
-moz-border-radius-bottomleft: 8px;
-moz-border-radius-bottomright: 8px;
-moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7);
+ /* webkit specific markup */
+ -webkit-border-bottom-left-radius: 8px;
+ -webkit-border-bottom-right-radius: 8px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7));
}
.paramkey {
- text-align: right;
+ text-align: right;
}
.paramtype {
- white-space: nowrap;
+ white-space: nowrap;
}
.paramname {
- color: #602020;
- white-space: nowrap;
+ color: #602020;
+ white-space: nowrap;
}
.paramname em {
- font-style: normal;
+ font-style: normal;
+}
+
+.params, .retval, .exception, .tparams {
+ border-spacing: 6px 2px;
+}
+
+.params .paramname, .retval .paramname {
+ font-weight: bold;
+ vertical-align: top;
+}
+
+.params .paramtype {
+ font-style: italic;
+ vertical-align: top;
+}
+
+.params .paramdir {
+ font-family: "courier new",courier,monospace;
+ vertical-align: top;
+}
+
+
+
+
+/* @end */
+
+/* @group Directory (tree) */
+
+/* for the tree view */
+
+.ftvtree {
+ font-family: sans-serif;
+ margin: 0px;
+}
+
+/* these are for tree view when used as main index */
+
+.directory {
+ font-size: 9pt;
+ font-weight: bold;
+ margin: 5px;
+}
+
+.directory h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+/*
+The following two styles can be used to replace the root node title
+with an image of your choice. Simply uncomment the next two styles,
+specify the name of your image and be sure to set 'height' to the
+proper pixel height of your image.
+*/
+
+/*
+.directory h3.swap {
+ height: 61px;
+ background-repeat: no-repeat;
+ background-image: url("yourimage.gif");
+}
+.directory h3.swap span {
+ display: none;
+}
+*/
+
+.directory > h3 {
+ margin-top: 0;
+}
+
+.directory p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory div {
+ display: none;
+ margin: 0px;
+}
+
+.directory img {
+ vertical-align: -30%;
+}
+
+/* these are for tree view when not used as main index */
+
+.directory-alt {
+ font-size: 100%;
+ font-weight: bold;
+}
+
+.directory-alt h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+.directory-alt > h3 {
+ margin-top: 0;
+}
+
+.directory-alt p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory-alt div {
+ display: none;
+ margin: 0px;
+}
+
+.directory-alt img {
+ vertical-align: -30%;
}
/* @end */
+
+div.dynheader {
+ margin-top: 8px;
+}
+
+address {
+ font-style: normal;
+ color: #2A3D61;
+}
+
+table.doxtable {
+ border-collapse:collapse;
+}
+
+table.doxtable td, table.doxtable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+table.doxtable th {
+ background-color: #374F7F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+ text-align:left;
+}
+
+.tabsearch {
+ top: 0px;
+ left: 10px;
+ height: 36px;
+ background-image: url('tab_b.png');
+ z-index: 101;
+ overflow: hidden;
+ font-size: 13px;
+}
+
+.navpath ul
+{
+ font-size: 11px;
+ background-image:url('tab_b.png');
+ background-repeat:repeat-x;
+ height:30px;
+ line-height:30px;
+ color:#8AA0CC;
+ border:solid 1px #C2CDE4;
+ overflow:hidden;
+ margin:0px;
+ padding:0px;
+}
+
+.navpath li
+{
+ list-style-type:none;
+ float:left;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:url('bc_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+}
+
+.navpath li.navelem a
+{
+ height:32px;
+ display:block;
+ text-decoration: none;
+ outline: none;
+}
+
+.navpath li.navelem a:hover
+{
+ color:#6884BD;
+}
+
+.navpath li.footer
+{
+ list-style-type:none;
+ float:right;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:none;
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+ font-size: 8pt;
+}
+
+
+div.summary
+{
+ float: right;
+ font-size: 8pt;
+ padding-right: 5px;
+ width: 50%;
+ text-align: right;
+}
+
+div.summary a
+{
+ white-space: nowrap;
+}
+
+div.ingroups
+{
+ font-size: 8pt;
+ padding-left: 5px;
+ width: 50%;
+ text-align: left;
+}
+
+div.ingroups a
+{
+ white-space: nowrap;
+}
+
+div.header
+{
+ background-image:url('nav_h.png');
+ background-repeat:repeat-x;
+ background-color: #F9FAFC;
+ margin: 0px;
+ border-bottom: 1px solid #C4CFE5;
+}
+
+div.headertitle
+{
+ padding: 5px 5px 5px 10px;
+}
+
+dl
+{
+ padding: 0 0 0 10px;
+}
+
+dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug
+{
+ border-left:4px solid;
+ padding: 0 0 0 6px;
+}
+
+dl.note
+{
+ border-color: #D0D000;
+}
+
+dl.warning, dl.attention
+{
+ border-color: #FF0000;
+}
+
+dl.pre, dl.post, dl.invariant
+{
+ border-color: #00D000;
+}
+
+dl.deprecated
+{
+ border-color: #505050;
+}
+
+dl.todo
+{
+ border-color: #00C0E0;
+}
+
+dl.test
+{
+ border-color: #3030E0;
+}
+
+dl.bug
+{
+ border-color: #C08050;
+}
+
+#projectlogo
+{
+ text-align: center;
+ vertical-align: bottom;
+ border-collapse: separate;
+}
+
+#projectlogo img
+{
+ border: 0px none;
+}
+
+#projectname
+{
+ background-color: #175783;
+ border: 1px solid;
+ height: 80px;
+ background-repeat: no-repeat;
+/* font: 300% arial,sans-serif;*/
+ margin: 0px;
+ padding: 0px;
+}
+
+#projectbrief
+{
+ font: 120% arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#projectnumber
+{
+ font: 50% arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#titlearea
+{
+ background: url("head.png");
+ background-color: #175783;
+ border: 1px solid;
+ height: 80px;
+ background-repeat: no-repeat;
+ padding: 0px;
+ margin: 0px;
+ width: 100%;
+ border-bottom: 1px solid #5373B4;
+}
+
<head>
</head>
<body>
-<div class="footer">
+<div class="footer1">
<!--hr style="width: 100%; height: 2px;"-->
<div style="text-align: center;">
-Copyright © 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE<br>
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS<br>
</div>
</div>
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
- <title>$title</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
-<link href="tabs.css" rel="stylesheet" type="text/css">
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>$title</title>
+<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
+<link href="$relpath$search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="$relpath$search/search.js"></script>
+<link href="$relpath$navtree.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="$relpath$jquery.js"></script>
+<script type="text/javascript" src="$relpath$navtree.js"></script>
+<script type="text/javascript" src="$relpath$resize.js"></script>
+<script type="text/javascript">
+$(document).ready(initResizable);
+</script>
+<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css"/>
</head>
-<body>
-<div class="header"></div>
-<div align="right"><div class="version">Version: @VERSION@</div></div>
-</body>
-</html>
+<body onload='searchBox.OnSelectItem(0);'>
+<div id="top"><!-- do not remove this div! -->
+<div id="titlearea"><div align="right"><div class="version">Version: @VERSION@</div></div></div>
+
+</div>
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __BBTREE_TXX__
#define __BBTREE_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELBASESDEFINES_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelException.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELEXCEPTION_HXX__
namespace INTERP_KERNEL
{
- class INTERPKERNELBASES_EXPORT Exception : std::exception
+ class INTERPKERNELBASES_EXPORT Exception : public std::exception
{
public:
Exception(const char *what);
class _HashFn = hash<_Key>,
class _EqualKey = std::equal_to<_Key>,
class _Alloc = std::allocator<_Tp> >
- class hash_multimap
+ class HashMultiMap
{
private:
typedef hashtable<std::pair<const _Key, _Tp>, _Key, _HashFn,
allocator_type get_allocator() const { return _M_ht.get_allocator(); }
- hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) { }
+ HashMultiMap() : _M_ht(100, hasher(), key_equal(), allocator_type()) { }
- explicit hash_multimap(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
+ explicit HashMultiMap(size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
- hash_multimap(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
+ HashMultiMap(size_type __n, const hasher& __hf) : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
- hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {}
+ HashMultiMap(size_type __n, const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {}
template<class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type())
+ HashMultiMap(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type())
+ HashMultiMap(_InputIterator __f, _InputIterator __l, size_type __n) : _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf)
+ HashMultiMap(_InputIterator __f, _InputIterator __l, size_type __n, const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
template<class _InputIterator>
- hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
- const hasher& __hf, const key_equal& __eql,
- const allocator_type& __a = allocator_type())
+ HashMultiMap(_InputIterator __f, _InputIterator __l, size_type __n,
+ const hasher& __hf, const key_equal& __eql,
+ const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
bool empty() const { return _M_ht.empty(); }
- void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); }
+ void swap(HashMultiMap& __hs) { _M_ht.swap(__hs._M_ht); }
template<class _K1, class _T1, class _HF, class _EqK, class _Al>
- friend bool operator==(const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&,
- const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&);
+ friend bool operator==(const HashMultiMap<_K1, _T1, _HF, _EqK, _Al>&,
+ const HashMultiMap<_K1, _T1, _HF, _EqK, _Al>&);
iterator begin() { return _M_ht.begin(); }
};
template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
- inline bool operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
- const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
+ inline bool operator==(const HashMultiMap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
+ const HashMultiMap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
{ return __hm1._M_ht == __hm2._M_ht; }
template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
- inline bool operator!=(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
- const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
+ inline bool operator!=(const HashMultiMap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,
+ const HashMultiMap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)
{ return !(__hm1 == __hm2); }
template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>
- inline void swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
- hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
+ inline void swap(HashMultiMap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,
+ HashMultiMap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)
{ __hm1.swap(__hm2); }
}
namespace std
{
// Specialization of insert_iterator so that it will work for HashMap
- // and hash_multimap.
+ // and HashMultiMap.
template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
class insert_iterator<INTERP_KERNEL::HashMap<_Key, _Tp, _HashFn,
_EqKey, _Alloc> >
};
template<class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
- class insert_iterator<INTERP_KERNEL::hash_multimap<_Key, _Tp, _HashFn,
- _EqKey, _Alloc> >
+ class insert_iterator<INTERP_KERNEL::HashMultiMap<_Key, _Tp, _HashFn,
+ _EqKey, _Alloc> >
{
protected:
- typedef INTERP_KERNEL::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>
+ typedef INTERP_KERNEL::HashMultiMap<_Key, _Tp, _HashFn, _EqKey, _Alloc>
_Container;
_Container* container;
typename _Container::iterator iter;
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELSTLEXT_HXX__
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.am
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __NORMALIZEDUNSTRUCTUREDMESH_HXX__
NORM_PENTA6 = 16,
NORM_HEXA8 = 18,
NORM_TETRA10 = 20,
+ NORM_HEXGP12 = 22,
NORM_PYRA13 = 23,
NORM_PENTA15 = 25,
NORM_HEXA20 = 30,
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "BoundingBox.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __BOUNDINGBOX_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CellModel.hxx"
"NORM_POLYGON", "NORM_TRI6", "" , "NORM_QUAD8", "",//5->9
"", "", "", "", "NORM_TETRA4",//10->14
"NORM_PYRA5", "NORM_PENTA6", "", "NORM_HEXA8", "",//15->19
- "NORM_TETRA10", "", "", "NORM_PYRA13", "",//20->24
+ "NORM_TETRA10", "", "NORM_HEXGP12", "NORM_PYRA13", "",//20->24
"NORM_PENTA15", "", "", "", "",//25->29
"NORM_HEXA20", "NORM_POLYHED", "", "", "",//30->34
"", "", "", "", "",//35->39
std::map<NormalizedCellType,CellModel> CellModel::_map_of_unique_instance;
- const CellModel& CellModel::getCellModel(NormalizedCellType type)
+ const CellModel& CellModel::GetCellModel(NormalizedCellType type)
{
if(_map_of_unique_instance.empty())
buildUniqueInstance();
{
if(_type==type)
return true;
- const CellModel& other=getCellModel(type);
+ const CellModel& other=GetCellModel(type);
if(_dim!=other.getDimension())
return false;
bool b1=isQuadratic();
_map_of_unique_instance.insert(std::make_pair(NORM_PYRA5,CellModel(NORM_PYRA5)));
_map_of_unique_instance.insert(std::make_pair(NORM_PENTA6,CellModel(NORM_PENTA6)));
_map_of_unique_instance.insert(std::make_pair(NORM_TETRA10,CellModel(NORM_TETRA10)));
+ _map_of_unique_instance.insert(std::make_pair(NORM_HEXGP12,CellModel(NORM_HEXGP12)));
_map_of_unique_instance.insert(std::make_pair(NORM_PYRA13,CellModel(NORM_PYRA13)));
_map_of_unique_instance.insert(std::make_pair(NORM_PENTA15,CellModel(NORM_PENTA15)));
_map_of_unique_instance.insert(std::make_pair(NORM_HEXA20,CellModel(NORM_HEXA20)));
_sons_con[3][0]=2; _sons_con[3][1]=3; _sons_con[3][2]=0; _sons_con[3][3]=9; _sons_con[3][4]=7; _sons_con[3][5]=6; _nb_of_sons_con[3]=6; _quadratic=true;
}
break;
+ case NORM_HEXGP12:
+ {
+ _nb_of_pts=12; _nb_of_sons=8; _dim=3; _is_simplex=false;
+ _sons_type[0]=NORM_POLYGON; _sons_type[1]=NORM_POLYGON; _sons_type[2]=NORM_QUAD4; _sons_type[3]=NORM_QUAD4; _sons_type[4]=NORM_QUAD4; _sons_type[5]=NORM_QUAD4;
+ _sons_type[6]=NORM_QUAD4; _sons_type[7]=NORM_QUAD4;
+ _sons_con[0][0]=0; _sons_con[0][1]=1; _sons_con[0][2]=2; _sons_con[0][3]=3; _sons_con[0][4]=4; _sons_con[0][5]=5; _nb_of_sons_con[0]=6;
+ _sons_con[1][0]=6; _sons_con[1][1]=11; _sons_con[1][2]=10; _sons_con[1][3]=9; _sons_con[1][4]=8; _sons_con[1][5]=7; _nb_of_sons_con[1]=6;
+ _sons_con[2][0]=0; _sons_con[2][1]=6; _sons_con[2][2]=7; _sons_con[2][3]=1; _nb_of_sons_con[2]=4;
+ _sons_con[3][0]=1; _sons_con[3][1]=7; _sons_con[3][2]=8; _sons_con[3][3]=2; _nb_of_sons_con[3]=4;
+ _sons_con[4][0]=2; _sons_con[4][1]=8; _sons_con[4][2]=9; _sons_con[4][3]=3; _nb_of_sons_con[4]=4;
+ _sons_con[5][0]=3; _sons_con[5][1]=9; _sons_con[5][2]=10; _sons_con[5][3]=4; _nb_of_sons_con[5]=4;
+ _sons_con[6][0]=4; _sons_con[6][1]=10; _sons_con[6][2]=11; _sons_con[6][3]=5; _nb_of_sons_con[6]=4;
+ _sons_con[7][0]=5; _sons_con[7][1]=11; _sons_con[7][2]=6; _sons_con[7][3]=0; _nb_of_sons_con[7]=4;
+ }
+ break;
case NORM_PYRA13:
{
_nb_of_pts=13; _nb_of_sons=5; _dim=3; _linear_type=NORM_PYRA5; _is_simplex=false;
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __CELLMODEL_INTERP_KERNEL_HXX__
class CellModel
{
public:
- static const unsigned MAX_NB_OF_SONS=6;
+ static const unsigned MAX_NB_OF_SONS=8;
static const unsigned MAX_NB_OF_NODES_PER_ELEM=30;
private:
CellModel(NormalizedCellType type);
static void buildUniqueInstance();
public:
- INTERPKERNEL_EXPORT static const CellModel& getCellModel(NormalizedCellType type);
+ INTERPKERNEL_EXPORT static const CellModel& GetCellModel(NormalizedCellType type);
INTERPKERNEL_EXPORT const char *getRepr() const;
INTERPKERNEL_EXPORT bool isDynamic() const { return _dyn; }
INTERPKERNEL_EXPORT bool isQuadratic() const { return _quadratic; }
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __CONVEXINTERSECTOR_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __CONVEXINTERSECTOR_TXX__
#define __CONVEXINTERSECTOR_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __CURVEINTERSECTOR_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __CURVEINTERSECTOR_TXX__
#define __CURVEINTERSECTOR_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __CURVEINTERSECTORP0P0_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
//
-// See http://www.salome-platform.org/ or email :webmaster.salome@opencascade.com
#ifndef __CURVEINTERSECTORP0P0_TXX__
#define __CURVEINTERSECTORP0P0_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __CURVEINTERSECTORP0P1_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
//
-// See http://www.salome-platform.org/ or email :webmaster.salome@opencascade.com
#ifndef __CurveIntersectorP0P1_TXX__
#define __CurveIntersectorP0P1_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __CURVEINTERSECTORP1P0_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
//
-// See http://www.salome-platform.org/ or email :webmaster.salome@opencascade.com
#ifndef __CurveIntersectorP1P0_TXX__
#define __CurveIntersectorP1P0_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __CURVEINTERSECTORP1P1_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
//
-// See http://www.salome-platform.org/ or email :webmaster.salome@opencascade.com
#ifndef __CurveIntersectorP1P1_TXX__
#define __CurveIntersectorP1P1_TXX__
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : DirectedBoundingBox.cxx
// Created : Mon Apr 12 14:41:22 2010
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __DIRECTEDBOUNDINGBOX_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELEXPREVALDEFINES_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelAsmX86.hxx"
void INTERP_KERNEL::AsmX86::convertMov(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
const char ASM1[]="ebp,esp";
- const char ML1[2]={0x89,0xe5};
+ const unsigned char ML1[2]={0x89,0xe5};
if(inst==ASM1)
{
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
return ;
}
const char ASM2[]="rbp,rsp";
- const char ML2[3]={0x48,0x89,0xe5};
+ const unsigned char ML2[3]={0x48,0x89,0xe5};
if(inst==ASM2)
{
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
throw INTERP_KERNEL::Exception("not recognized convertMovToEsp exp !");
std::string inst1bis=inst1.substr(1,inst1.length()-2);
const char ASM1[]="esp";
- const char ML1[3]={0xc7,0x04,0x24};
+ const unsigned char ML1[3]={0xc7,0x04,0x24};
if(inst1bis==ASM1)
{//mov dword [esp],0x3ff3c0ca
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
{
if(inst1bis[3]=='+')
{//mov dword [esp+4],0x3ff3c0ca
- const char ML2[3]={0xc7,0x44,0x24};
+ const unsigned char ML2[3]={0xc7,0x44,0x24};
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
std::string::size_type pos=inst1bis.find_first_of(']');
std::string inst1_1=inst1bis.substr(4,pos-4-1);
throw INTERP_KERNEL::Exception("Not recognized exp : mov [esp@..],...");
}
const char ASM3[]="rsp";
- const char ML3[3]={0xc7,0x04,0x24};
+ const unsigned char ML3[3]={0xc7,0x04,0x24};
if(inst1bis==ASM3)
{//mov dword [rsp],0x3ff3c0ca
ml.insert(ml.end(),ML3,ML3+sizeof(ML3));
{
if(inst1bis[3]=='+')
{//mov dword [rsp+4],0x3ff3c0ca
- const char ML2[3]={0xc7,0x44,0x24};
+ const unsigned char ML2[3]={0xc7,0x44,0x24};
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
std::string::size_type pos=inst1bis.find_first_of(']');
std::string inst1_1=inst1bis.substr(4,pos-4-1);
std::string::size_type pos=inst.find_first_of(' ');
std::string inst2=inst.substr(pos+1);
const char ASM1[]="ebp";
- const char ML1[1]={0x55};
+ const unsigned char ML1[1]={0x55};
if(inst2==ASM1)
{//push ebp
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
return ;
}
const char ASM2[]="ebx";
- const char ML2[1]={0x53};
+ const unsigned char ML2[1]={0x53};
if(inst2==ASM2)
{//push ebx
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
return ;
}
const char ASM3[]="rbp";
- const char ML3[1]={0x55};
+ const unsigned char ML3[1]={0x55};
if(inst2==ASM3)
{//push rbp
ml.insert(ml.end(),ML3,ML3+sizeof(ML3));
std::string::size_type pos=inst.find_first_of(' ');
std::string inst2=inst.substr(pos+1);
const char ASM1[]="ebp";
- const char ML1[1]={0x5d};
+ const unsigned char ML1[1]={0x5d};
if(inst2==ASM1)
{//push ebp
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
return ;
}
const char ASM2[]="ebx";
- const char ML2[1]={0x5b};
+ const unsigned char ML2[1]={0x5b};
if(inst2==ASM2)
{//push ebx
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
std::string params2=params.substr(1,params.length()-2);
if(params2.substr(0,3)=="esp")
{
- const char ML1[3]={0xdd,0x04,0x24};
+ const unsigned char ML1[3]={0xdd,0x04,0x24};
if(params2.length()==3)
{//fld qword [esp]
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
}
if(params2.substr(0,3)=="ebp")
{
- const char ML2[2]={0xdd,0x45};
+ const unsigned char ML2[2]={0xdd,0x45};
if(params2.length()==3)
{//fld qword [ebp]
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
}
if(params2.substr(0,3)=="rsp")
{
- const char ML2[3]={0xdd,0x04,0x24};
+ const unsigned char ML2[3]={0xdd,0x04,0x24};
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));// to improve ! no fully managed !
return ;
}
void INTERP_KERNEL::AsmX86::convertFaddp(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML1[2]={0xde,0xc1};
+ const unsigned char ML1[2]={0xde,0xc1};
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
}
void INTERP_KERNEL::AsmX86::convertFsubp(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML1[2]={0xde,0xe9};
+ const unsigned char ML1[2]={0xde,0xe9};
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
}
void INTERP_KERNEL::AsmX86::convertFmulp(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML1[2]={0xde,0xc9};
+ const unsigned char ML1[2]={0xde,0xc9};
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
}
void INTERP_KERNEL::AsmX86::convertFdivp(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML1[2]={0xde,0xf9};
+ const unsigned char ML1[2]={0xde,0xf9};
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
}
void INTERP_KERNEL::AsmX86::convertFcos(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML[2]={0xd9,0xff};
+ const unsigned char ML[2]={0xd9,0xff};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
void INTERP_KERNEL::AsmX86::convertFsin(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML[2]={0xd9,0xfe};
+ const unsigned char ML[2]={0xd9,0xfe};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
void INTERP_KERNEL::AsmX86::convertFabs(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML[2]={0xd9,0xe1};
+ const unsigned char ML[2]={0xd9,0xe1};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
void INTERP_KERNEL::AsmX86::convertFchs(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML[2]={0xd9,0xe0};
+ const unsigned char ML[2]={0xd9,0xe0};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
void INTERP_KERNEL::AsmX86::convertFsqrt(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML[2]={0xd9,0xfa};
+ const unsigned char ML[2]={0xd9,0xfa};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
{
if(inst.substr(0,4)=="esp,")
{
- const char ML[2]={0x81,0xec};
+ const unsigned char ML[2]={0x81,0xec};
ml.insert(ml.end(),ML,ML+sizeof(ML));
std::string inst2=inst.substr(4);
appendAddress(inst2,4,ml);
}
if(inst.substr(0,4)=="rsp,")
{
- const char ML[4]={0x48,0x83,0xec,0x08};
+ const unsigned char ML[4]={0x48,0x83,0xec,0x08};
ml.insert(ml.end(),ML,ML+sizeof(ML)); // to improve 8 statically put (last of element of ML) !!!!
return;
}
{
if(inst.substr(0,4)=="esp,")
{
- const char ML[2]={0x81,0xc4};
+ const unsigned char ML[2]={0x81,0xc4};
ml.insert(ml.end(),ML,ML+sizeof(ML));
std::string inst2=inst.substr(4);
appendAddress(inst2,4,ml);
}
if(inst.substr(0,4)=="rsp,")
{
- const char ML[4]={0x48,0x83,0xc4,0x08};
+ const unsigned char ML[4]={0x48,0x83,0xc4,0x08};
ml.insert(ml.end(),ML,ML+sizeof(ML)); // to improve 8 statically put (last of element of ML) !!!!
return;
}
void INTERP_KERNEL::AsmX86::convertRet(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML[1]={0xc3};
+ const unsigned char ML[1]={0xc3};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
void INTERP_KERNEL::AsmX86::convertLeave(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
- const char ML[1]={0xc9};
+ const unsigned char ML[1]={0xc9};
ml.insert(ml.end(),ML,ML+sizeof(ML));
}
void INTERP_KERNEL::AsmX86::convertMovsd(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
const char ASM1[]="[rsp],xmm0";
- const char ML1[5]={0xf2,0x0f,0x11,0x04,0x24};
+ const unsigned char ML1[5]={0xf2,0x0f,0x11,0x04,0x24};
if(inst==ASM1)
{
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
return ;
}
const char ASM2[]="xmm0,[rsp]";
- const char ML2[5]={0xf2,0x0f,0x10,0x04,0x24};
+ const unsigned char ML2[5]={0xf2,0x0f,0x10,0x04,0x24};
if(inst==ASM2)
{
ml.insert(ml.end(),ML2,ML2+sizeof(ML2));
void INTERP_KERNEL::AsmX86::convertFst(const std::string& inst, std::vector<char>& ml) throw(INTERP_KERNEL::Exception)
{
const char ASM1[]="qword [rsp]";
- const char ML1[3]={0xdd,0x14,0x24};
+ const unsigned char ML1[3]={0xdd,0x14,0x24};
if(inst==ASM1)
{
ml.insert(ml.end(),ML1,ML1+sizeof(ML1));
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELASMX86_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelExprParser.hxx"
#include <cctype>
#include <sstream>
+#include <limits>
#include <vector>
#include <iterator>
#include <iostream>
val->setDouble(_value);
}
+void LeafExprVal::replaceValues(const std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception)
+{
+ int pos=(int)_value;
+ int lgth=valuesInExpr.size();
+ if(pos>=lgth || pos<0)
+ throw INTERP_KERNEL::Exception("LeafExprVal::replaceValues : Big Problem detected ! Send expression to Salome support with expression !");
+ _value=valuesInExpr[pos];
+}
+
LeafExprVar::LeafExprVar(const std::string& var):_fast_pos(-1),_var_name(var)
{
}
return true;
}
+/*!
+ * Nothing to do it is not a bug.
+ */
+void LeafExprVar::replaceValues(const std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception)
+{
+}
+
LeafExprVar::~LeafExprVar()
{
}
ExprParser::ExprParser(const char *expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false),_expr(expr)
{
+ _expr=deleteWhiteSpaces(_expr);
}
//! For \b NOT null terminated strings coming from FORTRAN.
ExprParser::ExprParser(const char *expr, int lgth, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false)
{
_expr=buildStringFromFortran(expr,lgth);
+ _expr=deleteWhiteSpaces(_expr);
}
ExprParser::~ExprParser()
releaseFunctions();
}
-std::size_t ExprParser::findCorrespondingOpenBracket(const std::string& expr, std::size_t posOfCloseBracket)
+std::size_t ExprParser::FindCorrespondingOpenBracket(const std::string& expr, std::size_t posOfCloseBracket)
{
int level=0;
- for(std::size_t iter=posOfCloseBracket-1;iter>=0;iter--)
- if(expr[iter]==')')
- level++;
- else if(expr[iter]=='(')
- {
- if(level==0)
- return iter;
- else
- level--;
- }
+ for(std::size_t iter=0;iter<posOfCloseBracket;iter++)
+ {
+ std::size_t iter2=posOfCloseBracket-1-iter;
+ if(expr[iter2]==')')
+ level++;
+ else if(expr[iter2]=='(')
+ {
+ if(level==0)
+ return iter2;
+ else
+ level--;
+ }
+ }
return std::string::npos;
}
releaseFunctions();
if(!_expr.empty())
{
+ std::string tmp(_expr);
+ std::vector<double> valuesInExpr;
+ fillValuesInExpr(valuesInExpr);
checkBracketsParity();
if(!simplify())
parseDeeper();
+ replaceValues(valuesInExpr);
+ _expr=tmp;
}
_is_parsing_ok=true;
}
return ;
//at this level of code _expr
std::size_t pos1=_expr.find_first_of('(');
- std::size_t pos4=findCorrespondingOpenBracket(_expr,_expr.length()-1);
+ std::size_t pos4=FindCorrespondingOpenBracket(_expr,_expr.length()-1);
if(pos4!=pos1)
return ;
std::string funcName=_expr.substr(0,pos1);
- std::size_t pos2=funcName.find_first_of("+-*/^",0,5);
- std::size_t pos3=funcName.find_first_not_of("+-*/^",0,5);
+ std::size_t pos2=funcName.find_first_of("+-*/^><",0,7);
+ std::size_t pos3=funcName.find_first_not_of("+-*/^><",0,7);
if(pos2!=std::string::npos && pos3!=std::string::npos)
return ;//Bracket group is not alone, can't conclude not recursively.
std::string newExp2=_expr.substr(pos1+1,_expr.length()-pos1-2);
std::size_t pos6=0;
for(int i=0;i<nbOfParamsInFunc;i++)
{
- std::size_t pos5=newExp2.find_first_of(',');
+ std::size_t pos5=newExp2.find_first_of(',',pos6);
std::size_t len=std::string::npos;
if(pos5!=std::string::npos)
len=pos5-pos6;
{
std::size_t pos=_expr.find_first_not_of("+-",0,2);
std::string minimizedExpr=_expr.substr(pos);
- std::size_t pos2=minimizedExpr.find_first_of("+-*/^()",0,7);
+ std::size_t pos2=minimizedExpr.find_first_of("+-*/^()<>",0,9);
if(pos2!=std::string::npos)
return false;
delete _leaf;
return true;
}
+void ExprParser::parseForCmp() throw(INTERP_KERNEL::Exception)
+{
+ std::string::const_iterator iter;
+ int curLevel=0;
+ std::string curPart;
+ bool isParsingSucceed=false;
+ for(iter=_expr.begin();iter!=_expr.end();iter++)
+ {
+ switch(*iter)
+ {
+ case '>':
+ case '<':
+ {
+ isParsingSucceed=true;
+ if(!curPart.empty())
+ {
+ _sub_expr.push_back(ExprParser(curPart.c_str(),this));
+ curPart.clear();
+ _func_btw_sub_expr.push_back(FunctionsFactory::buildBinaryFuncFromString(*iter));
+ }
+ else
+ {
+ std::ostringstream errMsg;
+ char MSGTYP1[]="Error non unary function for '";
+ errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1 << *iter << "'";
+ std::string tmp=_expr.substr(iter-_expr.begin());
+ LocateError(errMsg,tmp,0);
+ throw INTERP_KERNEL::Exception(errMsg.str().c_str());
+ }
+ break;
+ }
+ case '(':
+ curLevel++;
+ curPart+=*iter;
+ break;
+ case ')':
+ curLevel--;
+ curPart+=*iter;
+ break;
+ default:
+ curPart+=*iter;
+ }
+ }
+ if(isParsingSucceed)
+ {
+ if(!curPart.empty())
+ {
+ _sub_expr.push_back(ExprParser(curPart.c_str(),this));
+ _is_parsing_ok=true;
+ }
+ else
+ {
+ std::ostringstream errMsg;
+ char MSGTYP4[]="Error following expression finished by > / < without right part.";
+ errMsg << EXPR_PARSE_ERR_MSG << MSGTYP4 << _expr;
+ throw INTERP_KERNEL::Exception(errMsg.str().c_str());
+ }
+ }
+}
+
void ExprParser::parseForAddMin() throw(INTERP_KERNEL::Exception)
{
std::string::const_iterator iter;
char MSGTYP1[]="Error non unary function for '";
errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1 << *iter << "'";
std::string tmp=_expr.substr(iter-_expr.begin());
- locateError(errMsg,tmp,0);
+ LocateError(errMsg,tmp,0);
throw INTERP_KERNEL::Exception(errMsg.str().c_str());
}
}
char MSGTYP1[]="Error non unary function for '";
errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1 << *iter << "'";
std::string tmp=_expr.substr(iter-_expr.begin());
- locateError(errMsg,tmp,0);curPart+=*iter;
+ LocateError(errMsg,tmp,0);curPart+=*iter;
throw INTERP_KERNEL::Exception(errMsg.str().c_str());
}
break;
parseUnaryFunc();
if(!_is_parsing_ok)
{
- parseForAddMin();
+ parseForCmp();
if(!_is_parsing_ok)
{
- parseForMulDiv();
+ parseForAddMin();
if(!_is_parsing_ok)
- parseForPow();
+ {
+ parseForMulDiv();
+ if(!_is_parsing_ok)
+ parseForPow();
+ }
}
}
if(!_is_parsing_ok)
std::ostringstream errMsg;
char MSGTYP3[]="Error in interpreting : ";
errMsg << EXPR_PARSE_ERR_MSG << MSGTYP3 << _expr;
- locateError(errMsg,_expr,0);
+ LocateError(errMsg,_expr,0);
throw INTERP_KERNEL::Exception(errMsg.str().c_str());
}
return false;
std::ostringstream errMsg;
char MSGTYP1[]="Error in brackets : closing brackets ')' before openning '('";
errMsg << EXPR_PARSE_ERR_MSG << MSGTYP1;
- locateError(errMsg,_expr,iter-_expr.begin());
+ LocateError(errMsg,_expr,iter-_expr.begin());
throw INTERP_KERNEL::Exception(errMsg.str().c_str());
}
curLevel--;
}
}
-void ExprParser::locateError(std::ostream& stringToDisp, const std::string& srcOfErr, int posOfErr)
+/*!
+ * This method substitutes part in [bg,end) in expr by the content of (str(id)) and returns the double value representation in expr[bg,end).
+ * If double representation is invalid an exception is thrown.
+ * This method returns a delta that is the delta to operate to pos in expr after substitution.
+ */
+double ExprParser::ReplaceAndTraduce(std::string& expr, int id, std::size_t bg, std::size_t end, int& delta) throw(INTERP_KERNEL::Exception)
+{
+ static const char MSG[]="Interal error : A string expected to be a float is not one ! Bug to signal !";
+ std::istringstream stream;
+ std::ostringstream oss;
+ std::size_t end2=end!=std::string::npos?end-bg:end;
+ std::string tmp=expr.substr(bg,end2);
+ stream.str(tmp);
+ double ret=std::numeric_limits<double>::max();
+ stream >> ret;
+ if(stream.fail())
+ throw INTERP_KERNEL::Exception(MSG);
+ if(!stream.eof())
+ throw INTERP_KERNEL::Exception(MSG);
+ oss << id;
+ std::string tmp2(oss.str());
+ std::size_t l1=tmp.length();
+ delta=(int)tmp2.length()-(int)l1;
+ expr.replace(bg,l1,tmp2);
+ return ret;
+}
+
+/*!
+ * This method makes the assumption that _expr has no white space.
+ * This method scans _expr finding in greedy mode the following pattern :
+ * {0..9}+{.}?{0..9}*{{eE}{-}?{0..9}+}?
+ */
+void ExprParser::fillValuesInExpr(std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception)
+{
+ const char FIGURES[]="0123456789";
+ const std::string other("+-*^/(<>,");
+ std::size_t lgth=_expr.length();
+ int id=0,delta;
+ for(std::size_t pos=0;pos!=std::string::npos;id++)
+ {
+ std::size_t pos2=_expr.find_first_of(FIGURES,pos,10);
+ if(pos2==std::string::npos)
+ break;
+ if(pos2>0)
+ {//treat case of "x*log10(x)" -> "10" should NOT be intercepted by this
+ if(other.find_first_of(_expr[pos2-1])==std::string::npos)
+ {
+ pos=_expr.find_first_not_of(FIGURES,pos2,10);
+ id--;
+ continue;
+ }
+ if(_expr[pos2-1]==')')
+ {
+ pos=_expr.find_first_not_of(FIGURES,pos2,10);
+ std::ostringstream oss; oss << "Problem on parsing : Number \"" << _expr.substr(pos2,pos!=std::string::npos?pos2-pos:std::string::npos);
+ oss << "\" is right after close parenthesis... ')'";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ std::size_t pos3=_expr.find_first_not_of(FIGURES,pos2,10);
+ if(pos3==std::string::npos)
+ {//"x+1223442320"
+ valuesInExpr.push_back(ReplaceAndTraduce(_expr,id,pos2,std::string::npos,delta));
+ break;
+ }
+ if(_expr[pos3]=='.')
+ pos3++;
+ if(pos3<lgth)
+ {
+ std::size_t pos4=_expr.find_first_not_of(FIGURES,pos3,10);
+ if(pos4==std::string::npos)
+ {//"x+1223334.223"
+ valuesInExpr.push_back(ReplaceAndTraduce(_expr,id,pos2,std::string::npos,delta));
+ break;
+ }
+ else
+ {
+ if(_expr[pos4]!='e' && _expr[pos4]!='E')
+ {//"x+1223334.223+x"
+ valuesInExpr.push_back(ReplaceAndTraduce(_expr,id,pos2,pos4,delta));
+ pos=pos4+delta;
+ continue;
+ }
+ else
+ {
+ if(++pos4<lgth)
+ {
+ if(_expr[pos4]=='+' || _expr[pos4]=='-')
+ pos4++;
+ if(pos4>=lgth)
+ {//"x+1223334.223e+" or "1223334.223E-"
+ std::ostringstream oss; oss << "Invalid expr : float number at the end of expr is invalid lacking number after exponential and sign ! -> \"" << _expr.substr(pos2) << "\"";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ std::size_t pos5=_expr.find_first_not_of(FIGURES,pos4,10);
+ if(pos4==pos5)
+ {//"x+1223334.223e+x" or "1223334.223E-y"
+ std::ostringstream oss; oss << "Invalid expr : float number in expr is invalid lacking number after exponential ! -> \"" << _expr.substr(pos2,pos4-pos2) << "\"";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ //OK, normal case
+ valuesInExpr.push_back(ReplaceAndTraduce(_expr,id,pos2,pos5,delta));
+ pos=pos5+delta;
+ continue;
+ }
+ else//"x+1223334.223e"
+ {
+ std::ostringstream oss; oss << "Invalid expr : float number at the end of expr is invalid lacking number after exponential ! " << _expr.substr(pos2);
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ }
+ }
+ else
+ {//"x+1223334."
+ valuesInExpr.push_back(ReplaceAndTraduce(_expr,id,pos2,std::string::npos,delta));
+ break;
+ }
+ }
+}
+
+void ExprParser::replaceValues(const std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception)
+{
+ if(_leaf)
+ _leaf->replaceValues(valuesInExpr);
+ else
+ {
+ for(std::list<ExprParser>::iterator iter=_sub_expr.begin();iter!=_sub_expr.end();iter++)
+ (*iter).replaceValues(valuesInExpr);
+ }
+}
+
+void ExprParser::LocateError(std::ostream& stringToDisp, const std::string& srcOfErr, int posOfErr)
{
stringToDisp << "Position is " << posOfErr << " of string : \"" << srcOfErr << "\"" << std::endl;
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELEXPRPARSER_HXX__
virtual void fillValue(Value *val) const throw(INTERP_KERNEL::Exception) = 0;
virtual void compileX86(std::vector<std::string>& ass) const = 0;
virtual void compileX86_64(std::vector<std::string>& ass) const = 0;
+ virtual void replaceValues(const std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception) = 0;
static LeafExpr *buildInstanceFrom(const std::string& expr) throw(INTERP_KERNEL::Exception);
};
void compileX86(std::vector<std::string>& ass) const;
void compileX86_64(std::vector<std::string>& ass) const;
void fillValue(Value *val) const throw(INTERP_KERNEL::Exception);
+ void replaceValues(const std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception);
private:
double _value;
};
std::string getVar() const { return _var_name; }
void prepareExprEvaluation(const std::vector<std::string>& vars) const throw(INTERP_KERNEL::Exception);
void prepareExprEvaluationVec() const throw(INTERP_KERNEL::Exception);
+ void replaceValues(const std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception);
static bool isRecognizedKeyVar(const std::string& var, int& pos);
public:
static const char END_OF_RECOGNIZED_VAR[];
void prepareExprEvaluationVecLowLev() const throw(INTERP_KERNEL::Exception);
bool tryToInterpALeaf() throw(INTERP_KERNEL::Exception);
void parseUnaryFunc() throw(INTERP_KERNEL::Exception);
+ void parseForCmp() throw(INTERP_KERNEL::Exception);
void parseForAddMin() throw(INTERP_KERNEL::Exception);
void parseForMulDiv() throw(INTERP_KERNEL::Exception);
void parseForPow() throw(INTERP_KERNEL::Exception);
bool simplify() throw(INTERP_KERNEL::Exception);
void releaseFunctions();
void checkBracketsParity() const throw(INTERP_KERNEL::Exception);
- static std::size_t findCorrespondingOpenBracket(const std::string& expr, std::size_t posOfCloseBracket);
- static void locateError(std::ostream& stringToDisp, const std::string& srcOfErr, int posOfErr);
+ void fillValuesInExpr(std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception);
+ void replaceValues(const std::vector<double>& valuesInExpr) throw(INTERP_KERNEL::Exception);
+ static double ReplaceAndTraduce(std::string& expr, int id, std::size_t bg, std::size_t end, int& delta) throw(INTERP_KERNEL::Exception);
+ static std::size_t FindCorrespondingOpenBracket(const std::string& expr, std::size_t posOfCloseBracket);
+ static void LocateError(std::ostream& stringToDisp, const std::string& srcOfErr, int posOfErr);
private:
ExprParser *_father;
bool _is_parsed;
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelFunction.hxx"
const char LnFunction::REPR[]="ln";
+const char LogFunction::REPR[]="log";
+
+const char Log10Function::REPR[]="log10";
+
const char MaxFunction::REPR[]="max";
const char MinFunction::REPR[]="min";
+const char GreaterThanFunction::REPR[]=">";
+
+const char LowerThanFunction::REPR[]="<";
+
+const char IfFunction::REPR[]="if";
+
Function *FunctionsFactory::buildFuncFromString(const char *type, int nbOfParams) throw(INTERP_KERNEL::Exception)
{
switch(nbOfParams)
return buildUnaryFuncFromString(type);
case 2:
return buildBinaryFuncFromString(type);
+ case 3:
+ return buildTernaryFuncFromString(type);
default:
throw INTERP_KERNEL::Exception("Invalid number of params detected : limited to 2 !");
}
return new ExpFunction;
if(tmp==LnFunction::REPR)
return new LnFunction;
+ if(tmp==LogFunction::REPR)
+ return new LogFunction;
+ if(tmp==Log10Function::REPR)
+ return new Log10Function;
//
std::string msg("Invalid unary function detected : \"");
msg+=type; msg+="\"";
return new MaxFunction;
if(tmp==MinFunction::REPR)
return new MinFunction;
+ if(tmp==GreaterThanFunction::REPR)
+ return new GreaterThanFunction;
+ if(tmp==LowerThanFunction::REPR)
+ return new LowerThanFunction;
std::string msg("Invalid binary function detected : \"");
msg+=type; msg+="\"";
throw INTERP_KERNEL::Exception(msg.c_str());
}
+Function *FunctionsFactory::buildTernaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception)
+{
+ std::string tmp(type);
+ if(tmp==IfFunction::REPR)
+ return new IfFunction();
+ std::string msg("Invalid ternary function detected : \"");
+ msg+=type; msg+="\"";
+ throw INTERP_KERNEL::Exception(msg.c_str());
+}
+
Function *FunctionsFactory::buildBinaryFuncFromString(char type) throw(INTERP_KERNEL::Exception)
{
char tmp[2]; tmp[0]=type; tmp[1]='\0';
return true;
}
+LogFunction::~LogFunction()
+{
+}
+
+void LogFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+{
+ Value *val=stack.back();
+ val->ln();
+}
+
+void LogFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !");
+}
+
+const char *LogFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool LogFunction::isACall() const
+{
+ return true;
+}
+
+Log10Function::~Log10Function()
+{
+}
+
+void Log10Function::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+{
+ Value *val=stack.back();
+ val->log10();
+}
+
+void Log10Function::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("Assembly for log Not implemented yet !");
+}
+
+const char *Log10Function::getRepr() const
+{
+ return REPR;
+}
+
+bool Log10Function::isACall() const
+{
+ return true;
+}
+
int BinaryFunction::getNbInputParams() const
{
return 2;
{
return false;
}
+
+GreaterThanFunction::~GreaterThanFunction()
+{
+}
+
+void GreaterThanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+{
+ Value *val1=stack.back();
+ stack.pop_back();
+ Value *& val2=stack.back();
+ Value *val3;
+ try
+ {
+ val3=val1->greaterThan(val2);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ delete val1;
+ throw e;
+ }
+ delete val1;
+ delete val2;
+ val2=val3;
+}
+
+void GreaterThanFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
+}
+
+const char *GreaterThanFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool GreaterThanFunction::isACall() const
+{
+ return false;
+}
+
+LowerThanFunction::~LowerThanFunction()
+{
+}
+
+void LowerThanFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+{
+ Value *val1=stack.back();
+ stack.pop_back();
+ Value *& val2=stack.back();
+ Value *val3;
+ try
+ {
+ val3=val1->lowerThan(val2);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ delete val1;
+ throw e;
+ }
+ delete val1;
+ delete val2;
+ val2=val3;
+}
+
+void LowerThanFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
+}
+
+const char *LowerThanFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool LowerThanFunction::isACall() const
+{
+ return false;
+}
+
+int TernaryFunction::getNbInputParams() const
+{
+ return 3;
+}
+
+IfFunction::~IfFunction()
+{
+}
+
+void IfFunction::operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception)
+{
+ Value *val1=stack.back();
+ stack.pop_back();
+ Value *val2=stack.back();
+ stack.pop_back();
+ Value *&val3=stack.back();
+ Value *val4;
+ try
+ {
+ val4=val1->ifFunc(val2,val3);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ delete val1;
+ delete val2;
+ throw e;
+ }
+ delete val1;
+ delete val2;
+ delete val3;
+ val3=val4;
+}
+
+void IfFunction::operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("Assembly Not implemented yet !");
+}
+
+const char *IfFunction::getRepr() const
+{
+ return REPR;
+}
+
+bool IfFunction::isACall() const
+{
+ return false;
+}
+
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELFUNCTION_HXX__
//static Function *buildUnaryFuncFromString(char type) throw(INTERP_KERNEL::Exception);
static Function *buildBinaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception);
static Function *buildBinaryFuncFromString(char type) throw(INTERP_KERNEL::Exception);
+ static Function *buildTernaryFuncFromString(const char *type) throw(INTERP_KERNEL::Exception);
};
class INTERPKERNELEXPREVAL_EXPORT Function
static const char REPR[];
};
+ class INTERPKERNELEXPREVAL_EXPORT LogFunction : public UnaryFunction
+ {
+ public:
+ ~LogFunction();
+ void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
+ void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+ const char *getRepr() const;
+ bool isACall() const;
+ public:
+ static const char REPR[];
+ };
+
+ class INTERPKERNELEXPREVAL_EXPORT Log10Function : public UnaryFunction
+ {
+ public:
+ ~Log10Function();
+ void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
+ void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+ const char *getRepr() const;
+ bool isACall() const;
+ public:
+ static const char REPR[];
+ };
+
class INTERPKERNELEXPREVAL_EXPORT BinaryFunction : public Function
{
public:
public:
static const char REPR[];
};
+
+ class INTERPKERNELEXPREVAL_EXPORT GreaterThanFunction : public BinaryFunction
+ {
+ public:
+ ~GreaterThanFunction();
+ void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
+ void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+ const char *getRepr() const;
+ bool isACall() const;
+ public:
+ static const char REPR[];
+ };
+
+ class INTERPKERNELEXPREVAL_EXPORT LowerThanFunction : public BinaryFunction
+ {
+ public:
+ ~LowerThanFunction();
+ void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
+ void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+ const char *getRepr() const;
+ bool isACall() const;
+ public:
+ static const char REPR[];
+ };
+
+ class INTERPKERNELEXPREVAL_EXPORT TernaryFunction : public Function
+ {
+ public:
+ int getNbInputParams() const;
+ };
+
+ class INTERPKERNELEXPREVAL_EXPORT IfFunction : public TernaryFunction
+ {
+ public:
+ ~IfFunction();
+ void operate(std::vector<Value *>& stack) const throw(INTERP_KERNEL::Exception);
+ void operateX86(std::vector<std::string>& asmb) const throw(INTERP_KERNEL::Exception);
+ const char *getRepr() const;
+ bool isACall() const;
+ public:
+ static const char REPR[];
+ };
}
#endif
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelUnit.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELUNIT_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelValue.hxx"
_data=std::exp(_data);
}
-void ValueDouble:: ln() throw(INTERP_KERNEL::Exception)
+void ValueDouble::ln() throw(INTERP_KERNEL::Exception)
{
_data=std::log(_data);
}
+void ValueDouble::log10() throw(INTERP_KERNEL::Exception)
+{
+ _data=std::log10(_data);
+}
+
Value *ValueDouble::plus(const Value *other) const throw(INTERP_KERNEL::Exception)
{
const ValueDouble *valC=checkSameType(other);
return new ValueDouble(std::min(_data,valC->_data));
}
+Value *ValueDouble::greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception)
+{
+ const ValueDouble *valC=checkSameType(other);
+ return new ValueDouble(_data>valC->_data?std::numeric_limits<double>::max():-std::numeric_limits<double>::max());
+}
+
+Value *ValueDouble::lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception)
+{
+ const ValueDouble *valC=checkSameType(other);
+ return new ValueDouble(_data<valC->_data?std::numeric_limits<double>::max():-std::numeric_limits<double>::max());
+}
+
+Value *ValueDouble::ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception)
+{
+ const ValueDouble *theC=checkSameType(the);
+ const ValueDouble *elsC=checkSameType(els);
+ if(_data==std::numeric_limits<double>::max())
+ return new ValueDouble(theC->_data);
+ if(_data==-std::numeric_limits<double>::max())
+ return new ValueDouble(elsC->_data);
+ throw INTERP_KERNEL::Exception("ValueDouble::ifFunc : The fist element of ternary function if is not a binary op !");
+}
+
const ValueDouble *ValueDouble::checkSameType(const Value *val) throw(INTERP_KERNEL::Exception)
{
const ValueDouble *valC=dynamic_cast<const ValueDouble *>(val);
unsupportedOp(LnFunction::REPR);
}
+void ValueUnit::log10() throw(INTERP_KERNEL::Exception)
+{
+ unsupportedOp(Log10Function::REPR);
+}
+
Value *ValueUnit::plus(const Value *other) const throw(INTERP_KERNEL::Exception)
{
unsupportedOp(PlusFunction::REPR);
return 0;
}
+Value *ValueUnit::greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception)
+{
+ unsupportedOp(GreaterThanFunction::REPR);
+ return 0;
+}
+
+Value *ValueUnit::lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception)
+{
+ unsupportedOp(LowerThanFunction::REPR);
+ return 0;
+}
+
+Value *ValueUnit::ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception)
+{
+ unsupportedOp(IfFunction::REPR);
+ return 0;
+}
+
Value *ValueUnit::mult(const Value *other) const throw(INTERP_KERNEL::Exception)
{
const ValueUnit *valC=checkSameType(other);
{
double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::less_equal<double>(),0.));
if(it!=_dest_data+_sz_dest_data)
- throw INTERP_KERNEL::Exception("Trying to apply sqrt on < 0. value !");
+ throw INTERP_KERNEL::Exception("Trying to apply neperian/natural log on <= 0. value !");
std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun<double,double>(std::log));
}
+void ValueDoubleExpr::log10() throw(INTERP_KERNEL::Exception)
+{
+ double *it=std::find_if(_dest_data,_dest_data+_sz_dest_data,std::bind2nd(std::less_equal<double>(),0.));
+ if(it!=_dest_data+_sz_dest_data)
+ throw INTERP_KERNEL::Exception("Trying to apply log10 on <= 0. value !");
+ std::transform(_dest_data,_dest_data+_sz_dest_data,_dest_data,std::ptr_fun<double,double>(std::log10));
+}
+
Value *ValueDoubleExpr::plus(const Value *other) const throw(INTERP_KERNEL::Exception)
{
const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
std::transform(_dest_data,_dest_data+_sz_dest_data,otherC->getData(),ret->getData(),std::ptr_fun<const double&, const double&, const double& >(std::min));
return ret;
}
+
+Value *ValueDoubleExpr::greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception)
+{
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ for(int i=0;i<_sz_dest_data;i++)
+ if(_dest_data[i]<=otherC->getData()[i])
+ {
+ std::fill(ret->getData(),ret->getData()+_sz_dest_data,-std::numeric_limits<double>::max());
+ return ret;
+ }
+ std::fill(ret->getData(),ret->getData()+_sz_dest_data,std::numeric_limits<double>::max());
+ return ret;
+}
+
+Value *ValueDoubleExpr::lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception)
+{
+ const ValueDoubleExpr *otherC=static_cast<const ValueDoubleExpr *>(other);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ for(int i=0;i<_sz_dest_data;i++)
+ if(_dest_data[i]>=otherC->getData()[i])
+ {
+ std::fill(ret->getData(),ret->getData()+_sz_dest_data,-std::numeric_limits<double>::max());
+ return ret;
+ }
+ std::fill(ret->getData(),ret->getData()+_sz_dest_data,std::numeric_limits<double>::max());
+ return ret;
+}
+
+Value *ValueDoubleExpr::ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception)
+{
+ const ValueDoubleExpr *theC=static_cast<const ValueDoubleExpr *>(the);
+ const ValueDoubleExpr *elsC=static_cast<const ValueDoubleExpr *>(els);
+ ValueDoubleExpr *ret=new ValueDoubleExpr(_sz_dest_data,_src_data);
+ bool okmax=true;
+ bool okmin=true;
+ for(int i=0;i<_sz_dest_data && (okmax || okmin);i++)
+ {
+ okmax=_dest_data[i]==std::numeric_limits<double>::max();
+ okmin=_dest_data[i]==-std::numeric_limits<double>::max();
+ }
+ if(okmax || okmin)
+ {
+ if(okmax)
+ std::copy(theC->getData(),theC->getData()+_sz_dest_data,ret->getData());
+ else
+ std::copy(elsC->getData(),elsC->getData()+_sz_dest_data,ret->getData());
+ return ret;
+ }
+ else
+ {
+ throw INTERP_KERNEL::Exception("ValueDoubleExpr::ifFunc : first parameter of ternary func is NOT a consequence of a boolean op !");
+ }
+}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELVALUE_HXX__
virtual void abs() throw(INTERP_KERNEL::Exception) = 0;
virtual void exp() throw(INTERP_KERNEL::Exception) = 0;
virtual void ln() throw(INTERP_KERNEL::Exception) = 0;
+ virtual void log10() throw(INTERP_KERNEL::Exception) = 0;
//binary
virtual Value *plus(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
virtual Value *minus(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
virtual Value *pow(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
virtual Value *max(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
virtual Value *min(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
+ virtual Value *greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
+ virtual Value *lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception) = 0;
+ //ternary
+ virtual Value *ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception) = 0;
};
class INTERPKERNELEXPREVAL_EXPORT ValueDouble : public Value
void abs() throw(INTERP_KERNEL::Exception);
void exp() throw(INTERP_KERNEL::Exception);
void ln() throw(INTERP_KERNEL::Exception);
+ void log10() throw(INTERP_KERNEL::Exception);
//
Value *plus(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *minus(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *pow(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *max(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *min(const Value *other) const throw(INTERP_KERNEL::Exception);
+ Value *greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception);
+ Value *lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception);
+ //
+ Value *ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception);
private:
ValueDouble(double val);
static const ValueDouble *checkSameType(const Value *val) throw(INTERP_KERNEL::Exception);
void abs() throw(INTERP_KERNEL::Exception);
void exp() throw(INTERP_KERNEL::Exception);
void ln() throw(INTERP_KERNEL::Exception);
+ void log10() throw(INTERP_KERNEL::Exception);
//
Value *plus(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *minus(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *pow(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *max(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *min(const Value *other) const throw(INTERP_KERNEL::Exception);
+ Value *greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception);
+ Value *lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception);
+ //
+ Value *ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception);
private:
ValueUnit(const DecompositionInUnitBase& unit);
static void unsupportedOp(const char *type) throw(INTERP_KERNEL::Exception);
void abs() throw(INTERP_KERNEL::Exception);
void exp() throw(INTERP_KERNEL::Exception);
void ln() throw(INTERP_KERNEL::Exception);
+ void log10() throw(INTERP_KERNEL::Exception);
//
Value *plus(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *minus(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *pow(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *max(const Value *other) const throw(INTERP_KERNEL::Exception);
Value *min(const Value *other) const throw(INTERP_KERNEL::Exception);
+ Value *greaterThan(const Value *other) const throw(INTERP_KERNEL::Exception);
+ Value *lowerThan(const Value *other) const throw(INTERP_KERNEL::Exception);
+ //
+ Value *ifFunc(const Value *the, const Value *els) const throw(INTERP_KERNEL::Exception);
private:
int _sz_dest_data;
double *_dest_data;
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.am
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+//Local includes
+#include "InterpKernelGaussCoords.hxx"
+#include "CellModel.hxx"
+
+//STL includes
+#include <math.h>
+#include <algorithm>
+#include <sstream>
+
+using namespace INTERP_KERNEL;
+
+//Define common part of the code in the MACRO
+//---------------------------------------------------------------
+#define LOCAL_COORD_MACRO_BEGIN \
+ _my_local_reference_coord.resize( _my_local_ref_dim*_my_local_nb_ref ); \
+ for( int refId = 0; refId < _my_local_nb_ref; refId++ ) \
+ { \
+ double* coords = &_my_local_reference_coord[ refId*_my_local_ref_dim ]; \
+ switch(refId) \
+ {
+
+//---------------------------------------------------------------
+#define LOCAL_COORD_MACRO_END \
+ } \
+}
+
+//---------------------------------------------------------------
+#define SHAPE_FUN_MACRO_BEGIN \
+ for( int gaussId = 0 ; gaussId < _my_nb_gauss ; gaussId++ ) \
+ { \
+ double* funValue = &_my_function_value[ gaussId * _my_nb_ref ]; \
+ const double* gc = &_my_gauss_coord[ gaussId * getGaussCoordDim() ];
+
+//---------------------------------------------------------------
+#define SHAPE_FUN_MACRO_END \
+ }
+
+#define CHECK_MACRO \
+ if( ! aSatify ) \
+ { \
+ std::ostringstream stream; \
+ stream << "Error in the gauss localization for the cell with type "; \
+ stream << cellModel.getRepr(); \
+ stream << " !!!"; \
+ throw INTERP_KERNEL::Exception(stream.str().c_str()); \
+ }
+
+
+//---------------------------------------------------------------
+static bool IsEqual(double theLeft, double theRight)
+{
+ static double EPS = 1.0E-3;
+ if(fabs(theLeft) + fabs(theRight) > EPS)
+ return fabs(theLeft-theRight)/(fabs(theLeft)+fabs(theRight)) < EPS;
+ return true;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+// GAUSS INFO CLASS //
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+/*!
+ * Constructor of the GaussInfo
+ */
+GaussInfo::GaussInfo( NormalizedCellType theGeometry,
+ const DataVector& theGaussCoord,
+ int theNbGauss,
+ const DataVector& theReferenceCoord,
+ int theNbRef ) :
+ _my_geometry(theGeometry),
+ _my_nb_gauss(theNbGauss),
+ _my_gauss_coord(theGaussCoord),
+ _my_nb_ref(theNbRef),
+ _my_reference_coord(theReferenceCoord)
+{
+
+ //Allocate shape function values
+ _my_function_value.resize( _my_nb_gauss * _my_nb_ref );
+}
+
+/*!
+ * Destructor
+ */
+GaussInfo::~GaussInfo()
+{
+}
+
+/*!
+ * Return dimension of the gauss coordinates
+ */
+int GaussInfo::getGaussCoordDim() const
+{
+ if( _my_nb_gauss )
+ {
+ return _my_gauss_coord.size()/_my_nb_gauss;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+/*!
+ * Return dimension of the reference coordinates
+ */
+int GaussInfo::getReferenceCoordDim() const
+{
+ if( _my_nb_ref )
+ {
+ return _my_reference_coord.size()/_my_nb_ref;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+/*!
+ * Return type of the cell.
+ */
+NormalizedCellType GaussInfo::getCellType() const
+{
+ return _my_geometry;
+}
+
+/*!
+ * Return Nb of the gauss points.
+ */
+int GaussInfo::getNbGauss() const
+{
+ return _my_nb_gauss;
+}
+
+/*!
+ * Return Nb of the reference coordinates.
+ */
+int GaussInfo::getNbRef() const
+{
+ return _my_nb_ref;
+}
+
+/*!
+ * Check coordinates
+ */
+bool GaussInfo::isSatisfy()
+{
+
+ bool anIsSatisfy = ((_my_local_nb_ref == _my_nb_ref) && (_my_local_ref_dim == getReferenceCoordDim()));
+ //Check coordinates
+ if(anIsSatisfy)
+ {
+ for( int refId = 0; refId < _my_local_nb_ref; refId++ )
+ {
+ double* refCoord = &_my_reference_coord[ refId*_my_local_ref_dim ];
+ double* localRefCoord = &_my_local_reference_coord[ refId*_my_local_ref_dim ];
+ bool anIsEqual = false;
+ for( int dimId = 0; dimId < _my_local_ref_dim; dimId++ )
+ {
+ anIsEqual = IsEqual( localRefCoord[dimId], refCoord[dimId]);
+ if(!anIsEqual )
+ {
+ return false;
+ }
+ }
+ }
+ }
+ return anIsSatisfy;
+}
+
+/*!
+ * Initialize the internal vectors
+ */
+void GaussInfo::initLocalInfo() throw (INTERP_KERNEL::Exception)
+{
+ bool aSatify = false;
+ const CellModel& cellModel=CellModel::GetCellModel(_my_geometry);
+ switch( _my_geometry )
+ {
+ case NORM_SEG2:
+ _my_local_ref_dim = 1;
+ _my_local_nb_ref = 2;
+ seg2Init();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ break;
+
+ case NORM_SEG3:
+ _my_local_ref_dim = 1;
+ _my_local_nb_ref = 3;
+ seg3Init();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ break;
+
+ case NORM_TRI3:
+ _my_local_ref_dim = 2;
+ _my_local_nb_ref = 3;
+ tria3aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ tria3bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_TRI6:
+ _my_local_ref_dim = 2;
+ _my_local_nb_ref = 6;
+ tria6aInit();
+ aSatify = isSatisfy();
+ if(!aSatify)
+ {
+ tria6bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_QUAD4:
+ _my_local_ref_dim = 2;
+ _my_local_nb_ref = 4;
+ quad4aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ quad4bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_QUAD8:
+ _my_local_ref_dim = 2;
+ _my_local_nb_ref = 8;
+ quad8aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ quad8bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_TETRA4:
+ _my_local_ref_dim = 3;
+ _my_local_nb_ref = 4;
+ tetra4aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ tetra4bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_TETRA10:
+ _my_local_ref_dim = 3;
+ _my_local_nb_ref = 10;
+ tetra10aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ tetra10bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_PYRA5:
+ _my_local_ref_dim = 3;
+ _my_local_nb_ref = 5;
+ pyra5aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ pyra5bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_PYRA13:
+ _my_local_ref_dim = 3;
+ _my_local_nb_ref = 13;
+ pyra13aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ pyra13bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_PENTA6:
+ _my_local_ref_dim = 3;
+ _my_local_nb_ref = 6;
+ penta6aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ penta6bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_PENTA15:
+ _my_local_ref_dim = 3;
+ _my_local_nb_ref = 15;
+ penta15aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ penta15bInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_HEXA8:
+ _my_local_ref_dim = 3;
+ _my_local_nb_ref = 8;
+ hexa8aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ hexa8aInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ case NORM_HEXA20:
+ _my_local_ref_dim = 3;
+ _my_local_nb_ref = 20;
+ hexa20aInit();
+ aSatify = isSatisfy();
+
+ if(!aSatify)
+ {
+ hexa20aInit();
+ aSatify = isSatisfy();
+ CHECK_MACRO;
+ }
+ break;
+
+ default:
+ throw INTERP_KERNEL::Exception("Not manged cell type !");
+ break;
+ }
+}
+
+/**
+ * Return shape function value by node id
+ */
+const double* GaussInfo::getFunctionValues( const int theGaussId ) const
+{
+ return &_my_function_value[ _my_nb_ref*theGaussId ];
+}
+
+/*!
+ * Init Segment 2 Reference coordinates ans Shape function.
+ */
+void GaussInfo::seg2Init()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ break;
+ case 1:
+ coords[0] = 1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*(1.0 - gc[0]);
+ funValue[1] = 0.5*(1.0 + gc[0]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Segment 3 Reference coordinates ans Shape function.
+ */
+void GaussInfo::seg3Init()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ break;
+ case 1:
+ coords[0] = 1.0;
+ break;
+ case 2:
+ coords[0] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*(1.0 - gc[0])*gc[0];
+ funValue[1] = 0.5*(1.0 + gc[0])*gc[0];
+ funValue[2] = (1.0 + gc[0])*(1.0 - gc[0]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Triangle Reference coordinates ans Shape function.
+ * Case A.
+ */
+void GaussInfo::tria3aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*(1.0 + gc[1]);
+ funValue[1] = -0.5*(gc[0] + gc[1]);
+ funValue[2] = 0.5*(1.0 + gc[0]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Triangle Reference coordinates ans Shape function.
+ * Case B.
+ */
+void GaussInfo::tria3bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ break;
+ case 1:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ break;
+ case 2:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 1.0 - gc[0] - gc[1];
+ funValue[1] = gc[0];
+ funValue[2] = gc[1];
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Quadratic Triangle Reference coordinates ans Shape function.
+ * Case A.
+ */
+void GaussInfo::tria6aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ break;
+ case 3:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ break;
+ case 4:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ break;
+ case 5:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*(1.0 + gc[1])*gc[1];
+ funValue[1] = 0.5*(gc[0] + gc[1])*(gc[0] + gc[1] + 1);
+ funValue[2] = 0.5*(1.0 + gc[0])*gc[0];
+ funValue[3] = -1.0*(1.0 + gc[1])*(gc[0] + gc[1]);
+ funValue[4] = -1.0*(1.0 + gc[0])*(gc[0] + gc[1]);
+ funValue[5] = (1.0 + gc[1])*(1.0 + gc[1]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Quadratic Triangle Reference coordinates ans Shape function.
+ * Case B.
+ */
+void GaussInfo::tria6bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ break;
+
+ case 1:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ break;
+
+ case 2:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ break;
+
+ case 3:
+ coords[0] = 0.5;
+ coords[1] = 0.0;
+ break;
+
+ case 4:
+ coords[0] = 0.5;
+ coords[1] = 0.5;
+ break;
+
+ case 5:
+ coords[0] = 0.0;
+ coords[1] = 0.5;
+ break;
+
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = (1.0 - gc[0] - gc[1])*(1.0 - 2.0*gc[0] - 2.0*gc[1]);
+ funValue[1] = gc[0]*(2.0*gc[0] - 1.0);
+ funValue[2] = gc[1]*(2.0*gc[1] - 1.0);
+ funValue[3] = 4.0*gc[0]*(1.0 - gc[0] - gc[1]);
+ funValue[4] = 4.0*gc[0]*gc[1];
+ funValue[5] = 4.0*gc[1]*(1.0 - gc[0] - gc[1]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Quadrangle Reference coordinates ans Shape function.
+ * Case A.
+ */
+void GaussInfo::quad4aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ break;
+
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.25*(1.0 + gc[1])*(1.0 - gc[0]);
+ funValue[1] = 0.25*(1.0 - gc[1])*(1.0 - gc[0]);
+ funValue[2] = 0.25*(1.0 - gc[1])*(1.0 + gc[0]);
+ funValue[3] = 0.25*(1.0 + gc[0])*(1.0 + gc[1]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Quadrangle Reference coordinates ans Shape function.
+ * Case B.
+ */
+void GaussInfo::quad4bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ break;
+ case 1:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ break;
+ case 3:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ break;
+
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.25*(1.0 - gc[0])*(1.0 - gc[1]);
+ funValue[1] = 0.25*(1.0 + gc[0])*(1.0 - gc[1]);
+ funValue[2] = 0.25*(1.0 + gc[0])*(1.0 + gc[1]);
+ funValue[3] = 0.25*(1.0 - gc[0])*(1.0 + gc[1]);
+ SHAPE_FUN_MACRO_END;
+}
+
+
+/*!
+ * Init Quadratic Quadrangle Reference coordinates ans Shape function.
+ * Case A.
+ */
+void GaussInfo::quad8aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ break;
+ case 4:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ break;
+ case 5:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ break;
+ case 6:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ break;
+ case 7:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.25*(1.0 + gc[1])*(1.0 - gc[0])*(gc[1] - gc[0] - 1.0);
+ funValue[1] = 0.25*(1.0 - gc[1])*(1.0 - gc[0])*(-gc[1] - gc[0] - 1.0);
+ funValue[2] = 0.25*(1.0 - gc[1])*(1.0 + gc[0])*(-gc[1] + gc[0] - 1.0);
+ funValue[3] = 0.25*(1.0 + gc[1])*(1.0 + gc[0])*(gc[1] + gc[0] - 1.0);
+ funValue[4] = 0.5*(1.0 - gc[0])*(1.0 - gc[1])*(1.0 + gc[1]);
+ funValue[5] = 0.5*(1.0 - gc[1])*(1.0 - gc[0])*(1.0 + gc[0]);
+ funValue[6] = 0.5*(1.0 + gc[0])*(1.0 - gc[1])*(1.0 + gc[1]);
+ funValue[7] = 0.5*(1.0 + gc[1])*(1.0 - gc[0])*(1.0 + gc[0]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Quadratic Quadrangle Reference coordinates ans Shape function.
+ * Case B.
+ */
+void GaussInfo::quad8bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ break;
+ case 1:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ break;
+ case 3:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ break;
+ case 4:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ break;
+ case 5:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ break;
+ case 6:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ break;
+ case 7:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.25*(1.0 - gc[0])*(1.0 - gc[1])*(-1.0 - gc[0] - gc[1]);
+ funValue[1] = 0.25*(1.0 + gc[0])*(1.0 - gc[1])*(-1.0 + gc[0] - gc[1]);
+ funValue[2] = 0.25*(1.0 + gc[0])*(1.0 + gc[1])*(-1.0 + gc[0] + gc[1]);
+ funValue[3] = 0.25*(1.0 - gc[0])*(1.0 + gc[1])*(-1.0 - gc[0] + gc[1]);
+ funValue[4] = 0.5*(1.0 - gc[0]*gc[0])*(1.0 - gc[1]);
+ funValue[5] = 0.5*(1.0 - gc[1]*gc[1])*(1.0 + gc[0]);
+ funValue[6] = 0.5*(1.0 - gc[0]*gc[0])*(1.0 + gc[1]);
+ funValue[7] = 0.5*(1.0 - gc[1]*gc[1])*(1.0 - gc[0]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Tetrahedron Reference coordinates ans Shape function.
+ * Case A.
+ */
+void GaussInfo::tetra4aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 1:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 2:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = gc[1];
+ funValue[1] = gc[2];
+ funValue[2] = 1.0 - gc[0] - gc[1] - gc[2];
+ funValue[3] = gc[0];
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Tetrahedron Reference coordinates ans Shape function.
+ * Case B.
+ */
+void GaussInfo::tetra4bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 2:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 1:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = gc[1];
+ funValue[2] = gc[2];
+ funValue[1] = 1.0 - gc[0] - gc[1] - gc[2];
+ funValue[3] = gc[0];
+ SHAPE_FUN_MACRO_END;
+
+}
+
+/*!
+ * Init Quadratic Tetrahedron Reference coordinates ans Shape function.
+ * Case A.
+ */
+void GaussInfo::tetra10aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 1:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 2:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 4:
+ coords[0] = 0.0;
+ coords[1] = 0.5;
+ coords[2] = 0.5;
+ break;
+ case 5:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 6:
+ coords[0] = 0.0;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 7:
+ coords[0] = 0.5;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 8:
+ coords[0] = 0.5;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 9:
+ coords[0] = 0.5;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = gc[1]*(2.0*gc[1] - 1.0);
+ funValue[1] = gc[2]*(2.0*gc[2] - 1.0);
+ funValue[2] = (1.0 - gc[0] - gc[1] - gc[2])*(1.0 - 2.0*gc[0] - 2.0*gc[1] - 2.0*gc[2]);
+ funValue[3] = gc[0]*(2.0*gc[0] - 1.0);
+ funValue[4] = 4.0*gc[1]*gc[2];
+ funValue[5] = 4.0*gc[2]*(1.0 - gc[0] - gc[1] - gc[2]);
+ funValue[6] = 4.0*gc[1]*(1.0 - gc[0] - gc[1] - gc[2]);
+ funValue[7] = 4.0*gc[0]*gc[1];
+ funValue[8] = 4.0*gc[0]*gc[2];
+ funValue[9] = 4.0*gc[0]*(1.0 - gc[0] - gc[1] - gc[2]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Quadratic Tetrahedron Reference coordinates ans Shape function.
+ * Case B.
+ */
+void GaussInfo::tetra10bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 2:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 1:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 6:
+ coords[0] = 0.0;
+ coords[1] = 0.5;
+ coords[2] = 0.5;
+ break;
+ case 5:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 4:
+ coords[0] = 0.0;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 7:
+ coords[0] = 0.5;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 9:
+ coords[0] = 0.5;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 8:
+ coords[0] = 0.5;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = gc[1]*(2.0*gc[1] - 1.0);
+ funValue[2] = gc[2]*(2.0*gc[2] - 1.0);
+ funValue[1] = (1.0 - gc[0] - gc[1] - gc[2])*(1.0 - 2.0*gc[0] - 2.0*gc[1] - 2.0*gc[2]);
+ funValue[3] = gc[0]*(2.0*gc[0] - 1.0);
+ funValue[6] = 4.0*gc[1]*gc[2];
+ funValue[5] = 4.0*gc[2]*(1.0 - gc[0] - gc[1] - gc[2]);
+ funValue[4] = 4.0*gc[1]*(1.0 - gc[0] - gc[1] - gc[2]);
+ funValue[7] = 4.0*gc[0]*gc[1];
+ funValue[9] = 4.0*gc[0]*gc[2];
+ funValue[8] = 4.0*gc[0]*(1.0 - gc[0] - gc[1] - gc[2]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Pyramid Reference coordinates ans Shape function.
+ * Case A.
+ */
+void GaussInfo::pyra5aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 1:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 2:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ coords[2] = 0.0;
+ break;
+ case 4:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.25*(-gc[0] + gc[1] - 1.0)*(-gc[0] - gc[1] - 1.0)*(1.0 - gc[2]);
+ funValue[1] = 0.25*(-gc[0] - gc[1] - 1.0)*(+gc[0] - gc[1] - 1.0)*(1.0 - gc[2]);
+ funValue[2] = 0.25*(+gc[0] + gc[1] - 1.0)*(+gc[0] - gc[1] - 1.0)*(1.0 - gc[2]);
+ funValue[3] = 0.25*(+gc[0] + gc[1] - 1.0)*(-gc[0] + gc[1] - 1.0)*(1.0 - gc[2]);
+ funValue[4] = gc[2];
+ SHAPE_FUN_MACRO_END;
+}
+/*!
+ * Init Pyramid Reference coordinates ans Shape function.
+ * Case B.
+ */
+void GaussInfo::pyra5bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 2:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 1:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ coords[2] = 0.0;
+ break;
+ case 4:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.25*(-gc[0] + gc[1] - 1.0)*(-gc[0] - gc[1] - 1.0)*(1.0 - gc[2]);
+ funValue[3] = 0.25*(-gc[0] - gc[1] - 1.0)*(+gc[0] - gc[1] - 1.0)*(1.0 - gc[2]);
+ funValue[2] = 0.25*(+gc[0] + gc[1] - 1.0)*(+gc[0] - gc[1] - 1.0)*(1.0 - gc[2]);
+ funValue[1] = 0.25*(+gc[0] + gc[1] - 1.0)*(-gc[0] + gc[1] - 1.0)*(1.0 - gc[2]);
+ funValue[4] = gc[2];
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Quadratic Pyramid Reference coordinates ans Shape function.
+ * Case A.
+ */
+void GaussInfo::pyra13aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 1:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 2:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ coords[2] = 0.0;
+ break;
+ case 4:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+
+ case 5:
+ coords[0] = 0.5;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 6:
+ coords[0] = -0.5;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 7:
+ coords[0] = -0.5;
+ coords[1] = -0.5;
+ coords[2] = 0.0;
+ break;
+ case 8:
+ coords[0] = 0.5;
+ coords[1] = -0.5;
+ coords[2] = 0.0;
+ break;
+ case 9:
+ coords[0] = 0.5;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 10:
+ coords[0] = 0.0;
+ coords[1] = 0.5;
+ coords[2] = 0.5;
+ break;
+ case 11:
+ coords[0] = -0.5;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 12:
+ coords[0] = 0.0;
+ coords[1] = -0.5;
+ coords[2] = 0.5;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*(-gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] - gc[1] + gc[2] - 1.0)*
+ (gc[0] - 0.5)/(1.0 - gc[2]);
+ funValue[1] = 0.5*(-gc[0] - gc[1] + gc[2] - 1.0)*(+gc[0] - gc[1] + gc[2] - 1.0)*
+ (gc[1] - 0.5)/(1.0 - gc[2]);
+ funValue[2] = 0.5*(+gc[0] - gc[1] + gc[2] - 1.0)*(+gc[0] + gc[1] + gc[2] - 1.0)*
+ (-gc[0] - 0.5)/(1.0 - gc[2]);
+ funValue[3] = 0.5*(+gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] + gc[1] + gc[2] - 1.0)*
+ (-gc[1] - 0.5)/(1.0 - gc[2]);
+
+ funValue[4] = 2.0*gc[2]*(gc[2] - 0.5);
+
+ funValue[5] = 0.5*(-gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] - gc[1] + gc[2] - 1.0)*
+ (gc[0] - gc[1] + gc[2] - 1.0)/(1.0 - gc[2]);
+ funValue[6] = 0.5*(-gc[0] - gc[1] + gc[2] - 1.0)*(gc[0] - gc[1] + gc[2] - 1.0)*
+ (gc[0] + gc[1] + gc[2] - 1.0)/(1.0 - gc[2]);
+ funValue[7] = 0.5*(gc[0] - gc[1] + gc[2] - 1.0)*(gc[0] + gc[1] + gc[2] - 1.0)*
+ (-gc[0] + gc[1] + gc[2] - 1.0)/(1.0 - gc[2]);
+ funValue[8] = 0.5*(gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] + gc[1] + gc[2] - 1.0)*
+ (-gc[0] - gc[1] + gc[2] - 1.0)/(1.0 - gc[2]);
+
+ funValue[9] = 0.5*gc[2]*(-gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] - gc[1] + gc[2] - 1.0)/
+ (1.0 - gc[2]);
+ funValue[10] = 0.5*gc[2]*(-gc[0] - gc[1] + gc[2] - 1.0)*(gc[0] - gc[1] + gc[2] - 1.0)/
+ (1.0 - gc[2]);
+ funValue[11] = 0.5*gc[2]*(gc[0] - gc[1] + gc[2] - 1.0)*(gc[0] + gc[1] + gc[2] - 1.0)/
+ (1.0 - gc[2]);
+ funValue[12] = 0.5*gc[2]*(gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] + gc[1] + gc[2] - 1.0)/
+ (1.0 - gc[2]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Quadratic Pyramid Reference coordinates ans Shape function.
+ * Case B.
+ */
+void GaussInfo::pyra13bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 2:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 1:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ coords[2] = 0.0;
+ break;
+ case 4:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 8:
+ coords[0] = 0.5;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 7:
+ coords[0] = -0.5;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 6:
+ coords[0] = -0.5;
+ coords[1] = -0.5;
+ coords[2] = 0.0;
+ break;
+ case 5:
+ coords[0] = 0.5;
+ coords[1] = -0.5;
+ coords[2] = 0.0;
+ break;
+ case 9:
+ coords[0] = 0.5;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 12:
+ coords[0] = 0.0;
+ coords[1] = 0.5;
+ coords[2] = 0.5;
+ break;
+ case 11:
+ coords[0] = -0.5;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 10:
+ coords[0] = 0.0;
+ coords[1] = -0.5;
+ coords[2] = 0.5;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*(-gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] - gc[1] + gc[2] - 1.0)*
+ (gc[0] - 0.5)/(1.0 - gc[2]);
+ funValue[3] = 0.5*(-gc[0] - gc[1] + gc[2] - 1.0)*(+gc[0] - gc[1] + gc[2] - 1.0)*
+ (gc[1] - 0.5)/(1.0 - gc[2]);
+ funValue[2] = 0.5*(+gc[0] - gc[1] + gc[2] - 1.0)*(+gc[0] + gc[1] + gc[2] - 1.0)*
+ (-gc[0] - 0.5)/(1.0 - gc[2]);
+ funValue[1] = 0.5*(+gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] + gc[1] + gc[2] - 1.0)*
+ (-gc[1] - 0.5)/(1.0 - gc[2]);
+
+ funValue[4] = 2.0*gc[2]*(gc[2] - 0.5);
+
+ funValue[8] = 0.5*(-gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] - gc[1] + gc[2] - 1.0)*
+ (gc[0] - gc[1] + gc[2] - 1.0)/(1.0 - gc[2]);
+ funValue[7] = 0.5*(-gc[0] - gc[1] + gc[2] - 1.0)*(gc[0] - gc[1] + gc[2] - 1.0)*
+ (gc[0] + gc[1] + gc[2] - 1.0)/(1.0 - gc[2]);
+ funValue[6] = 0.5*(gc[0] - gc[1] + gc[2] - 1.0)*(gc[0] + gc[1] + gc[2] - 1.0)*
+ (-gc[0] + gc[1] + gc[2] - 1.0)/(1.0 - gc[2]);
+ funValue[5] = 0.5*(gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] + gc[1] + gc[2] - 1.0)*
+ (-gc[0] - gc[1] + gc[2] - 1.0)/(1.0 - gc[2]);
+
+ funValue[9] = 0.5*gc[2]*(-gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] - gc[1] + gc[2] - 1.0)/
+ (1.0 - gc[2]);
+ funValue[12] = 0.5*gc[2]*(-gc[0] - gc[1] + gc[2] - 1.0)*(gc[0] - gc[1] + gc[2] - 1.0)/
+ (1.0 - gc[2]);
+ funValue[11] = 0.5*gc[2]*(gc[0] - gc[1] + gc[2] - 1.0)*(gc[0] + gc[1] + gc[2] - 1.0)/
+ (1.0 - gc[2]);
+ funValue[10] = 0.5*gc[2]*(gc[0] + gc[1] + gc[2] - 1.0)*(-gc[0] + gc[1] + gc[2] - 1.0)/
+ (1.0 - gc[2]);
+ SHAPE_FUN_MACRO_END;
+}
+
+
+/*!
+ * Init Pentahedron Reference coordinates and Shape function.
+ * Case A.
+ */
+void GaussInfo::penta6aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = -0.0;
+ coords[2] = 1.0;
+ break;
+ case 2:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 4:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 5:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*gc[1]*(1.0 - gc[0]);
+ funValue[1] = 0.5*gc[2]*(1.0 - gc[0]);
+ funValue[2] = 0.5*(1.0 - gc[1] - gc[2])*(1.0 - gc[0]);
+
+ funValue[3] = 0.5*gc[1]*(gc[0] + 1.0);
+ funValue[4] = 0.5*gc[2]*(gc[0] + 1.0);
+ funValue[5] = 0.5*(1.0 - gc[1] - gc[2])*(1.0 + gc[0]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Pentahedron Reference coordinates and Shape function.
+ * Case B.
+ */
+void GaussInfo::penta6bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 2:
+ coords[0] = -1.0;
+ coords[1] = -0.0;
+ coords[2] = 1.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 5:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 4:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*gc[1]*(1.0 - gc[0]);
+ funValue[2] = 0.5*gc[2]*(1.0 - gc[0]);
+ funValue[1] = 0.5*(1.0 - gc[1] - gc[2])*(1.0 - gc[0]);
+ funValue[3] = 0.5*gc[1]*(gc[0] + 1.0);
+ funValue[5] = 0.5*gc[2]*(gc[0] + 1.0);
+ funValue[4] = 0.5*(1.0 - gc[1] - gc[2])*(1.0 + gc[0]);
+ SHAPE_FUN_MACRO_END;
+}
+/*!
+ * Init Pentahedron Reference coordinates and Shape function.
+ * Case A.
+ */
+void GaussInfo::penta15aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = -0.0;
+ coords[2] = 1.0;
+ break;
+ case 2:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 4:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 5:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+
+ case 6:
+ coords[0] = -1.0;
+ coords[1] = 0.5;
+ coords[2] = 0.5;
+ break;
+ case 7:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 8:
+ coords[0] = -1.0;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 9:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 10:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 11:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 12:
+ coords[0] = 1.0;
+ coords[1] = 0.5;
+ coords[2] = 0.5;
+ break;
+ case 13:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 14:
+ coords[0] = 1.0;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*gc[1]*(1.0 - gc[0])*(2.0*gc[1] - 2.0 - gc[0]);
+ funValue[1] = 0.5*gc[2]*(1.0 - gc[0])*(2.0*gc[2] - 2.0 - gc[0]);
+ funValue[2] = 0.5*(gc[0] - 1.0)*(1.0 - gc[1] - gc[2])*(gc[0] + 2.0*gc[1] + 2.0*gc[2]);
+
+ funValue[3] = 0.5*gc[1]*(1.0 + gc[0])*(2.0*gc[1] - 2.0 + gc[0]);
+ funValue[4] = 0.5*gc[2]*(1.0 + gc[0])*(2.0*gc[2] - 2.0 + gc[0]);
+ funValue[5] = 0.5*(-gc[0] - 1.0)*(1.0 - gc[1] - gc[2])*(-gc[0] + 2.0*gc[1] + 2.0*gc[2]);
+
+ funValue[6] = 2.0*gc[1]*gc[2]*(1.0 - gc[0]);
+ funValue[7] = 2.0*gc[2]*(1.0 - gc[1] - gc[2])*(1.0 - gc[0]);
+ funValue[8] = 2.0*gc[1]*(1.0 - gc[1] - gc[2])*(1.0 - gc[0]);
+
+ funValue[9] = gc[1]*(1.0 - gc[0]*gc[0]);
+ funValue[10] = gc[2]*(1.0 - gc[0]*gc[0]);
+ funValue[11] = (1.0 - gc[1] - gc[2])*(1.0 - gc[0]*gc[0]);
+
+ funValue[12] = 2.0*gc[1]*gc[2]*(1.0 + gc[0]);
+ funValue[13] = 2.0*gc[2]*(1.0 - gc[1] - gc[2])*(1.0 + gc[0]);
+ funValue[14] = 2.0*gc[1]*(1.0 - gc[1] - gc[2])*(1.0 + gc[0]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Qaudratic Pentahedron Reference coordinates and Shape function.
+ * Case B.
+ */
+void GaussInfo::penta15bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 2:
+ coords[0] = -1.0;
+ coords[1] = -0.0;
+ coords[2] = 1.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 5:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 4:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+
+ case 8:
+ coords[0] = -1.0;
+ coords[1] = 0.5;
+ coords[2] = 0.5;
+ break;
+ case 7:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 6:
+ coords[0] = -1.0;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ case 12:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 14:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 13:
+ coords[0] = 0.0;
+ coords[1] = 0.0;
+ coords[2] = 0.0;
+ break;
+ case 11:
+ coords[0] = 1.0;
+ coords[1] = 0.5;
+ coords[2] = 0.5;
+ break;
+ case 10:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 0.5;
+ break;
+ case 9:
+ coords[0] = 1.0;
+ coords[1] = 0.5;
+ coords[2] = 0.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.5*gc[1]*(1.0 - gc[0])*(2.0*gc[1] - 2.0 - gc[0]);
+ funValue[2] = 0.5*gc[2]*(1.0 - gc[0])*(2.0*gc[2] - 2.0 - gc[0]);
+ funValue[1] = 0.5*(gc[0] - 1.0)*(1.0 - gc[1] - gc[2])*(gc[0] + 2.0*gc[1] + 2.0*gc[2]);
+
+ funValue[3] = 0.5*gc[1]*(1.0 + gc[0])*(2.0*gc[1] - 2.0 + gc[0]);
+ funValue[5] = 0.5*gc[2]*(1.0 + gc[0])*(2.0*gc[2] - 2.0 + gc[0]);
+ funValue[4] = 0.5*(-gc[0] - 1.0)*(1.0 - gc[1] - gc[2])*(-gc[0] + 2.0*gc[1] + 2.0*gc[2]);
+
+ funValue[8] = 2.0*gc[1]*gc[2]*(1.0 - gc[0]);
+ funValue[7] = 2.0*gc[2]*(1.0 - gc[1] - gc[2])*(1.0 - gc[0]);
+ funValue[6] = 2.0*gc[1]*(1.0 - gc[1] - gc[2])*(1.0 - gc[0]);
+
+ funValue[12] = gc[1]*(1.0 - gc[0]*gc[0]);
+ funValue[14] = gc[2]*(1.0 - gc[0]*gc[0]);
+ funValue[13] = (1.0 - gc[1] - gc[2])*(1.0 - gc[0]*gc[0]);
+
+ funValue[11] = 2.0*gc[1]*gc[2]*(1.0 + gc[0]);
+ funValue[10] = 2.0*gc[2]*(1.0 - gc[1] - gc[2])*(1.0 + gc[0]);
+ funValue[9] = 2.0*gc[1]*(1.0 - gc[1] - gc[2])*(1.0 + gc[0]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Hehahedron Reference coordinates and Shape function.
+ * Case A.
+ */
+void GaussInfo::hexa8aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 1:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 3:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 4:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 5:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 6:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+ case 7:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.125*(1.0 - gc[0])*(1.0 - gc[1])*(1.0 - gc[2]);
+ funValue[1] = 0.125*(1.0 + gc[0])*(1.0 - gc[1])*(1.0 - gc[2]);
+ funValue[2] = 0.125*(1.0 + gc[0])*(1.0 + gc[1])*(1.0 - gc[2]);
+ funValue[3] = 0.125*(1.0 - gc[0])*(1.0 + gc[1])*(1.0 - gc[2]);
+
+ funValue[4] = 0.125*(1.0 - gc[0])*(1.0 - gc[1])*(1.0 + gc[2]);
+ funValue[5] = 0.125*(1.0 + gc[0])*(1.0 - gc[1])*(1.0 + gc[2]);
+ funValue[6] = 0.125*(1.0 + gc[0])*(1.0 + gc[1])*(1.0 + gc[2]);
+ funValue[7] = 0.125*(1.0 - gc[0])*(1.0 + gc[1])*(1.0 + gc[2]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Hehahedron Reference coordinates and Shape function.
+ * Case B.
+ */
+void GaussInfo::hexa8bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 4:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 7:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 6:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+ case 5:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.125*(1.0 - gc[0])*(1.0 - gc[1])*(1.0 - gc[2]);
+ funValue[3] = 0.125*(1.0 + gc[0])*(1.0 - gc[1])*(1.0 - gc[2]);
+ funValue[2] = 0.125*(1.0 + gc[0])*(1.0 + gc[1])*(1.0 - gc[2]);
+ funValue[1] = 0.125*(1.0 - gc[0])*(1.0 + gc[1])*(1.0 - gc[2]);
+
+ funValue[4] = 0.125*(1.0 - gc[0])*(1.0 - gc[1])*(1.0 + gc[2]);
+ funValue[7] = 0.125*(1.0 + gc[0])*(1.0 - gc[1])*(1.0 + gc[2]);
+ funValue[6] = 0.125*(1.0 + gc[0])*(1.0 + gc[1])*(1.0 + gc[2]);
+ funValue[5] = 0.125*(1.0 - gc[0])*(1.0 + gc[1])*(1.0 + gc[2]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Qaudratic Hehahedron Reference coordinates and Shape function.
+ * Case A.
+ */
+void GaussInfo::hexa20aInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 1:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 3:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 4:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 5:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 6:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+ case 7:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+
+ case 8:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 9:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = -1.0;
+ break;
+ case 10:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 11:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = -1.0;
+ break;
+ case 12:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = 0.0;
+ break;
+ case 13:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = 0.0;
+ break;
+ case 14:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 15:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 16:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 17:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 18:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+ case 19:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+ funValue[0] = 0.125*(1.0 - gc[0])*(1.0 - gc[1])*(1.0 - gc[2])*
+ (-2.0 - gc[0] - gc[1] - gc[2]);
+ funValue[1] = 0.125*(1.0 + gc[0])*(1.0 - gc[1])*(1.0 - gc[2])*
+ (-2.0 + gc[0] - gc[1] - gc[2]);
+ funValue[2] = 0.125*(1.0 + gc[0])*(1.0 + gc[1])*(1.0 - gc[2])*
+ (-2.0 + gc[0] + gc[1] - gc[2]);
+ funValue[3] = 0.125*(1.0 - gc[0])*(1.0 + gc[1])*(1.0 - gc[2])*
+ (-2.0 - gc[0] + gc[1] - gc[2]);
+ funValue[4] = 0.125*(1.0 - gc[0])*(1.0 - gc[1])*(1.0 + gc[2])*
+ (-2.0 - gc[0] - gc[1] + gc[2]);
+ funValue[5] = 0.125*(1.0 + gc[0])*(1.0 - gc[1])*(1.0 + gc[2])*
+ (-2.0 + gc[0] - gc[1] + gc[2]);
+ funValue[6] = 0.125*(1.0 + gc[0])*(1.0 + gc[1])*(1.0 + gc[2])*
+ (-2.0 + gc[0] + gc[1] + gc[2]);
+ funValue[7] = 0.125*(1.0 - gc[0])*(1.0 + gc[1])*(1.0 + gc[2])*
+ (-2.0 - gc[0] + gc[1] + gc[2]);
+
+ funValue[8] = 0.25*(1.0 - gc[0]*gc[0])*(1.0 - gc[1])*(1.0 - gc[2]);
+ funValue[9] = 0.25*(1.0 - gc[1]*gc[1])*(1.0 + gc[0])*(1.0 - gc[2]);
+ funValue[10] = 0.25*(1.0 - gc[0]*gc[0])*(1.0 + gc[1])*(1.0 - gc[2]);
+ funValue[11] = 0.25*(1.0 - gc[1]*gc[1])*(1.0 - gc[0])*(1.0 - gc[2]);
+ funValue[12] = 0.25*(1.0 - gc[2]*gc[2])*(1.0 - gc[0])*(1.0 - gc[1]);
+ funValue[13] = 0.25*(1.0 - gc[2]*gc[2])*(1.0 + gc[0])*(1.0 - gc[1]);
+ funValue[14] = 0.25*(1.0 - gc[2]*gc[2])*(1.0 + gc[0])*(1.0 + gc[1]);
+ funValue[15] = 0.25*(1.0 - gc[2]*gc[2])*(1.0 - gc[0])*(1.0 + gc[1]);
+ funValue[16] = 0.25*(1.0 - gc[0]*gc[0])*(1.0 - gc[1])*(1.0 + gc[2]);
+ funValue[17] = 0.25*(1.0 - gc[1]*gc[1])*(1.0 + gc[0])*(1.0 + gc[2]);
+ funValue[18] = 0.25*(1.0 - gc[0]*gc[0])*(1.0 + gc[1])*(1.0 + gc[2]);
+ funValue[19] = 0.25*(1.0 - gc[1]*gc[1])*(1.0 - gc[0])*(1.0 + gc[2]);
+ SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * Init Qaudratic Hehahedron Reference coordinates and Shape function.
+ * Case B.
+ */
+void GaussInfo::hexa20bInit()
+{
+ LOCAL_COORD_MACRO_BEGIN;
+ case 0:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 3:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 2:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 1:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 4:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 7:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 6:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+ case 5:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+
+ case 11:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ coords[2] = -1.0;
+ break;
+ case 10:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = -1.0;
+ break;
+ case 9:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = -1.0;
+ break;
+ case 8:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = -1.0;
+ break;
+ case 16:
+ coords[0] = -1.0;
+ coords[1] = -1.0;
+ coords[2] = 0.0;
+ break;
+ case 19:
+ coords[0] = 1.0;
+ coords[1] = -1.0;
+ coords[2] = 0.0;
+ break;
+ case 18:
+ coords[0] = 1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 17:
+ coords[0] = -1.0;
+ coords[1] = 1.0;
+ coords[2] = 0.0;
+ break;
+ case 15:
+ coords[0] = 0.0;
+ coords[1] = -1.0;
+ coords[2] = 1.0;
+ break;
+ case 14:
+ coords[0] = 1.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ case 13:
+ coords[0] = 0.0;
+ coords[1] = 1.0;
+ coords[2] = 1.0;
+ break;
+ case 12:
+ coords[0] = -1.0;
+ coords[1] = 0.0;
+ coords[2] = 1.0;
+ break;
+ LOCAL_COORD_MACRO_END;
+
+ SHAPE_FUN_MACRO_BEGIN;
+
+ funValue[0] = 0.125*(1.0 - gc[0])*(1.0 - gc[1])*(1.0 - gc[2])*
+ (-2.0 - gc[0] - gc[1] - gc[2]);
+ funValue[3] = 0.125*(1.0 + gc[0])*(1.0 - gc[1])*(1.0 - gc[2])*
+ (-2.0 + gc[0] - gc[1] - gc[2]);
+ funValue[2] = 0.125*(1.0 + gc[0])*(1.0 + gc[1])*(1.0 - gc[2])*
+ (-2.0 + gc[0] + gc[1] - gc[2]);
+ funValue[1] = 0.125*(1.0 - gc[0])*(1.0 + gc[1])*(1.0 - gc[2])*
+ (-2.0 - gc[0] + gc[1] - gc[2]);
+ funValue[4] = 0.125*(1.0 - gc[0])*(1.0 - gc[1])*(1.0 + gc[2])*
+ (-2.0 - gc[0] - gc[1] + gc[2]);
+ funValue[7] = 0.125*(1.0 + gc[0])*(1.0 - gc[1])*(1.0 + gc[2])*
+ (-2.0 + gc[0] - gc[1] + gc[2]);
+ funValue[6] = 0.125*(1.0 + gc[0])*(1.0 + gc[1])*(1.0 + gc[2])*
+ (-2.0 + gc[0] + gc[1] + gc[2]);
+ funValue[5] = 0.125*(1.0 - gc[0])*(1.0 + gc[1])*(1.0 + gc[2])*
+ (-2.0 - gc[0] + gc[1] + gc[2]);
+
+ funValue[11] = 0.25*(1.0 - gc[0]*gc[0])*(1.0 - gc[1])*(1.0 - gc[2]);
+ funValue[10] = 0.25*(1.0 - gc[1]*gc[1])*(1.0 + gc[0])*(1.0 - gc[2]);
+ funValue[9] = 0.25*(1.0 - gc[0]*gc[0])*(1.0 + gc[1])*(1.0 - gc[2]);
+ funValue[8] = 0.25*(1.0 - gc[1]*gc[1])*(1.0 - gc[0])*(1.0 - gc[2]);
+ funValue[16] = 0.25*(1.0 - gc[2]*gc[2])*(1.0 - gc[0])*(1.0 - gc[1]);
+ funValue[19] = 0.25*(1.0 - gc[2]*gc[2])*(1.0 + gc[0])*(1.0 - gc[1]);
+ funValue[18] = 0.25*(1.0 - gc[2]*gc[2])*(1.0 + gc[0])*(1.0 + gc[1]);
+ funValue[17] = 0.25*(1.0 - gc[2]*gc[2])*(1.0 - gc[0])*(1.0 + gc[1]);
+ funValue[15] = 0.25*(1.0 - gc[0]*gc[0])*(1.0 - gc[1])*(1.0 + gc[2]);
+ funValue[14] = 0.25*(1.0 - gc[1]*gc[1])*(1.0 + gc[0])*(1.0 + gc[2]);
+ funValue[13] = 0.25*(1.0 - gc[0]*gc[0])*(1.0 + gc[1])*(1.0 + gc[2]);
+ funValue[12] = 0.25*(1.0 - gc[1]*gc[1])*(1.0 - gc[0])*(1.0 + gc[2]);
+ SHAPE_FUN_MACRO_END;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+// GAUSS COORD CLASS //
+////////////////////////////////////////////////////////////////////////////////////////////////
+/*!
+ * Constructor
+ */
+GaussCoords::GaussCoords()
+{
+}
+
+/*!
+ * Destructor
+ */
+GaussCoords::~GaussCoords()
+{
+ GaussInfoVector::iterator it = _my_gauss_info.begin();
+ for( ; it != _my_gauss_info.end(); it++ )
+ {
+ if((*it) != NULL)
+ delete (*it);
+ }
+}
+
+/*!
+ * Add Gauss localization info
+ */
+void GaussCoords::addGaussInfo( NormalizedCellType theGeometry,
+ int coordDim,
+ const double* theGaussCoord,
+ int theNbGauss,
+ const double* theReferenceCoord,
+ int theNbRef) throw (INTERP_KERNEL::Exception)
+{
+ GaussInfoVector::iterator it = _my_gauss_info.begin();
+ for( ; it != _my_gauss_info.end(); it++ )
+ {
+ if( (*it)->getCellType() == theGeometry )
+ {
+ break;
+ }
+ }
+
+ DataVector aGaussCoord;
+ for(int i = 0 ; i < theNbGauss*coordDim; i++ )
+ aGaussCoord.push_back(theGaussCoord[i]);
+
+ DataVector aReferenceCoord;
+ for(int i = 0 ; i < theNbRef*coordDim; i++ )
+ aReferenceCoord.push_back(theReferenceCoord[i]);
+
+
+ GaussInfo* info = new GaussInfo( theGeometry, aGaussCoord, theNbGauss, aReferenceCoord, theNbRef);
+ info->initLocalInfo();
+
+ //If info with cell type doesn't exist add it
+ if( it == _my_gauss_info.end() )
+ {
+ _my_gauss_info.push_back(info);
+
+ // If information exists, update it
+ }
+ else
+ {
+ int index = std::distance(_my_gauss_info.begin(),it);
+ delete (*it);
+ _my_gauss_info[index] = info;
+ }
+}
+
+
+/*!
+ * Calculate gauss points coordinates
+ */
+double* GaussCoords::calculateCoords( NormalizedCellType theGeometry,
+ const double *theNodeCoords,
+ const int theSpaceDim,
+ const int *theIndex) throw (INTERP_KERNEL::Exception)
+{
+ const GaussInfo *info = getInfoGivenCellType(theGeometry);
+ int nbCoords = theSpaceDim * info->getNbGauss();
+ double *aCoords = new double[nbCoords];
+ calculateCoordsAlg(info,theNodeCoords,theSpaceDim,theIndex,aCoords);
+ return aCoords;
+}
+
+
+void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, const int *theIndex, double *result) throw(INTERP_KERNEL::Exception)
+{
+ const GaussInfo *info = getInfoGivenCellType(theGeometry);
+ calculateCoordsAlg(info,theNodeCoords,theSpaceDim,theIndex,result);
+}
+
+void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex, double *result)
+{
+ int aConn = info->getNbRef();
+
+ int nbCoords = theSpaceDim * info->getNbGauss();
+ std::fill(result,result+nbCoords,0.);
+
+ for( int gaussId = 0; gaussId < info->getNbGauss(); gaussId++ )
+ {
+ double *coord=result+gaussId*theSpaceDim;
+ const double *function=info->getFunctionValues(gaussId);
+ for ( int connId = 0; connId < aConn ; connId++ )
+ {
+ const double* nodeCoord = theNodeCoords + (theIndex[connId]*theSpaceDim);
+ for( int dimId = 0; dimId < theSpaceDim; dimId++ )
+ coord[dimId] += nodeCoord[dimId]*function[connId];
+ }
+ }
+}
+
+const GaussInfo *GaussCoords::getInfoGivenCellType(NormalizedCellType cellType)
+{
+ GaussInfoVector::const_iterator it = _my_gauss_info.begin();
+ //Try to find gauss localization info
+ for( ; it != _my_gauss_info.end() ; it++ )
+ if( (*it)->getCellType()==cellType)
+ return (*it);
+ throw INTERP_KERNEL::Exception("Can't find gauss localization information !");
+}
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#ifndef __INTERPKERNELGAUSS_HXX__
+#define __INTERPKERNELGAUSS_HXX__
+
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelException.hxx"
+
+#include <vector>
+
+namespace INTERP_KERNEL
+{
+ typedef std::vector<double> DataVector;
+ typedef std::vector<int> IndexVector;
+
+ //Class to store Gauss Points information
+ class GaussInfo
+ {
+ public:
+ GaussInfo( NormalizedCellType theGeometry,
+ const DataVector& theGaussCoord,
+ int theNbGauss,
+ const DataVector& theReferenceCoord,
+ int theNbRef
+ );
+ ~GaussInfo();
+
+ NormalizedCellType getCellType() const;
+
+ int getGaussCoordDim() const;
+ int getReferenceCoordDim() const;
+
+ int getNbGauss() const;
+ int getNbRef() const;
+
+ const double* getFunctionValues( const int theGaussId ) const;
+
+ void initLocalInfo() throw (INTERP_KERNEL::Exception);
+
+ protected:
+
+ bool isSatisfy();
+
+ //1D
+ void seg2Init();
+ void seg3Init();
+
+ //2D
+ void tria3aInit();
+ void tria3bInit();
+ void tria6aInit();
+ void tria6bInit();
+
+ void quad4aInit();
+ void quad4bInit();
+ void quad8aInit();
+ void quad8bInit();
+
+ //3D
+ void tetra4aInit();
+ void tetra4bInit();
+ void tetra10aInit();
+ void tetra10bInit();
+
+ void pyra5aInit();
+ void pyra5bInit();
+ void pyra13aInit();
+ void pyra13bInit();
+
+ void penta6aInit();
+ void penta6bInit();
+ void penta15aInit();
+ void penta15bInit();
+
+ void hexa8aInit();
+ void hexa8bInit();
+ void hexa20aInit();
+ void hexa20bInit();
+
+
+ private:
+ //INFORMATION from MEDMEM
+ NormalizedCellType _my_geometry; //Cell type
+
+ int _my_nb_gauss; //Nb of the gauss points for element
+ DataVector _my_gauss_coord; //Gauss coordinates
+
+ int _my_nb_ref; //Nb of the nodes for element:
+ //NORM_SEG2 - 2
+ //NORM_SEG3 - 3
+ //NORM_TRI3 - 3
+ //.............
+
+ DataVector _my_reference_coord; //Reference coordinates
+
+ //LOCAL INFORMATION
+ DataVector _my_local_reference_coord; //Vector to store reference coordinates
+ int _my_local_ref_dim; //Dimension of the local reference coordinates:
+ // (x) - 1D case
+ // (x, y) - 2D case
+ // (x, y, z) - 3D case
+ int _my_local_nb_ref; //Nb of the local reference coordinates
+
+ DataVector _my_function_value; //Shape Function values
+ };
+
+
+ //Class for calculation of the coordinates of the gauss points
+ class GaussCoords
+ {
+ public:
+
+ GaussCoords();
+ ~GaussCoords();
+
+ void addGaussInfo( NormalizedCellType theGeometry,
+ int coordDim,
+ const double* theGaussCoord,
+ int theNbGauss,
+ const double* theReferenceCoord,
+ int theNbRef) throw (INTERP_KERNEL::Exception);
+
+ double* calculateCoords( NormalizedCellType theGeometry,
+ const double* theNodeCoords,
+ const int theSpaceDim,
+ const int* theIndex) throw(INTERP_KERNEL::Exception);
+
+ void calculateCoords( NormalizedCellType theGeometry,
+ const double* theNodeCoords,
+ const int theSpaceDim,
+ const int* theIndex,
+ double *result) throw(INTERP_KERNEL::Exception);
+ private:
+ const GaussInfo *getInfoGivenCellType(NormalizedCellType cellType);
+ void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex,
+ double *result);
+ private:
+ typedef std::vector<GaussInfo*> GaussInfoVector;
+ GaussInfoVector _my_gauss_info;
+ };
+}
+#endif //INTERPKERNELGAUSS
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __GENMATHFORMULAE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEOMETRIC2DDEFINES_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DAbstractEdge.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DABSTRACTEDGE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DBounds.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DBOUNDS_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DComposedEdge.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DCOMPOSEDNODE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DEdge.hxx"
MergePoints commonNode;
for(int i=0;i<nbOfV1;i++)
{
- std::vector<double>::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind2nd(std::greater_equal<double>(),distrib1[i]));
+ std::vector<double>::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind2nd(std::greater_equal<double>(),distrib1[i]));
if(iter!=distrib2.end())
{
for(int j=(iter-1)-distrib2.begin();j<nbOfV2;j++)
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DEDGE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DEDGE_TXX__
#define __INTERPKERNELGEO2DEDGE_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DEDGEARCCIRCLE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DEdgeInfLin.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DEDGEINFLIN_HXX__
bool isIn(double characterVal) const { return true; }
void dynCastFunction(const EdgeLin * &seg,
const EdgeArcCircle * &arcSeg) const { seg=this; }
- void dumpInXfigFile(std::ostream& stream) const { }
private:
~EdgeInfLin() { }
};
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DEdgeLin.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DEDGELIN_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DElementaryEdge.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DELEMENTARYEDGE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DNode.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DNODE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DPrecision.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DPRECISION_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelGeo2DQuadraticPolygon.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELGEO2DQUADRATICPOLYGON_HXX__
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.am
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __GEOMETRIC2DINTERSECTOR_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __GEOMETRIC2DINTERSECTOR_TXX__
#define __GEOMETRIC2DINTERSECTOR_TXX__
std::vector<Node *> nodes(nbNodes);
for(int i=0;i<nbNodes;i++)
nodes[i]=new Node(coords[i*SPACEDIM],coords[i*SPACEDIM+1]);
- if(!CellModel::getCellModel(type).isQuadratic())
+ if(!CellModel::GetCellModel(type).isQuadratic())
return QuadraticPolygon::buildLinearPolygon(nodes);
else
return QuadraticPolygon::buildArcCirclePolygon(nodes);
std::vector<Node *> nodes(nbOfPoints);
for(int i=0;i<nbOfPoints;i++)
nodes[i]=new Node(PlanarIntersector<MyMeshType,MyMatrix>::_coordsT+OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[i])*SPACEDIM);
- if(CellModel::getCellModel(type).isQuadratic())
+ if(CellModel::GetCellModel(type).isQuadratic())
return QuadraticPolygon::buildLinearPolygon(nodes);
else
return QuadraticPolygon::buildArcCirclePolygon(nodes);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELDEFINES_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTEGRALUNIFORMINTERSECTOR_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTEGRALUNIFORMINTERSECTOR_TXX__
#define __INTEGRALUNIFORMINTERSECTOR_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelCellSimplify.hxx"
INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth,
int *retConn, int& retLgth) throw(INTERP_KERNEL::Exception)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
std::set<int> c(conn,conn+lgth);
c.erase(-1);
bool isObviousNonDegeneratedCell=((int)c.size()==lgth);
int *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth,
int& retNbOfFaces, int& retLgth)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
unsigned nbOfFaces=cm.getNumberOfSons2(conn,lgth);
int *tmp=new int[nbOfFaces*(lgth+1)];
int *work=tmp;
{
case 806:
return tryToUnPolyHex8(conn,nbOfFaces,lgth,retConn,retLgth);
+ case 1208:
+ return tryToUnPolyHexp12(conn,nbOfFaces,lgth,retConn,retLgth);
case 605:
return tryToUnPolyPenta6(conn,nbOfFaces,lgth,retConn,retLgth);
case 505:
return INTERP_KERNEL::NORM_POLYHED;
}
+INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth)
+{
+ int nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
+ int nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4);
+ if(nbOfQuad==6 && nbOfHexagon==2)
+ {
+ const int *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
+ int hexg0Id=std::distance(conn+lgth,hexag0);
+ const int *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON);
+ int hexg1Id=std::distance(conn+lgth,hexag1);
+ const int *connHexag0=conn+5*hexg0Id;
+ int lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1));
+ if(lgthH0==6)
+ {
+ const int *connHexag1=conn+5*hexg0Id+7+(hexg1Id-hexg0Id-1)*5;
+ int lgthH1=std::distance(connHexag1,std::find(connHexag1,conn+lgth,-1));
+ if(lgthH1==6)
+ {
+ std::vector<int> tmp;
+ std::set<int> conn1(connHexag0,connHexag0+6);
+ std::set<int> conn2(connHexag1,connHexag1+6);
+ std::set_intersection(conn1.begin(),conn1.end(),conn2.begin(),conn2.end(),std::back_insert_iterator< std::vector<int> >(tmp));
+ if(tmp.empty())
+ {
+ int tmp2[6];
+ if(tryToArrangeOppositeFace(conn,lgth,6,connHexag0,connHexag1,8,tmp2))
+ {
+ std::copy(connHexag0,connHexag0+6,retConn);
+ std::copy(tmp2,tmp2+6,retConn+6);
+ retLgth=12;
+ return INTERP_KERNEL::NORM_HEXGP12;
+ }
+ }
+ }
+ }
+ }
+ retLgth=lgth;
+ std::copy(conn,conn+lgth,retConn);
+ return INTERP_KERNEL::NORM_POLYHED;
+}
+
/*!
* Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_PENTA6 is returned.
* If fails a POLYHED is returned.
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELCELLSIMPLIFY_HXX__
#define __INTERPKERNELCELLSIMPLIFY_HXX__
+#include "INTERPKERNELDefines.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpKernelException.hxx"
namespace INTERP_KERNEL
{
- class CellSimplify
+ class INTERPKERNEL_EXPORT CellSimplify
{
public:
static INTERP_KERNEL::NormalizedCellType simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth,
static INTERP_KERNEL::NormalizedCellType tryToUnPoly2D(const int *conn, int lgth, int *retConn, int& retLgth);
static INTERP_KERNEL::NormalizedCellType tryToUnPoly3D(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
static INTERP_KERNEL::NormalizedCellType tryToUnPolyHex8(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
+ static INTERP_KERNEL::NormalizedCellType tryToUnPolyHexp12(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
static INTERP_KERNEL::NormalizedCellType tryToUnPolyPenta6(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
static INTERP_KERNEL::NormalizedCellType tryToUnPolyPyra5(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
static INTERP_KERNEL::NormalizedCellType tryToUnPolyTetra4(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELMATRIX_HXX_
int _val;
};
- class Row : public std::vector< typename std::pair<int,T> >
+ class Row : public std::vector< std::pair<int,T> >
{
public:
- Row():std::vector< typename std::pair<int,T> >(){};
+ Row():std::vector< std::pair<int,T> >(){};
Row (const Row& row)
{
this->resize(row.size());
}
typename std::vector< std::pair<int,T> >::const_iterator find(int elem) const
{
- return std::find_if(std::vector< typename std::pair<int,T> >::begin(),std::vector< typename std::pair<int,T> >::end(),KeyComparator(elem));
+ return std::find_if(std::vector< std::pair<int,T> >::begin(),std::vector< std::pair<int,T> >::end(),KeyComparator(elem));
}
- void erase(int elem) { std::vector< typename std::pair<int,T> >::erase(std::find_if(std::vector< typename std::pair<int,T> >::begin(),std::vector< typename std::pair<int,T> >::end(),KeyComparator(elem))); }
+ void erase(int elem) { std::vector< std::pair<int,T> >::erase(std::find_if(std::vector< std::pair<int,T> >::begin(),std::vector< std::pair<int,T> >::end(),KeyComparator(elem))); }
- void insert(const std::pair<int,T>& myPair) { push_back(myPair); }
+ void insert(const std::pair<int,T>& myPair) { vector<std::pair<int,T> >::push_back(myPair); }
};
private:
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpKernelMeshQuality.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELMESHQUALITY_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPKERNELUTILITIES_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION_TXX__
#define __INTERPOLATION_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION1D_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION1D_TXX__
#define __INTERPOLATION1D_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION2D_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION2D_TXX__
#define __INTERPOLATION2D_TXX__
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "Interpolation2DCurve.hxx"
+#include "InterpolationCurve.txx"
+
+namespace INTERP_KERNEL
+{
+ Interpolation2DCurve::Interpolation2DCurve()
+ {
+ // to have non-zero default thickness of target element
+ InterpolationOptions::setBoundingBoxAdjustmentAbs( InterpolationOptions::getPrecision() );
+ }
+
+ Interpolation2DCurve::Interpolation2DCurve
+ (const InterpolationOptions& io):InterpolationCurve<Interpolation2DCurve>(io)
+ {
+ // to have non-zero default thickness of target element
+ InterpolationOptions::setBoundingBoxAdjustmentAbs( InterpolationOptions::getPrecision() );
+ }
+
+ /**
+ * \brief Function used to set the options for the intersection calculation
+ * \details The following options can be modified:
+ * -# Precision: Level of precision of the computations.
+ * - Values: positive real number.
+ * - Default: 1.0E-12.
+ * -# Tolerance: Thickness of target element.
+ * - Values: positive real number.
+ * - Default: 1.0E-12.
+ * -# Median line: Position of the median line where both segments will be projected.
+ * - Values: real number between 0.0 and 1.0.
+ * - Default: 0.5
+ */
+ void Interpolation2DCurve::setOptions (double precision,
+ double tolerance,
+ double medianLine)
+ {
+ InterpolationOptions::setPrecision(precision);
+ InterpolationOptions::setBoundingBoxAdjustmentAbs(tolerance);
+ InterpolationOptions::setMedianPlane(medianLine);
+ }
+}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION2DCURVE_HXX__
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "Interpolation3D.hxx"
+
+namespace INTERP_KERNEL
+{
+ /**
+ * \defgroup interpolation3D Interpolation3D
+ * \class Interpolation3D
+ * \brief Class used to calculate the volumes of intersection between the elements of two 3D meshes.
+ *
+ */
+ /**
+ * Default constructor
+ *
+ */
+ Interpolation3D::Interpolation3D()
+ {
+ }
+ Interpolation3D::Interpolation3D(const InterpolationOptions& io):Interpolation<Interpolation3D>(io)
+ {
+ }
+}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION3D_HXX__
#define __INTERPOLATION3D_HXX__
+#include "INTERPKERNELDefines.hxx"
#include "Interpolation.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpolationOptions.hxx"
namespace INTERP_KERNEL
{
- class Interpolation3D : public Interpolation<Interpolation3D>
+ class INTERPKERNEL_EXPORT Interpolation3D : public Interpolation<Interpolation3D>
{
public:
Interpolation3D();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION3D_TXX__
#define __INTERPOLATION3D_TXX__
namespace INTERP_KERNEL
{
- /**
- * \defgroup interpolation3D Interpolation3D
- * \class Interpolation3D
- * \brief Class used to calculate the volumes of intersection between the elements of two 3D meshes.
- *
- */
- /**
- * Default constructor
- *
- */
- Interpolation3D::Interpolation3D()
- {
- }
- Interpolation3D::Interpolation3D(const InterpolationOptions& io):Interpolation<Interpolation3D>(io)
- {
- }
-
/**
* Calculates the matrix of volumes of intersection between the elements of srcMesh and the elements of targetMesh.
* The calculation is done in two steps. First a filtering process reduces the number of pairs of elements for which the
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "Interpolation3DSurf.hxx"
+#include "InterpolationPlanar.txx"
+
+namespace INTERP_KERNEL
+{
+ Interpolation3DSurf::Interpolation3DSurf()
+ {
+ }
+
+ Interpolation3DSurf::Interpolation3DSurf(const InterpolationOptions& io):InterpolationPlanar<Interpolation3DSurf>(io)
+ {
+ }
+
+
+ /**
+ \brief Function used to set the options for the intersection calculation
+ \details The following options can be modified:
+ -# Intersection_type: the type of algorithm to be used in the computation of the cell-cell intersections.
+ - Values: Triangle, Convex.
+ - Default: Triangle.
+ -# MedianPlane: Position of the median plane where both cells will be projected
+ - Values: between 0 and 1.
+ - Default: 0.5.
+ -# DoRotate: rotate the coordinate system such that the target cell is in the Oxy plane.
+ - Values: true (necessarilly if Intersection_type=Triangle), false.
+ - Default: true (as default Intersection_type=Triangle)
+ -# Precision: Level of precision of the computations is precision times the characteristic size of the mesh.
+ - Values: positive real number.
+ - Default: 1.0E-12.
+ -# PrintLevel: Level of verboseness during the computations.
+ - Values: interger between 0 and 3.
+ - Default: 0.
+ */
+ void Interpolation3DSurf::setOptions(double precision, int printLevel, double medianPlane,
+ IntersectionType intersectionType, bool doRotate, int orientation)
+ {
+ InterpolationPlanar<Interpolation3DSurf>::setOptions(precision,printLevel,intersectionType, orientation);
+ InterpolationPlanar<Interpolation3DSurf>::setDoRotate(doRotate);
+ InterpolationPlanar<Interpolation3DSurf>::setMedianPlane(medianPlane);
+ }
+}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATION3DSURF_HXX__
#define __INTERPOLATION3DSURF_HXX__
-#include "InterpolationPlanar.hxx"
+#include "InterpolationPlanar.txx"
+#include "INTERPKERNELDefines.hxx"
#include "InterpolationOptions.hxx"
namespace INTERP_KERNEL
{
- class Interpolation3DSurf : public InterpolationPlanar<Interpolation3DSurf>
+ class INTERPKERNEL_EXPORT Interpolation3DSurf : public InterpolationPlanar<Interpolation3DSurf>
{
public:
Interpolation3DSurf();
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : InterpolationCC.hxx
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : InterpolationCC.txx
// Created : Fri Aug 14 11:39:27 2009
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : InterpolationCU.hxx
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : InterpolationCU.txx
// Created : Mon Dec 14 17:30:25 2009
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATIONCURVE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATIONCURVE_TXX__
#define __INTERPOLATIONCURVE_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpolationOptions.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATIONOPTIONS_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATIONPLANAR_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATIONPLANAR_TXX__
#define __INTERPOLATIONPLANAR_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERPOLATIONUTILS_HXX__
}
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
- /* fonction qui calcul le déterminant */
+ /* fonction qui calcul le determinant */
/* de deux vecteur(cf doc CGAL). */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
- //fonction qui calcul le déterminant des vecteurs: P3P1 et P3P2
+ //fonction qui calcul le determinant des vecteurs: P3P1 et P3P2
//(cf doc CGAL).
inline double mon_determinant(const double* P_1,
}
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
- /* calcul les coordonnées du barycentre d'un polygone */
- /* le vecteur en entrée est constitué des coordonnées */
+ /* calcul les coordonnees du barycentre d'un polygone */
+ /* le vecteur en entree est constitue des coordonnees */
/* des sommets du polygone */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
return Bary;
}
+
+ /*!
+ * Given 6 coeffs of a Tria6 returns the corresponding value of a given pos
+ */
+ inline double computeTria6RefBase(const double *coeffs, const double *pos)
+ {
+ return coeffs[0]+coeffs[1]*pos[0]+coeffs[2]*pos[1]+coeffs[3]*pos[0]*pos[0]+coeffs[4]*pos[0]*pos[1]+coeffs[5]*pos[1]*pos[1];
+ }
+
+ /*!
+ * Given xsi,eta in refCoo (length==2) return 6 coeffs in weightedPos.
+ */
+ inline void computeWeightedCoeffsInTria6FromRefBase(const double *refCoo, double *weightedPos)
+ {
+ weightedPos[0]=(1.-refCoo[0]-refCoo[1])*(1.-2*refCoo[0]-2.*refCoo[1]);
+ weightedPos[1]=refCoo[0]*(2.*refCoo[0]-1.);
+ weightedPos[2]=refCoo[1]*(2.*refCoo[1]-1.);
+ weightedPos[3]=4.*refCoo[0]*(1.-refCoo[0]-refCoo[1]);
+ weightedPos[4]=4.*refCoo[0]*refCoo[1];
+ weightedPos[5]=4.*refCoo[1]*(1.-refCoo[0]-refCoo[1]);
+ }
+
+ /*!
+ * Given 10 coeffs of a Tetra10 returns the corresponding value of a given pos
+ */
+ inline double computeTetra10RefBase(const double *coeffs, const double *pos)
+ {
+ return coeffs[0]+coeffs[1]*pos[0]+coeffs[2]*pos[1]+coeffs[3]*pos[2]+
+ coeffs[4]*pos[0]*pos[0]+coeffs[5]*pos[0]*pos[1]+coeffs[6]*pos[0]*pos[2]+
+ coeffs[7]*pos[1]*pos[1]+coeffs[8]*pos[1]*pos[2]+coeffs[9]*pos[2]*pos[2];
+ }
+
+ /*!
+ * Given xsi,eta,z in refCoo (length==3) return 10 coeffs in weightedPos.
+ */
+ inline void computeWeightedCoeffsInTetra10FromRefBase(const double *refCoo, double *weightedPos)
+ {
+ //http://www.cadfamily.com/download/CAE/ABAQUS/The%20Finite%20Element%20Method%20-%20A%20practical%20course%20abaqus.pdf page 217
+ //L1=1-refCoo[0]-refCoo[1]-refCoo[2]
+ //L2=refCoo[0] L3=refCoo[1] L4=refCoo[2]
+ weightedPos[0]=(-2.*(refCoo[0]+refCoo[1]+refCoo[2])+1)*(1-refCoo[0]-refCoo[1]-refCoo[2]);//(2*L1-1)*L1
+ weightedPos[1]=(2.*refCoo[0]-1.)*refCoo[0];//(2*L2-1)*L2
+ weightedPos[2]=(2.*refCoo[1]-1.)*refCoo[1];//(2*L3-1)*L3
+ weightedPos[3]=(2.*refCoo[2]-1.)*refCoo[2];//(2*L4-1)*L4
+ weightedPos[4]=4.*(1-refCoo[0]-refCoo[1]-refCoo[2])*refCoo[0];//4*L1*L2
+ weightedPos[5]=4.*refCoo[0]*refCoo[1];//4*L2*L3
+ weightedPos[6]=4.*(1-refCoo[0]-refCoo[1]-refCoo[2])*refCoo[1];//4*L1*L3
+ weightedPos[7]=4.*(1-refCoo[0]-refCoo[1]-refCoo[2])*refCoo[2];//4*L1*L4
+ weightedPos[8]=4.*refCoo[0]*refCoo[2];//4*L2*L4
+ weightedPos[9]=4.*refCoo[1]*refCoo[2];//4*L3*L4
+ }
/*!
* \brief Solve system equation in matrix form using Gaussian elimination algorithm
// make upper triangular matrix (forward elimination)
int iR[nbRow];// = { 0, 1, 2 };
- for ( int i = 0; i < (int) nbRow; ++i ) iR[i] = i;
-
+ for ( int i = 0; i < (int) nbRow; ++i )
+ iR[i] = i;
for ( int i = 0; i < (int)(nbRow-1); ++i ) // nullify nbRow-1 rows
{
// swap rows to have max value of i-th column in i-th row
double max = std::fabs( M[ iR[i] ][i] );
- for ( int r = i+1; r < (int)nbRow; ++r ) {
- double m = std::fabs( M[ iR[r] ][i] );
- if ( m > max ) {
- max = m;
- std::swap( iR[r], iR[i] );
+ for ( int r = i+1; r < (int)nbRow; ++r )
+ {
+ double m = std::fabs( M[ iR[r] ][i] );
+ if ( m > max )
+ {
+ max = m;
+ std::swap( iR[r], iR[i] );
+ }
+ }
+ if ( max < std::numeric_limits<double>::min() )
+ {
+ //sol[0]=1; sol[1]=sol[2]=sol[3]=0;
+ return false; // no solution
}
- }
- if ( max < std::numeric_limits<double>::min() ) {
- //sol[0]=1; sol[1]=sol[2]=sol[3]=0;
- return false; // no solution
- }
// make 0 below M[i][i] (actually we do not modify i-th column)
double* tUpRow = M[ iR[i] ];
- for ( int r = i+1; r < (int)nbRow; ++r ) {
- double* mRow = M[ iR[r] ];
- double coef = mRow[ i ] / tUpRow[ i ];
- for ( int c = i+1; c < nbCol; ++c )
- mRow[ c ] -= tUpRow[ c ] * coef;
- }
+ for ( int r = i+1; r < (int)nbRow; ++r )
+ {
+ double* mRow = M[ iR[r] ];
+ double coef = mRow[ i ] / tUpRow[ i ];
+ for ( int c = i+1; c < nbCol; ++c )
+ mRow[ c ] -= tUpRow[ c ] * coef;
+ }
}
double* mRow = M[ iR[nbRow-1] ];
- if ( std::fabs( mRow[ nbRow-1 ] ) < std::numeric_limits<double>::min() ) {
- //sol[0]=1; sol[1]=sol[2]=sol[3]=0;
- return false; // no solution
- }
+ if ( std::fabs( mRow[ nbRow-1 ] ) < std::numeric_limits<double>::min() )
+ {
+ //sol[0]=1; sol[1]=sol[2]=sol[3]=0;
+ return false; // no solution
+ }
mRow[ nbRow ] /= mRow[ nbRow-1 ];
// calculate solution (back substitution)
return true;
}
+
+ /*!
+ * \brief Solve system equation in matrix form using Gaussian elimination algorithm
+ * \param M - N x N+NB_OF_VARS matrix
+ * \param sol - vector of N solutions
+ * \retval bool - true if succeeded
+ */
+ template<unsigned SZ, unsigned NB_OF_RES>
+ bool solveSystemOfEquations2(const double *matrix, double *solutions, double eps)
+ {
+ unsigned k,j;
+ int nr,n,m,np;
+ double s,g;
+ int mb;
+ //
+ double B[SZ*(SZ+NB_OF_RES)];
+ std::copy(matrix,matrix+SZ*(SZ+NB_OF_RES),B);
+ //
+ nr=SZ+NB_OF_RES;
+ for(k=0;k<SZ;k++)
+ {
+ np=nr*k+k;
+ if(fabs(B[np])<eps)
+ {
+ n=k;
+ do
+ {
+ n++;
+ if(fabs(B[nr*k+n])>eps)
+ {/* Rows permutation */
+ for(m=0;m<nr;m++)
+ std::swap(B[nr*k+m],B[nr*n+m]);
+ }
+ }
+ while (n<(int)SZ);
+ }
+ s=B[np];//s is the Pivot
+ std::transform(B+k*nr,B+(k+1)*nr,B+k*nr,std::bind2nd(std::divides<double>(),s));
+ for(j=0;j<SZ;j++)
+ {
+ if(j!=k)
+ {
+ g=B[j*nr+k];
+ for(mb=k;mb<nr;mb++)
+ B[j*nr+mb]-=B[k*nr+mb]*g;
+ }
+ }
+ }
+ for(j=0;j<NB_OF_RES;j++)
+ for(k=0;k<SZ;k++)
+ solutions[j*SZ+k]=B[nr*k+SZ+j];
+ //
+ return true;
+ }
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
/* Calculate barycentric coordinates of a 2D point p */
bc[2] = 1. - bc[0] - bc[1];
}
- /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
- /* Calculate barycentric coordinates of a point p */
- /* with respect to triangle or tetra verices. */
- /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
-
- inline void barycentric_coords(const std::vector<const double*>& n, const double* p, double* bc)
+ /*!
+ * Calculate barycentric coordinates of a point p with respect to triangle or tetra verices.
+ * This method makes 2 assumptions :
+ * - this is a simplex
+ * - spacedim == meshdim. For TRI3 and TRI6 spaceDim is expected to be equal to 2 and for TETRA4 spaceDim is expected to be equal to 3.
+ * If not the case (3D surf for example) a previous projection should be done before.
+ */
+ inline void barycentric_coords(const std::vector<const double*>& n, const double *p, double *bc)
{
enum { _X, _Y, _Z };
- if ( n.size() == 3 ) // TRIA3
+ switch(n.size())
{
- // matrix 2x2
- double
- T11 = n[0][_X]-n[2][_X], T12 = n[1][_X]-n[2][_X],
- T21 = n[0][_Y]-n[2][_Y], T22 = n[1][_Y]-n[2][_Y];
- // matrix determinant
- double Tdet = T11*T22 - T12*T21;
- if ( std::fabs( Tdet ) < std::numeric_limits<double>::min() ) {
- bc[0]=1; bc[1]=bc[2]=0; // no solution
- return;
+ case 3:
+ { // TRIA3
+ // matrix 2x2
+ double
+ T11 = n[0][_X]-n[2][_X], T12 = n[1][_X]-n[2][_X],
+ T21 = n[0][_Y]-n[2][_Y], T22 = n[1][_Y]-n[2][_Y];
+ // matrix determinant
+ double Tdet = T11*T22 - T12*T21;
+ if ( std::fabs( Tdet ) < std::numeric_limits<double>::min() )
+ {
+ bc[0]=1; bc[1]=bc[2]=0; // no solution
+ return;
+ }
+ // matrix inverse
+ double t11 = T22, t12 = -T12, t21 = -T21, t22 = T11;
+ // vector
+ double r11 = p[_X]-n[2][_X], r12 = p[_Y]-n[2][_Y];
+ // barycentric coordinates: mutiply matrix by vector
+ bc[0] = (t11 * r11 + t12 * r12)/Tdet;
+ bc[1] = (t21 * r11 + t22 * r12)/Tdet;
+ bc[2] = 1. - bc[0] - bc[1];
+ break;
}
- // matrix inverse
- double t11 = T22, t12 = -T12, t21 = -T21, t22 = T11;
- // vector
- double r11 = p[_X]-n[2][_X], r12 = p[_Y]-n[2][_Y];
- // barycentric coordinates: mutiply matrix by vector
- bc[0] = (t11 * r11 + t12 * r12)/Tdet;
- bc[1] = (t21 * r11 + t22 * r12)/Tdet;
- bc[2] = 1. - bc[0] - bc[1];
- }
- else // TETRA4
- {
- // Find bc by solving system of 3 equations using Gaussian elimination algorithm
- // bc1*( x1 - x4 ) + bc2*( x2 - x4 ) + bc3*( x3 - x4 ) = px - x4
- // bc1*( y1 - y4 ) + bc2*( y2 - y4 ) + bc3*( y3 - y4 ) = px - y4
- // bc1*( z1 - z4 ) + bc2*( z2 - z4 ) + bc3*( z3 - z4 ) = px - z4
-
- double T[3][4]=
- {{ n[0][_X]-n[3][_X], n[1][_X]-n[3][_X], n[2][_X]-n[3][_X], p[_X]-n[3][_X] },
- { n[0][_Y]-n[3][_Y], n[1][_Y]-n[3][_Y], n[2][_Y]-n[3][_Y], p[_Y]-n[3][_Y] },
- { n[0][_Z]-n[3][_Z], n[1][_Z]-n[3][_Z], n[2][_Z]-n[3][_Z], p[_Z]-n[3][_Z] }};
-
- if ( !solveSystemOfEquations<3>( T, bc ))
- bc[0]=1., bc[1] = bc[2] = bc[3] = 0;
- else
- bc[ 3 ] = 1. - bc[0] - bc[1] - bc[2];
+ case 4:
+ { // TETRA4
+ // Find bc by solving system of 3 equations using Gaussian elimination algorithm
+ // bc1*( x1 - x4 ) + bc2*( x2 - x4 ) + bc3*( x3 - x4 ) = px - x4
+ // bc1*( y1 - y4 ) + bc2*( y2 - y4 ) + bc3*( y3 - y4 ) = px - y4
+ // bc1*( z1 - z4 ) + bc2*( z2 - z4 ) + bc3*( z3 - z4 ) = px - z4
+
+ double T[3][4]=
+ {{ n[0][_X]-n[3][_X], n[1][_X]-n[3][_X], n[2][_X]-n[3][_X], p[_X]-n[3][_X] },
+ { n[0][_Y]-n[3][_Y], n[1][_Y]-n[3][_Y], n[2][_Y]-n[3][_Y], p[_Y]-n[3][_Y] },
+ { n[0][_Z]-n[3][_Z], n[1][_Z]-n[3][_Z], n[2][_Z]-n[3][_Z], p[_Z]-n[3][_Z] }};
+
+ if ( !solveSystemOfEquations<3>( T, bc ) )
+ bc[0]=1., bc[1] = bc[2] = bc[3] = 0;
+ else
+ bc[ 3 ] = 1. - bc[0] - bc[1] - bc[2];
+ break;
+ }
+ case 6:
+ {
+ // TRIA6
+ double matrix2[48]={1., 0., 0., 0., 0., 0., 0., 0.,
+ 1., 0., 0., 0., 0., 0., 1., 0.,
+ 1., 0., 0., 0., 0., 0., 0., 1.,
+ 1., 0., 0., 0., 0., 0., 0.5, 0.,
+ 1., 0., 0., 0., 0., 0., 0.5, 0.5,
+ 1., 0., 0., 0., 0., 0., 0.,0.5};
+ for(int i=0;i<6;i++)
+ {
+ matrix2[8*i+1]=n[i][0];
+ matrix2[8*i+2]=n[i][1];
+ matrix2[8*i+3]=n[i][0]*n[i][0];
+ matrix2[8*i+4]=n[i][0]*n[i][1];
+ matrix2[8*i+5]=n[i][1]*n[i][1];
+ }
+ double res[12];
+ solveSystemOfEquations2<6,2>(matrix2,res,std::numeric_limits<double>::min());
+ double refCoo[2];
+ refCoo[0]=computeTria6RefBase(res,p);
+ refCoo[1]=computeTria6RefBase(res+6,p);
+ computeWeightedCoeffsInTria6FromRefBase(refCoo,bc);
+ break;
+ }
+ case 10:
+ {//TETRA10
+ double matrix2[130]={1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
+ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.,
+ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,
+ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.,
+ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.5, 0., 0.,
+ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.5, 0.5, 0.,
+ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,0.5, 0.,
+ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.5,
+ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.5, 0., 0.5,
+ 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.5, 0.5};
+ for(int i=0;i<10;i++)
+ {
+ matrix2[13*i+1]=n[i][0];
+ matrix2[13*i+2]=n[i][1];
+ matrix2[13*i+3]=n[i][2];
+ matrix2[13*i+4]=n[i][0]*n[i][0];
+ matrix2[13*i+5]=n[i][0]*n[i][1];
+ matrix2[13*i+6]=n[i][0]*n[i][2];
+ matrix2[13*i+7]=n[i][1]*n[i][1];
+ matrix2[13*i+8]=n[i][1]*n[i][2];
+ matrix2[13*i+9]=n[i][2]*n[i][2];
+ }
+ double res[30];
+ solveSystemOfEquations2<10,3>(matrix2,res,std::numeric_limits<double>::min());
+ double refCoo[3];
+ refCoo[0]=computeTetra10RefBase(res,p);
+ refCoo[1]=computeTetra10RefBase(res+10,p);
+ refCoo[2]=computeTetra10RefBase(res+20,p);
+ computeWeightedCoeffsInTetra10FromRefBase(refCoo,bc);
+ break;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("INTERP_KERNEL::barycentric_coords : unrecognized simplex !");
}
}
}
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
- /*fonction pour vérifier qu'un point n'a pas déja été considérer dans */
+ /*fonction pour verifier qu'un point n'a pas deja ete considerer dans */
/* le vecteur et le rajouter au vecteur sinon. */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
/* fonction qui rajoute les sommet du triangle P dans le vecteur V */
- /* si ceux-ci sont compris dans le triangle S et ne sont pas déjà dans */
+ /* si ceux-ci sont compris dans le triangle S et ne sont pas deja dans */
/* V. */
/*sommets de P: P_1, P_2, P_3 */
/*sommets de S: P_4, P_5, P_6 */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
/* calcul de l'intersection de deux segments: segments P1P2 avec P3P4 */
/* . Si l'intersection est non nulle et si celle-ci n'est */
- /* n'est pas déjà contenue dans Vect on la rajoute à Vect */
+ /* n'est pas deja contenue dans Vect on la rajoute a Vect */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
inline void inters_de_segment(const double * P_1,const double * P_2,
std::vector<double>& Vect,
double dim_caracteristic, double precision)
{
- // calcul du déterminant de P_1P_2 et P_3P_4.
+ // calcul du determinant de P_1P_2 et P_3P_4.
double det=(P_2[0]-P_1[0])*(P_4[1]-P_3[1])-(P_4[0]-P_3[0])*(P_2[1]-P_1[1]);
double absolute_precision = dim_caracteristic*precision;
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
/* calcul l'intersection de deux triangles */
/* P_1, P_2, P_3: sommets du premier triangle */
- /* P_4, P_5, P_6: sommets du deuxième triangle */
+ /* P_4, P_5, P_6: sommets du deuxi�me triangle */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
inline void intersec_de_triangle(const double* P_1,const double* P_2, const double* P_3,
}
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
- /* fonction pour vérifier qu'un n°de maille n'a pas déja été considérer */
+ /* fonction pour verifier qu'un node maille n'a pas deja ete considerer */
/* dans le vecteur et le rajouter au vecteur sinon. */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
- /* fonction pour reconstituer un polygone convexe à partir */
+ /* fonction pour reconstituer un polygone convexe a partir */
/* d'un nuage de point. */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
/* calcul l'intersection de deux polygones COPLANAIRES */
- /* en dimension DIM (2 ou 3). Si DIM=3 l'algorithme ne considère*/
- /* que les deux premières coordonnées de chaque point */
+ /* en dimension DIM (2 ou 3). Si DIM=3 l'algorithme ne considere*/
+ /* que les deux premieres coordonnees de chaque point */
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
template<int DIM> inline void intersec_de_polygone(const double * Coords_A, const double * Coords_B,
int nb_NodesA, int nb_NodesB,
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERSECTOR3D_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERSECTOR3D_TXX__
#define __INTERSECTOR3D_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERSECTOR3DP0P0_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERSECTOR3DP0P0_TXX__
#define __INTERSECTOR3DP0P0_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERSECTOR3DP0P1_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERSECTOR3DP0P1_TXX__
#define __INTERSECTOR3DP0P1_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERSECTOR3DP1P0_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __INTERSECTOR3DP1P0_TXX__
#define __INTERSECTOR3DP1P0_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __Intersector3DP1P0Bary_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __Intersector3DP1P0Bary_TXX__
#define __Intersector3DP1P0Bary_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __Intersector3DP1P1_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __Intersector3DP1P1_TXX__
#define __Intersector3DP1P1_TXX__
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : IntersectorCU.hxx
// Created : Thu Dec 17 12:30:17 2009
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : IntersectorCU.txx
// Created : Thu Dec 17 12:30:17 2009
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : IntersectorCU1D.hxx
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : IntersectorCU1D.txx
// Created : Thu Dec 17 14:17:49 2009
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : IntersectorCU2D.hxx
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : IntersectorCU2D.txx
// Created : Thu Dec 17 14:17:49 2009
getUCoordinates( icellT, uCoords );
NormalizedCellType tT = INTER_CU::_meshU.getTypeOfElement( _TMIU(icellT));
- bool is_tgt_quad = CellModel::getCellModel(tT).isQuadratic();
+ bool is_tgt_quad = CellModel::GetCellModel(tT).isQuadratic();
double quad[8] = { INTER_CU::_coordsC[0][icellS[0]], INTER_CU::_coordsC[1][icellS[1]],
INTER_CU::_coordsC[0][icellS[0]+1], INTER_CU::_coordsC[1][icellS[1]],
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : IntersectorCU3D.hxx
-// Copyright (C) 2009-2010 OPEN CASCADE
+// Copyright (C) 2009-2011 OPEN CASCADE
//
-// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : IntersectorCU3D.txx
// Created : Thu Dec 17 14:17:49 2009
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _LOG_H_
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# MED files in memory
Interpolation3D.hxx \
Interpolation3D.txx \
Interpolation3DSurf.hxx \
-Interpolation3DSurf.txx \
InterpolationOptions.hxx \
InterpolationPlanar.hxx \
InterpolationPlanar.txx \
Interpolation1D.hxx \
Interpolation1D.txx \
Interpolation2DCurve.hxx \
-Interpolation2DCurve.txx \
InterpolationCurve.hxx \
InterpolationCurve.txx \
DirectedBoundingBox.hxx
UnitTetraIntersectionBary.cxx \
InterpolationOptions.cxx \
DirectedBoundingBox.cxx \
+ Interpolation2DCurve.cxx \
+ Interpolation3DSurf.cxx \
+ Interpolation3D.cxx \
+ MeshElement.cxx \
InterpKernelMeshQuality.cxx \
InterpKernelCellSimplify.cxx
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "MeshElement.hxx"
+
+namespace INTERP_KERNEL
+{
+ /////////////////////////////////////////////////////////////////////
+ /// ElementBBoxOrder /////////////
+ /////////////////////////////////////////////////////////////////////
+ /**
+ * Constructor
+ *
+ * @param coord BoundingBox coordinate (XMIN, XMAX, etc) on which to base the ordering
+ */
+ ElementBBoxOrder::ElementBBoxOrder(BoundingBox::BoxCoord coord)
+ : _coord(coord)
+ {
+ }
+}
+
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MESHELEMENT_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MESHELEMENT_TXX__
#define __MESHELEMENT_TXX__
/////////////////////////////////////////////////////////////////////
/// ElementBBoxOrder /////////////
/////////////////////////////////////////////////////////////////////
- /**
- * Constructor
- *
- * @param coord BoundingBox coordinate (XMIN, XMAX, etc) on which to base the ordering
- */
- ElementBBoxOrder::ElementBBoxOrder(BoundingBox::BoxCoord coord)
- : _coord(coord)
- {
- }
/**
* Comparison operator based on the bounding boxes of the elements
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MESHREGION_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MESHREGION_TXX__
#define __MESHREGION_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MESHUTILS_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTOR_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTOR_TXX__
#define __PLANARINTERSECTOR_TXX__
}
else
{
- std::cout << " Maille dégénérée " << "epsilon = " << epsilon << std::endl;
+ std::cout << " Degenerated cell " << "epsilon = " << epsilon << std::endl;
std::cout << " i_A1= " << i_A1 << " i_A2= " << i_A2 << std::endl;
std::cout << " distance2<SPACEDIM>(Coords_A,&Coords_A[i_A1])= " << distance2<SPACEDIM>(Coords_A,&Coords_A[i_A1]) << std::endl;
std::cout << "abs(normal_A) = " << fabs(normal_A[0]) << " ; " <<fabs( normal_A[1]) << " ; " << fabs(normal_A[2]) << std::endl;
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP0P0_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
//
-// See http://www.salome-platform.org/ or email :webmaster.salome@opencascade.com
#ifndef __PLANARINTERSECTORP0P0_TXX__
#define __PLANARINTERSECTORP0P0_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP0P1_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
//
-// See http://www.salome-platform.org/ or email :webmaster.salome@opencascade.com
#ifndef __PLANARINTERSECTORP0P1_TXX__
#define __PLANARINTERSECTORP0P1_TXX__
if(SPACEDIM==3)
orientation=PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&sourceCellCoordsTmp[0],quadrangle,sourceCellCoords.size()/SPACEDIM,4);
NormalizedCellType tS=PlanarIntersector<MyMeshType,MyMatrix>::_meshS.getTypeOfElement(OTT<ConnType,numPol>::indFC(iS));
- double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,sourceCellCoordsTmp,CellModel::getCellModel(tS).isQuadratic());
+ double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,sourceCellCoordsTmp,CellModel::GetCellModel(tS).isQuadratic());
surf=PlanarIntersector<MyMeshType,MyMatrix>::getValueRegardingOption(surf);
if(surf!=0.)
{
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP0P1PL_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP0P1PL_TXX__
#define __PLANARINTERSECTORP0P1PL_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP1P0_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
//
-// See http://www.salome-platform.org/ or email :webmaster.salome@opencascade.com
#ifndef __PLANARINTERSECTORP1P0_TXX__
#define __PLANARINTERSECTORP1P0_TXX__
int orientation=1;
PlanarIntersector<MyMeshType,MyMatrix>::getRealTargetCoordinates(OTT<ConnType,numPol>::indFC(icellT),targetCellCoords);
NormalizedCellType tT=PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getTypeOfElement(OTT<ConnType,numPol>::indFC(icellT));
- bool isTargetQuad=CellModel::getCellModel(tT).isQuadratic();
+ bool isTargetQuad=CellModel::GetCellModel(tT).isQuadratic();
typename MyMatrix::value_type& resRow=res[icellT];
for(typename std::vector<ConnType>::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++)
{
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PlanarIntersectorP1P0Bary_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
//
-// See http://www.salome-platform.org/ or email :webmaster.salome@opencascade.com
#ifndef __PlanarIntersectorP1P0Bary_TXX__
#define __PlanarIntersectorP1P0Bary_TXX__
std::vector<double> * tgtCoords = & tgtCellCoords;
int tgtNbNodes = tgtCellCoords.size()/SPACEDIM;
NormalizedCellType tT=PlanarIntersector<MyMeshType,MyMatrix>::_meshT.getTypeOfElement(OTT<ConnType,numPol>::indFC(icellT));
- bool isTargetQuad=CellModel::getCellModel(tT).isQuadratic();
+ bool isTargetQuad=CellModel::GetCellModel(tT).isQuadratic();
typename MyMatrix::value_type& resRow=res[icellT];
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP1P0PL_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP1P0PL_TXX__
#define __PLANARINTERSECTORP1P0PL_TXX__
else
{
double littleTargetCell[9];
- std::copy(baryT,baryT+3,littleTargetCell);
+ std::copy(baryT,baryT+SPACEDIM,littleTargetCell);
std::copy(CoordsT.begin(),CoordsT.begin()+3,littleTargetCell+3);
std::copy(CoordsT.begin()+3,CoordsT.begin()+6,littleTargetCell+6);
PlanarIntersector<MyMeshType,MyMatrix>::projectionThis(&CoordsS[0],littleTargetCell,3,3);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP1P1_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
//
-// See http://www.salome-platform.org/ or email :webmaster.salome@opencascade.com
#ifndef __PLANARINTERSECTORP1P1_TXX__
#define __PLANARINTERSECTORP1P1_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP1P1PL_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PLANARINTERSECTORP1P1PL_TXX__
#define __PLANARINTERSECTORP1P1PL_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATORINTERSECTOR_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATORINTERSECTOR_TXX__
#define __POINTLOCATORINTERSECTOR_TXX__
std::vector<Node *> nodes(nbNodes);
for(int i=0;i<nbNodes;i++)
nodes[i]=new Node(coords[i*SPACEDIM],coords[i*SPACEDIM+1]);
- if(!CellModel::getCellModel(type).isQuadratic())
+ if(!CellModel::GetCellModel(type).isQuadratic())
return QuadraticPolygon::buildLinearPolygon(nodes);
else
return QuadraticPolygon::buildArcCirclePolygon(nodes);
std::vector<Node *> nodes(nbOfPoints);
for(int i=0;i<nbOfPoints;i++)
nodes[i]=new Node(PlanarIntersector<MyMeshType,MyMatrix>::_coordsT+OTT<ConnType,numPol>::coo2C(startOfCellNodeConn[i])*SPACEDIM);
- if(CellModel::getCellModel(type).isQuadratic())
+ if(CellModel::GetCellModel(type).isQuadratic())
return QuadraticPolygon::buildLinearPolygon(nodes);
else
return QuadraticPolygon::buildArcCirclePolygon(nodes);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATOR3DINTERSECTORP0P0_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATOR3DINTERSECTORP0P0_TXX__
#define __POINTLOCATOR3DINTERSECTORP0P0_TXX__
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
NormalizedCellType tS=Intersector3DP0P0<MyMeshType,MyMatrix>::_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
- const CellModel& cmTypeS=CellModel::getCellModel(tS);
+ const CellModel& cmTypeS=CellModel::GetCellModel(tS);
std::vector<ConnType> connOfCurCellS;
Intersector3DP0P0<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
if(PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(bary,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision))
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATOR3DINTERSECTORP0P1_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATOR3DINTERSECTORP0P1_TXX__
#define __POINTLOCATOR3DINTERSECTORP0P1_TXX__
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
NormalizedCellType tS=Intersector3DP0P1<MyMeshType,MyMatrix>::_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
- const CellModel& cmTypeS=CellModel::getCellModel(tS);
+ const CellModel& cmTypeS=CellModel::GetCellModel(tS);
std::vector<ConnType> connOfCurCellS;
Intersector3DP0P1<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
for(int nodeIdT=0;nodeIdT<nbNodesT;nodeIdT++)
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATOR3DINTERSECTORP1P0_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATOR3DINTERSECTORP1P0_TXX__
#define __POINTLOCATOR3DINTERSECTORP1P0_TXX__
NormalizedCellType tS=Intersector3DP1P0<MyMeshType,MyMatrix>::_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
if(tS!=NORM_TETRA4)
throw INTERP_KERNEL::Exception("Invalid source cell detected for meshdim==3. Only TETRA4 supported !");
- const CellModel& cmTypeS=CellModel::getCellModel(tS);
+ const CellModel& cmTypeS=CellModel::GetCellModel(tS);
std::vector<ConnType> connOfCurCellS;
Intersector3DP1P0<MyMeshType,MyMatrix>::getConnOfSourceCell(OTT<ConnType,numPol>::indFC(*iterCellS),connOfCurCellS);
if( PointLocatorAlgos<MyMeshType>::isElementContainsPointAlg3D(baryT,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) )
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATOR3DINTERSECTORP1P1_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATOR3DINTERSECTORP1P1_TXX__
#define __POINTLOCATOR3DINTERSECTORP1P1_TXX__
NormalizedCellType tS=Intersector3DP1P1<MyMeshType,MyMatrix>::_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
if(tS!=NORM_TETRA4)
throw INTERP_KERNEL::Exception("Invalid source cell detected for meshdim==3. Only TETRA4 supported !");
- const CellModel& cmTypeS=CellModel::getCellModel(tS);
+ const CellModel& cmTypeS=CellModel::GetCellModel(tS);
const ConnType *startOfCellNodeConnT=Intersector3DP1P1<MyMeshType,MyMatrix>::getStartConnOfTargetCell(targetCell);
for(int nodeIdT=0;nodeIdT<nbOfNodesT;nodeIdT++)
{
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POINTLOCATORALGOS_TXX__
#define __POINTLOCATORALGOS_TXX__
#include "BBTree.txx"
#include <list>
+#include <set>
#include <limits>
namespace INTERP_KERNEL
typedef typename MyMeshType::MyConnType ConnType;
const NumberingPolicy numPol=MyMeshType::My_numPol;
- const CellModel& cmType=CellModel::getCellModel(type);
+ const CellModel& cmType=CellModel::GetCellModel(type);
//
if (SPACEDIM==2)
{
{
return isElementContainsPointAlg3D(ptToTest,conn_elem,conn_elem_sz,coords,cmType,eps);
}
+ throw INTERP_KERNEL::Exception("Invalid spacedim detected ! Managed spaceDim are 2 and 3 !");
}
bool elementContainsPoint(typename MyMeshType::MyConnType i, const double* x, double eps)
return (min_sign!=-1 || max_sign!=1);
}
};
+
+ template<class MyMeshType>
+ class PointLocatorInSimplex : public PointLocatorAlgos<MyMeshType>
+ {
+ const MyMeshType& _mesh;
+ public:
+ PointLocatorInSimplex(const MyMeshType& mesh)
+ :PointLocatorAlgos<MyMeshType>(mesh),_mesh(mesh)
+ {
+ }
+
+ //================================================================================
+ /*!
+ * \brief Returns nodes composing the simplex the point x is in
+ */
+ //================================================================================
+
+ virtual std::list<int> locates(const double* x, double eps)
+ {
+ typedef typename MyMeshType::MyConnType ConnType;
+ const NumberingPolicy numPol=MyMeshType::My_numPol;
+
+ std::list<int> simplexNodes;
+ std::list<int> candidates = PointLocatorAlgos<MyMeshType>::locates(x,eps);
+ std::list<int>::iterator eIt = candidates.begin();
+ for ( ; eIt != candidates.end(); ++eIt )
+ {
+ const int i = OTT<ConnType,numPol>::ind2C( *eIt );
+ const double* coords= _mesh.getCoordinatesPtr();
+ const ConnType* conn=_mesh.getConnectivityPtr();
+ const ConnType* conn_index= _mesh.getConnectivityIndexPtr();
+ const ConnType* conn_elem=conn+OTT<ConnType,numPol>::ind2C(conn_index[i]);
+ int conn_elem_sz=conn_index[i+1]-conn_index[i];
+ NormalizedCellType type=_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(i));
+ CellModel cell = CellModel::GetCellModel(type);
+
+ if ( cell.isQuadratic() )
+ throw Exception("P2 not implemented yet");
+
+ if ( cell.isSimplex())
+ {
+ for ( int n = 0; n < conn_elem_sz; ++n )
+ simplexNodes.push_back( conn_elem[ n ]);
+ }
+ else
+ {
+ NormalizedCellType simlexType = cell.getDimension()==3 ? NORM_TETRA4 : NORM_TRI3;
+ std::vector<int> sonNodes;
+ NormalizedCellType sonType;
+ const unsigned nbSons = cell.getNumberOfSons2( conn_elem, conn_elem_sz );
+ for ( unsigned s = 0; s < nbSons; ++s )
+ {
+ sonNodes.resize( cell.getNumberOfNodesConstituentTheSon2( s, conn_elem, conn_elem_sz ));
+ cell.fillSonCellNodalConnectivity2( s, conn_elem, conn_elem_sz, &sonNodes[0], sonType );
+ std::set<int> sonNodesSet( sonNodes.begin(), sonNodes.end() );
+
+ std::set< std::set< ConnType > > checkedSonSimplex;
+ for ( unsigned sn = 0; sn < sonNodes.size(); ++sn )
+ {
+ std::vector< ConnType > simplexConn( cell.getDimension() + 1 );
+ unsigned n;
+ for ( n = 0; n < cell.getDimension()-1; ++n )
+ simplexConn[n] = sonNodes[ (sn+n) % sonNodes.size() ];
+
+ for ( unsigned n2 = 0; n2 < sonNodes.size()-cell.getDimension()+1; ++n2 )
+ {
+ simplexConn[n] = sonNodes[ (sn+n+n2) % sonNodes.size() ];
+ std::set< ConnType > sonSimplex( simplexConn.begin(), --simplexConn.end());
+ if ( checkedSonSimplex.insert( sonSimplex ).second )
+ {
+ for ( unsigned cn = 0; cn < conn_elem_sz; ++cn )
+ if ( !sonNodesSet.count( conn_elem[cn] ))
+ {
+ simplexConn.back() = conn_elem[cn];
+ if ( isElementContainsPoint( x, simlexType, coords,
+ &simplexConn[0], simplexConn.size(), eps ))
+ {
+ simplexNodes.insert( simplexNodes.end(),
+ simplexConn.begin(), simplexConn.end());
+ return simplexNodes;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return simplexNodes;
+ }
+
+ };
}
#endif
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POLYGONALGORITHMS_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POLYGONALGORITHMS_TXX__
#define __POLYGONALGORITHMS_TXX__
if(fabs(det) > _epsilon)
{
inv_det = 1/det;
- t1=(AC[1]*DC[2]-AC[2]*DC[1])*inv_det;
- t2=(AB[1]*AC[2]-AB[2]*AC[1])*inv_det;
+ t1=(AC[1]*DC[DIM-1]-AC[DIM-1]*DC[1])*inv_det;
+ t2=(AB[1]*AC[DIM-1]-AB[DIM-1]*AC[1])*inv_det;
}
else //beware AB and CD may belong to a plane y = constant
{
- det = AB[0]*DC[2]-AB[2]*DC[0];
+ det = AB[0]*DC[DIM-1]-AB[DIM-1]*DC[0];
if(fabs(det) > _epsilon)
{
inv_det = 1/det;
- t1=(AC[0]*DC[2]-AC[2]*DC[0])*inv_det;
- t2=(AB[0]*AC[2]-AB[2]*AC[0])*inv_det;
+ t1=(AC[0]*DC[DIM-1]-AC[DIM-1]*DC[0])*inv_det;
+ t2=(AB[0]*AC[DIM-1]-AB[DIM-1]*AC[0])*inv_det;
}
else
{
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POLYHEDRONINTERSECTORP0P0_HXX__
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
- PolyhedronIntersectorP0P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = GENERAL_24);
+ PolyhedronIntersectorP0P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = PLANAR_FACE_5);
~PolyhedronIntersectorP0P0();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POLYHEDRONINTERSECTORP0P0_TXX__
#define __POLYHEDRONINTERSECTORP0P0_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POLYHEDRONINTERSECTORP0P1_HXX__
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
- PolyhedronIntersectorP0P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = GENERAL_24);
+ PolyhedronIntersectorP0P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = PLANAR_FACE_5);
~PolyhedronIntersectorP0P1();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POLYHEDRONINTERSECTORP0P1_TXX__
#define __POLYHEDRONINTERSECTORP0P1_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POLYHEDRONINTERSECTORP1P0_HXX__
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
- PolyhedronIntersectorP1P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = GENERAL_24);
+ PolyhedronIntersectorP1P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = PLANAR_FACE_5);
~PolyhedronIntersectorP1P0();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __POLYHEDRONINTERSECTORP1P0_TXX__
#define __POLYHEDRONINTERSECTORP1P0_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PolyhedronIntersectorP1P0Bary_HXX__
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
- PolyhedronIntersectorP1P0Bary(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = GENERAL_24);
+ PolyhedronIntersectorP1P0Bary(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = PLANAR_FACE_5);
~PolyhedronIntersectorP1P0Bary();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PolyhedronIntersectorP1P0Bary_TXX__
#define __PolyhedronIntersectorP1P0Bary_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PolyhedronIntersectorP1P1_HXX__
static const NumberingPolicy numPol=MyMeshType::My_numPol;
public:
- PolyhedronIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = GENERAL_24);
+ PolyhedronIntersectorP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy = PLANAR_FACE_5);
~PolyhedronIntersectorP1P1();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PolyhedronIntersectorP1P1_TXX__
#define __PolyhedronIntersectorP1P1_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __REGIONNODE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __SPLITTERTETRA_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __SPLITTERTETRA_TXX__
#define __SPLITTERTETRA_TXX__
// get type of cell
NormalizedCellType normCellType=_src_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(element));
- const CellModel& cellModelCell=CellModel::getCellModel(normCellType);
+ const CellModel& cellModelCell=CellModel::GetCellModel(normCellType);
unsigned nbOfNodes4Type=cellModelCell.isDynamic() ? _src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(element)) : cellModelCell.getNumberOfNodes();
// halfspace filtering
bool isOutside[8] = {true, true, true, true, true, true, true, true};
else
{
faceType = cellModelCell.getSonType(ii);
- const CellModel& faceModel=CellModel::getCellModel(faceType);
+ const CellModel& faceModel=CellModel::GetCellModel(faceType);
assert(faceModel.getDimension() == 2);
faceNodes=new int[faceModel.getNumberOfNodes()];
cellModelCell.fillSonCellNodalConnectivity(ii,cellNodes,faceNodes);
if(!isTargetOutside)
{
- const CellModel& cellModelCell=CellModel::getCellModel(NORM_TETRA4);
+ const CellModel& cellModelCell=CellModel::GetCellModel(NORM_TETRA4);
int cellNodes[4] = { 0, 1, 2, 3 }, faceNodes[3];
for(unsigned ii = 0 ; ii < 4 ; ++ii)
nodes[1] = getCoordsOfSubNode2(faceCenterNode,conn[1]);
for(int j = 0; j < 4; ++j)
{
- const int row = 4*(faceCenterNode - 9) + j;
+ const int row = 4*(faceCenterNode - 8) + j;
nodes[2] = getCoordsOfSubNode2(TETRA_EDGES[2*row],conn[2]);
nodes[3] = getCoordsOfSubNode2(TETRA_EDGES[2*row + 1],conn[3]);
// get type of cell and nb of cell nodes
NormalizedCellType normCellType=_target_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(targetCell));
- const CellModel& cellModelCell=CellModel::getCellModel(normCellType);
+ const CellModel& cellModelCell=CellModel::GetCellModel(normCellType);
unsigned nbOfCellNodes=cellModelCell.isDynamic() ? _target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell)) : cellModelCell.getNumberOfNodes();
// get nb of cell sons (faces)
1,2,5,6,// sub-node 12 (face)
4,5,6,7,// sub-node 13 (face)
2,3,6,7,// sub-node 14 (face)
- 9,10,11,12// sub-node 15 (cell)
+ 8,9,10,11// sub-node 15 (cell)
};
for(int i = 0; i < 7; ++i)
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TARGETINTERSECTOR__HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "TetraAffineTransform.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TETRA_AFFINE_TRANSFORM_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "TransformedTriangle.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TRANSFORMED_TRIANGLE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TRANSFORMEDTRIANGLEINLINE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "TransformedTriangle.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "TransformedTriangle.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "TranslationRotationMatrix.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TRANSLATIONROTATIONMATRIX_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TRIANGULATIONINTERSECTOR_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TRIANGULATIONINTERSECTOR_TXX__
#define __TRIANGULATIONINTERSECTOR_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : UnitTetraIntersectionBary.cxx
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : UnitTetraIntersectionBary.hxx
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __VTKNORMALIZEDUNSTRUCTUREDMESH_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __VTKNORMALIZEDUNSTRUCTUREDMESH_TXX__
#define __VTKNORMALIZEDUNSTRUCTUREDMESH_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __VECTORUTILS_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __VOLSURFFORMULAE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __VOLSURFUSER_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __VOLSURFUSER_TXX__
#define __VOLSURFUSER_TXX__
coords+SPACEDIM*N8);
}
break;
-
+ case INTERP_KERNEL::NORM_HEXGP12:
+ {
+ const int connecHexa12[43]={
+ OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[1]),OTT<ConnType,numPol>::coo2C(connec[2]),OTT<ConnType,numPol>::coo2C(connec[3]),OTT<ConnType,numPol>::coo2C(connec[4]),OTT<ConnType,numPol>::coo2C(connec[5]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[11]),OTT<ConnType,numPol>::coo2C(connec[10]),OTT<ConnType,numPol>::coo2C(connec[9]),OTT<ConnType,numPol>::coo2C(connec[8]),OTT<ConnType,numPol>::coo2C(connec[7]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[7]),OTT<ConnType,numPol>::coo2C(connec[1]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[1]),OTT<ConnType,numPol>::coo2C(connec[7]),OTT<ConnType,numPol>::coo2C(connec[8]),OTT<ConnType,numPol>::coo2C(connec[2]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[2]),OTT<ConnType,numPol>::coo2C(connec[8]),OTT<ConnType,numPol>::coo2C(connec[9]),OTT<ConnType,numPol>::coo2C(connec[3]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[3]),OTT<ConnType,numPol>::coo2C(connec[9]),OTT<ConnType,numPol>::coo2C(connec[10]),OTT<ConnType,numPol>::coo2C(connec[4]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[4]),OTT<ConnType,numPol>::coo2C(connec[10]),OTT<ConnType,numPol>::coo2C(connec[11]),OTT<ConnType,numPol>::coo2C(connec[5]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[5]),OTT<ConnType,numPol>::coo2C(connec[11]),OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[0])};
+ return calculateVolumeForPolyh2<ConnType,numPol>(connecHexa12,43,coords);
+ }
case INTERP_KERNEL::NORM_POLYHED :
{
return calculateVolumeForPolyh2<ConnType,numPol>(connec,lgth,coords);
barycenterOfPolyhedron<ConnType,numPol>(conn,22,coords,res);
break;
}
+ case INTERP_KERNEL::NORM_HEXGP12:
+ {
+ const int connecHexa12[43]={
+ OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[1]),OTT<ConnType,numPol>::coo2C(connec[2]),OTT<ConnType,numPol>::coo2C(connec[3]),OTT<ConnType,numPol>::coo2C(connec[4]),OTT<ConnType,numPol>::coo2C(connec[5]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[11]),OTT<ConnType,numPol>::coo2C(connec[10]),OTT<ConnType,numPol>::coo2C(connec[9]),OTT<ConnType,numPol>::coo2C(connec[8]),OTT<ConnType,numPol>::coo2C(connec[7]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[0]),OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[7]),OTT<ConnType,numPol>::coo2C(connec[1]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[1]),OTT<ConnType,numPol>::coo2C(connec[7]),OTT<ConnType,numPol>::coo2C(connec[8]),OTT<ConnType,numPol>::coo2C(connec[2]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[2]),OTT<ConnType,numPol>::coo2C(connec[8]),OTT<ConnType,numPol>::coo2C(connec[9]),OTT<ConnType,numPol>::coo2C(connec[3]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[3]),OTT<ConnType,numPol>::coo2C(connec[9]),OTT<ConnType,numPol>::coo2C(connec[10]),OTT<ConnType,numPol>::coo2C(connec[4]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[4]),OTT<ConnType,numPol>::coo2C(connec[10]),OTT<ConnType,numPol>::coo2C(connec[11]),OTT<ConnType,numPol>::coo2C(connec[5]),-1,
+ OTT<ConnType,numPol>::coo2C(connec[5]),OTT<ConnType,numPol>::coo2C(connec[11]),OTT<ConnType,numPol>::coo2C(connec[6]),OTT<ConnType,numPol>::coo2C(connec[0])};
+ barycenterOfPolyhedron<ConnType,numPol>(connecHexa12,43,coords,res);
+ break;
+ }
case NORM_POLYHED:
{
barycenterOfPolyhedron<ConnType,numPol>(connec,lgth,coords,res);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "BBTreeTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_BB_TREE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _BASICMAINTEST_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CppUnitTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_TEST_CPPUNIT_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "ExprEvalInterpTest.hxx"
#include "InterpKernelExprParser.hxx"
+#include <limits>
+#include <iterator>
+
using namespace INTERP_TEST;
void ExprEvalInterpTest::testBuildStringFromFortran()
INTERP_KERNEL::Unit unit12("m-m");
CPPUNIT_ASSERT(!unit12.isInterpretationOK());
}
+
+void ExprEvalInterpTest::testInterpreter3()
+{
+ std::set<std::string> res;
+ double input[3];
+ double res2[3];
+ INTERP_KERNEL::ExprParser expr1("2.3+x>5.");
+ expr1.parse();
+ expr1.getSetOfVars(res);
+ CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
+ CPPUNIT_ASSERT(*(res.begin())=="x");
+ expr1.prepareExprEvaluationVec();
+ input[0]=0.;
+ expr1.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT(-std::numeric_limits<double>::max()==res2[0]);
+ input[0]=2.8;
+ expr1.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT(std::numeric_limits<double>::max()==res2[0]);
+ input[0]=2.6;
+ expr1.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT(-std::numeric_limits<double>::max()==res2[0]);
+ //
+ INTERP_KERNEL::ExprParser expr2("2.3+x<5.");
+ expr2.parse();
+ res.clear();
+ expr2.getSetOfVars(res);
+ CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
+ CPPUNIT_ASSERT(*(res.begin())=="x");
+ expr2.prepareExprEvaluationVec();
+ input[0]=0.;
+ expr2.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT(std::numeric_limits<double>::max()==res2[0]);
+ input[0]=2.8;
+ expr2.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT(-std::numeric_limits<double>::max()==res2[0]);
+ input[0]=2.6;
+ expr2.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT(std::numeric_limits<double>::max()==res2[0]);
+ //
+ INTERP_KERNEL::ExprParser expr3("if(2.3+x<5.,2+3*x,3+x/2)");
+ expr3.parse();
+ res.clear();
+ expr3.getSetOfVars(res);
+ CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
+ CPPUNIT_ASSERT(*(res.begin())=="x");
+ expr3.prepareExprEvaluationVec();
+ input[0]=0.;
+ expr3.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2.,res2[0],1e-12);
+ input[0]=2.8;
+ expr3.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4.4,res2[0],1e-12);
+ input[0]=2.6;
+ expr3.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(9.8,res2[0],1e-12);
+ //
+ INTERP_KERNEL::ExprParser expr4("if(x>1000,2*x,x/3)");
+ expr4.parse();
+ res.clear();
+ expr4.getSetOfVars(res);
+ CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
+ CPPUNIT_ASSERT(*(res.begin())=="x");
+ expr4.prepareExprEvaluationVec();
+ input[0]=2.7;
+ expr4.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.9,res2[0],1e-12);
+ input[0]=999.;
+ expr4.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(333.,res2[0],1e-12);
+ input[0]=1002.;
+ expr4.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2004.,res2[0],1e-12);
+ //
+ INTERP_KERNEL::ExprParser expr5("4.4*x*log10(x)*10");
+ expr5.parse();
+ res.clear();
+ expr5.getSetOfVars(res);
+ CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
+ CPPUNIT_ASSERT(*(res.begin())=="x");
+ expr5.prepareExprEvaluationVec();
+ input[0]=273.15;
+ expr5.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(29282.131520617437,res2[0],1e-9);
+ input[0]=0.;
+ CPPUNIT_ASSERT_THROW(expr5.evaluateExpr(1,input,res2),INTERP_KERNEL::Exception);
+}
+
+/*!
+ * Bug detected by Marc concerning expressions with blanks.
+ */
+void ExprEvalInterpTest::testInterpreter4()
+{
+ INTERP_KERNEL::ExprParser expr("2*x + 1");
+ double vals[3]={0.1,0.2,0.3};
+ std::vector<std::string> varsV(3);
+ varsV[0] = "x";
+ varsV[1] = "y";
+ varsV[2] = "z";
+ expr.parse();
+ expr.prepareExprEvaluation(varsV);
+ double result;
+ expr.evaluateExpr(1,vals, &result);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.2,result,1e-12);
+}
+
+/*!
+ * Allowing scientific format for floats.
+ */
+void ExprEvalInterpTest::testInterpreter5()
+{
+ std::set<std::string> res;
+ double input[3];
+ double res2[3];
+ INTERP_KERNEL::ExprParser expr1("1.85e-3*x");
+ expr1.parse();
+ expr1.getSetOfVars(res);
+ CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
+ CPPUNIT_ASSERT(*(res.begin())=="x");
+ input[0]=56.7;
+ expr1.prepareExprEvaluationVec();
+ expr1.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.104895,res2[0],1e-12);
+ input[0]=-65.7;
+ expr1.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.121545,res2[0],1e-12);
+ //
+ INTERP_KERNEL::ExprParser expr2("x*1.85e-3");
+ expr2.parse();
+ expr2.getSetOfVars(res);
+ CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
+ CPPUNIT_ASSERT(*(res.begin())=="x");
+ input[0]=56.7;
+ expr2.prepareExprEvaluationVec();
+ expr2.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.104895,res2[0],1e-12);
+ input[0]=-65.7;
+ expr2.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.121545,res2[0],1e-12);
+ //
+ INTERP_KERNEL::ExprParser expr3("2.6E+1+x*1.85e-3");
+ expr3.parse();
+ expr3.getSetOfVars(res);
+ CPPUNIT_ASSERT_EQUAL(1,(int)res.size());
+ CPPUNIT_ASSERT(*(res.begin())=="x");
+ input[0]=56.7;
+ expr3.prepareExprEvaluationVec();
+ expr3.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(26.104895,res2[0],1e-12);
+ input[0]=-65.7;
+ expr3.evaluateExpr(1,input,res2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(25.878455,res2[0],1e-12);
+ //
+ INTERP_KERNEL::ExprParser expr4("3.*max(((3.2e+1*(ln((2*5.2E-02+6.)+(1.2E-001*1.2E+2+3e-4))))),((3.2E-2*(exp((6e-1+2*5.2e-2)+(1.2E001*1.2+3.))))))");
+ expr4.parse();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6994207.8359543988,expr4.evaluate(),1e-5);
+}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _EXPREVALINTERPTEST_HXX_
CPPUNIT_TEST( testInterpreter2 );
CPPUNIT_TEST( testInterpreterUnit0 );
CPPUNIT_TEST( testInterpreterUnit1 );
+ CPPUNIT_TEST( testInterpreter3 );
+ CPPUNIT_TEST( testInterpreter4 );
+ CPPUNIT_TEST( testInterpreter5 );
CPPUNIT_TEST_SUITE_END();
public:
void setUp() { }
void testInterpreter0();
void testInterpreter1();
void testInterpreter2();
+ void testInterpreter3();
+ void testInterpreter4();
+ void testInterpreter5();
void testInterpreterUnit0();
void testInterpreterUnit1();
};
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __HEXA_TESTS_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _INTERPKERNELTESTEXPORT_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "Interpolation3DTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_INTERPOLATION_3D_TEST_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "InterpolationOptionsTest.hxx"
namespace INTERP_TEST
{
-
-
- void InterpolationOptionsTest::setUp()
+ void InterpolationOptionsTest::setUp()
{
}
-
- void InterpolationOptionsTest::tearDown()
+
+ void InterpolationOptionsTest::tearDown()
{
}
* a standard case
* a bbox overlapping the bboxes of the tree
*/
- void InterpolationOptionsTest::test_InterpolationOptions() {
+ void InterpolationOptionsTest::test_InterpolationOptions()
+ {
string sourcename=INTERP_TEST::getResourceFile("square1.med");
MEDMEM::MESH *source_mesh=new MEDMEM::MESH(MED_DRIVER,sourcename,"Mesh_2");
string targetname=INTERP_TEST::getResourceFile("square2.med");
MEDMEM::MESH *target_mesh=new MEDMEM::MESH(MED_DRIVER,targetname,"Mesh_3");
- MEDMEM::SUPPORT *source_support=new SUPPORT(source_mesh,"on All support");
+ const MEDMEM::SUPPORT *source_support=source_mesh->getSupportOnAll(MED_EN::MED_CELL);
MEDMEM::FIELD<double> *source_field=new FIELD<double>(source_support,1);
double* value=const_cast<double*>(source_field->getValue());
for (int i=0; i<source_support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
value[i]=1.0;
- source_support->removeReference();
- MEDMEM::SUPPORT *target_support=new MEDMEM::SUPPORT(target_mesh,"on All support");
+ const MEDMEM::SUPPORT *target_support=target_mesh->getSupportOnAll(MED_EN::MED_CELL);
MEDMEM::FIELD<double> *target_field=new FIELD<double>(target_support,1);
double* targetvalue=const_cast<double*>(target_field->getValue());
for (int i=0; i<target_support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); i++)
targetvalue[i]=0.0;
- target_support->removeReference();
// Ok at this point we have our mesh in MED-Memory format.
// Go to wrap med_source_mesh and med_target_mesh.
MEDNormalizedUnstructuredMesh<2,2> wrap_source_mesh(source_mesh);
target_field->removeReference();
target_mesh->removeReference();
}
-
-
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_INTERPOLATIONOPTIONS_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_INTERPOLATION_PLANAR_TEST_SUITE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_INTERPOLATION_TEST_SUITE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#include "MEDMeshMaker.hxx"
+
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_Meshing.hxx"
MEDMEM::MESH* MEDMeshMaker(int dim, int nbedge, MED_EN::medGeometryElement type)
{
MEDMEM::MESHING* mesh=new MEDMEM::MESHING();
- mesh->setSpaceDimension(dim);
int nbnodes;
int nbelems;
switch (dim)
conn [ielem*8+7]=ix*(nbedge+1)*(nbedge+1)+(iy+1)*(nbedge+1)+iz+1+1;
}
}
- mesh->setConnectivity(conn, MED_EN::MED_CELL,type);
+ mesh->setConnectivity(MED_EN::MED_CELL,type,conn);
delete [] conn;
- mesh->setMeshDimension(dim);
return mesh;
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDMEM_define.hxx"
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_MESH_TEST_TOOLKIT_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "TestInterpKernelUtils.hxx"
#include "MeshTestToolkit.hxx"
#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Field.hxx"
+#include "MEDMEM_Support.hxx"
-#include "Interpolation3DSurf.txx"
+#include "Interpolation3DSurf.hxx"
#include "Interpolation2D.txx"
#include "Interpolation3D.txx"
#include <cmath>
#include <algorithm>
-//#include "VectorUtils.hxx"
-
-#include "MEDMEM_Field.hxx"
-#include "MEDMEM_Support.hxx"
// levels :
// 1 - titles and volume results
namespace INTERP_TEST
{
-
/**
* Calculates the sum of a row of an intersection matrix
*
template <int SPACEDIM, int MESHDIM>
void MeshTestToolkit<SPACEDIM,MESHDIM>::getVolumes(MEDMEM::MESH& mesh, double* tab) const
{
- SUPPORT *sup=new SUPPORT(&mesh,"dummy",MED_CELL);
+ const SUPPORT *sup=mesh.getSupportOnAll( MED_CELL );
FIELD<double>* f;
switch (MESHDIM)
{
}
const double *tabS = f->getValue();
std::copy(tabS,tabS+mesh.getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS),tab);
- sup->removeReference();
f->removeReference();
}
template <int SPACEDIM, int MESHDIM>
double MeshTestToolkit<SPACEDIM,MESHDIM>::sumVolume(const IntersectionMatrix& m) const
{
-
std::vector<double> volumes;
for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
{
volumes.push_back(fabs(iter2->second));
}
}
-
+
// sum in ascending order to avoid rounding errors
-
+
sort(volumes.begin(), volumes.end());
const double vol = accumulate(volumes.begin(), volumes.end(), 0.0);
-
+
return vol;
}
}
return compatitable;
}
-
+
/**
* Tests if two intersection matrices are each others' transposes.
*
template <int SPACEDIM, int MESHDIM>
bool MeshTestToolkit<SPACEDIM,MESHDIM>::testTranspose(const IntersectionMatrix& m1, const IntersectionMatrix& m2) const
{
-
int i = 0;
bool isSymmetric = true;
{
for(map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
{
-
std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << endl;
-
}
++i;
}
LOG(5, "Loading " << mesh1 << " from " << mesh1path);
MESH sMesh(MED_DRIVER, INTERP_TEST::getResourceFile(mesh1path), mesh1);
-
+
LOG(5, "Loading " << mesh2 << " from " << mesh2path);
MESH tMesh(MED_DRIVER, INTERP_TEST::getResourceFile(mesh2path), mesh2);
}
LOG(1, "Intersection calculation done. " << std::endl );
-
}
/**
}
else
{
-
IntersectionMatrix matrix2;
calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2);
#if LOG_LEVEL >= 2
dumpIntersectionMatrix(matrix2);
#endif
-
+
const double vol2 = sumVolume(matrix2);
LOG(1, "vol1 = " << vol1 << ", vol2 = " << vol2 << ", correctVol = " << correctVol );
CPPUNIT_ASSERT_DOUBLES_EQUAL(correctVol, vol2, prec * std::max(vol2, correctVol));
CPPUNIT_ASSERT_DOUBLES_EQUAL(vol1, vol2, prec * std::max(vol1, vol2));
}
-
}
/**
intersectMeshes(path1.c_str(), mesh1, path2.c_str(), mesh2, correctVol, prec, doubleTest);
}
-
-
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MULTI_ELEMENT_2D_TESTS_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MULTI_ELEMENT_3DSurf_TESTS_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MULTI_ELEMENT_TETRA_TESTS_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "Interpolation3D.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "PointLocatorTest.hxx"
}
+ /**
+ * Test that the results are correct in three
+ * cases :
+ * a non matching search
+ * a standard case
+ * a bbox overlapping the bboxes of the tree
+ */
+ void PointLocatorTest::test_PointLocatorInSimplex()
+ {
+ MEDMEM::MESH* mesh2D= MEDMeshMaker(2,2,MED_EN::MED_QUAD4);
+ // mesh is a quadrangle (0.0-1.0 x 0.0-1.0 )
+ // 3 -- 6 -- 9
+ // | | |
+ // 2 -- 5 -- 8
+ // | | |
+ // 1 -- 4 -- 7
+ MEDMEM::PointLocatorInSimplex pl(*mesh2D) ;
+ std::list<int> elems;
+ std::list<int>::iterator elem;
+ {
+ double x[2]={0.0,0.25};
+ elems = pl.locate(x);
+ elem = elems.begin();
+ CPPUNIT_ASSERT_EQUAL(3,(int)elems.size());
+ CPPUNIT_ASSERT_EQUAL(1,*elem++);
+ CPPUNIT_ASSERT_EQUAL(2,*elem++);
+ CPPUNIT_ASSERT_EQUAL(5,*elem++);
+ }
+ {
+ double x[2]={0.25,0.0};
+ elems = pl.locate(x);
+ elem = elems.begin();
+ CPPUNIT_ASSERT_EQUAL(3,(int)elems.size());
+ CPPUNIT_ASSERT_EQUAL(1,*elem++);
+ CPPUNIT_ASSERT_EQUAL(2,*elem++);
+ CPPUNIT_ASSERT_EQUAL(4,*elem++);
+ }
+ {
+ double x[2]={0.25,1.0};
+ elems = pl.locate(x);
+ elem = elems.begin();
+ CPPUNIT_ASSERT_EQUAL(3,(int)elems.size());
+ CPPUNIT_ASSERT_EQUAL(2,*elem++);
+ CPPUNIT_ASSERT_EQUAL(3,*elem++);
+ CPPUNIT_ASSERT_EQUAL(6,*elem++);
+ }
+ {
+ double x[2]={0.4,0.75};
+ elems = pl.locate(x);
+ elem = elems.begin();
+ CPPUNIT_ASSERT_EQUAL(3,(int)elems.size());
+ CPPUNIT_ASSERT_EQUAL(3,*elem++);
+ CPPUNIT_ASSERT_EQUAL(6,*elem++);
+ CPPUNIT_ASSERT_EQUAL(5,*elem++);
+ }
+ {
+ double x[2]={-1.0,0.0};
+ elems = pl.locate(x);
+ CPPUNIT_ASSERT_EQUAL(0,(int)elems.size());
+ delete mesh2D;
+ }
+ MEDMEM::MESH* mesh3D= MEDMeshMaker(3,2,MED_EN::MED_HEXA8);
+ // ^Z
+ // |
+ // 3 -- 6 -- 9
+ // | | |
+ // 2 -- 5 -- 8 12 --15 --18
+ // | | | | | |
+ // 1 -- 4 -- 7->Y 11 --14 --17 21 --24 --27
+ // \ | | | | | |
+ // \ X 10 --13 --16 20 --23 --26
+ // v | | |
+ // 19 --22 --25
+
+ MEDMEM::PointLocatorInSimplex pl3(*mesh3D);
+ {
+ double x[3]={0.0,0.0,0.0};
+ elems = pl3.locate(x);
+ elem = elems.begin();
+ CPPUNIT_ASSERT_EQUAL(4,(int)elems.size());
+ CPPUNIT_ASSERT_EQUAL(1,*elem++);
+ CPPUNIT_ASSERT_EQUAL(10,*elem++);
+ CPPUNIT_ASSERT_EQUAL(13,*elem++);
+ CPPUNIT_ASSERT_EQUAL(2,*elem++);
+ }
+ {
+ double x[3]={0.0,0.4,0.3};
+ elems = pl3.locate(x);
+ elem = elems.begin();
+ CPPUNIT_ASSERT_EQUAL(4,(int)elems.size());
+ CPPUNIT_ASSERT_EQUAL(1,*elem++);
+ CPPUNIT_ASSERT_EQUAL(10,*elem++);
+ CPPUNIT_ASSERT_EQUAL(4,*elem++);
+ CPPUNIT_ASSERT_EQUAL(5,*elem++);
+ }
+ {
+ double x[3]={0.5,0.5,0.5};
+ elems = pl3.locate(x);
+ elem = elems.begin();
+ CPPUNIT_ASSERT_EQUAL(4,(int)elems.size());
+ CPPUNIT_ASSERT_EQUAL(1,*elem++);
+ CPPUNIT_ASSERT_EQUAL(10,*elem++);
+ CPPUNIT_ASSERT_EQUAL(13,*elem++);
+ CPPUNIT_ASSERT_EQUAL(14,*elem++);
+ }
+ {
+ double x[3]={-1.0,0.0,0.0};
+ elems = pl3.locate(x);
+ CPPUNIT_ASSERT_EQUAL(0,(int)elems.size());
+ }
+ delete mesh3D;
+ }
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_POINTLOCATOR_HXX__
#define __TU_POINTLOCATOR_HXX__
-#include <cppunit/extensions/HelperMacros.h>
-
#include "InterpKernelTestExport.hxx"
#include "PointLocator.hxx"
+#include <cppunit/extensions/HelperMacros.h>
+
namespace INTERP_TEST
{
CPPUNIT_TEST_SUITE( PointLocatorTest );
CPPUNIT_TEST( test_PointLocator );
+ CPPUNIT_TEST( test_PointLocatorInSimplex );
CPPUNIT_TEST_SUITE_END();
// tests
void test_PointLocator();
+ void test_PointLocatorInSimplex();
};
}
-
-
#endif
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QuadraticPlanarInterpTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _QUADRATICPLANARINTERPTEST_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QuadraticPlanarInterpTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QuadraticPlanarInterpTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QuadraticPlanarInterpTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "QuadraticPlanarInterpTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "RemapperTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SingleElementPlanarTests.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __SINGLE_ELEMENT_PLANAR_TESTS_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __SINGLE_ELEMENT_TETRA_TESTS_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CppUnitTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "TestInterpKernelUtils.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _TESTINTERPKERNELUTILS_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _TESTING_UTILS_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "TransformedTriangleIntersectTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_TRANSFORMED_TRIANGLE_INTERSECT_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "TransformedTriangleTest.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __TU_TRANSFORMED_TRIANGLE_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : UnitTetraIntersectionBaryTest.cxx
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : UnitTetraIntersectionBaryTests.hxx
#!/bin/bash
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# should be run from the build directory, so that ./PerfTest is available
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _MEDCOUPLING_HXX_
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGAUTOREFCOUNTOBJECTPTR_HXX__
MEDCouplingAutoRefCountObjectPtr(const MEDCouplingAutoRefCountObjectPtr& other):_ptr(0) { referPtr(other._ptr); }
MEDCouplingAutoRefCountObjectPtr(T *ptr=0):_ptr(ptr) { }
~MEDCouplingAutoRefCountObjectPtr() { destroyPtr(); }
+ bool operator==(const MEDCouplingAutoRefCountObjectPtr& other) { return _ptr==other._ptr; }
MEDCouplingAutoRefCountObjectPtr &operator=(const MEDCouplingAutoRefCountObjectPtr& other) { if(_ptr!=other._ptr) { destroyPtr(); referPtr(other._ptr); } return *this; }
MEDCouplingAutoRefCountObjectPtr &operator=(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; }
T *operator->() { return _ptr ; }
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingCMesh.hxx"
if(deepCpy)
{
if(other._x_array)
- _x_array=_x_array->deepCpy();
+ _x_array=other._x_array->deepCpy();
+ else
+ _x_array=0;
if(other._y_array)
- _y_array=_y_array->deepCpy();
+ _y_array=other._y_array->deepCpy();
+ else
+ _y_array=0;
if(other._z_array)
- _z_array=_z_array->deepCpy();
+ _z_array=other._z_array->deepCpy();
+ else
+ _z_array=0;
}
else
{
return new MEDCouplingCMesh(*this,recDeepCpy);
}
-void MEDCouplingCMesh::updateTime()
+void MEDCouplingCMesh::updateTime() const
{
if(_x_array)
updateTimeWith(*_x_array);
}
}
+void MEDCouplingCMesh::checkCoherency1(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency();
+ if(_x_array)
+ _x_array->checkMonotonic(eps);
+ if(_y_array)
+ _y_array->checkMonotonic(eps);
+ if(_z_array)
+ _z_array->checkMonotonic(eps);
+}
+
+void MEDCouplingCMesh::checkCoherency2(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency1(eps);
+}
+
int MEDCouplingCMesh::getNumberOfCells() const
{
int ret=1;
}
}
+std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingCMesh::getAllGeoTypes() const
+{
+ INTERP_KERNEL::NormalizedCellType ret;
+ switch(getMeshDimension())
+ {
+ case 3:
+ ret=INTERP_KERNEL::NORM_HEXA8;
+ case 2:
+ ret=INTERP_KERNEL::NORM_QUAD4;
+ case 1:
+ ret=INTERP_KERNEL::NORM_SEG2;
+ default:
+ throw INTERP_KERNEL::Exception("Unexpected dimension for MEDCouplingCMesh::getAllGeoTypes !");
+ }
+ std::set<INTERP_KERNEL::NormalizedCellType> ret2;
+ ret2.insert(ret);
+ return ret2;
+}
+
int MEDCouplingCMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
int ret=getNumberOfCells();
{
std::ostringstream ret;
ret << "Cartesian mesh with name : \"" << getName() << "\"\n";
+ ret << "Description of mesh : \"" << getDescription() << "\"\n";
+ int tmpp1,tmpp2;
+ double tt=getTime(tmpp1,tmpp2);
+ ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
+ ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Mesh and SpaceDimension dimension : " << getSpaceDimension() << "\n\nArrays :\n________\n\n";
if(_x_array)
{
return simpleRepr();
}
-DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) const throw(INTERP_KERNEL::Exception)
+const DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) const throw(INTERP_KERNEL::Exception)
{
switch(i)
{
}
}
-void MEDCouplingCMesh::setCoordsAt(int i, DataArrayDouble *arr) throw(INTERP_KERNEL::Exception)
+DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
+{
+ switch(i)
+ {
+ case 0:
+ return _x_array;
+ case 1:
+ return _y_array;
+ case 2:
+ return _z_array;
+ default:
+ throw INTERP_KERNEL::Exception("Invalid rank specified must be 0 or 1 or 2.");
+ }
+}
+
+void MEDCouplingCMesh::setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception)
{
DataArrayDouble **thisArr[3]={&_x_array,&_y_array,&_z_array};
if(i<0 || i>2)
{
if(*(thisArr[i]))
(*(thisArr[i]))->decrRef();
- (*(thisArr[i]))=arr;
+ (*(thisArr[i]))=const_cast<DataArrayDouble *>(arr);
if(*(thisArr[i]))
(*(thisArr[i]))->incrRef();
declareAsNew();
}
}
-void MEDCouplingCMesh::setCoords(DataArrayDouble *coordsX, DataArrayDouble *coordsY, DataArrayDouble *coordsZ)
+void MEDCouplingCMesh::setCoords(const DataArrayDouble *coordsX, const DataArrayDouble *coordsY, const DataArrayDouble *coordsZ)
{
if(_x_array)
_x_array->decrRef();
- _x_array=coordsX;
+ _x_array=const_cast<DataArrayDouble *>(coordsX);
if(_x_array)
_x_array->incrRef();
if(_y_array)
_y_array->decrRef();
- _y_array=coordsY;
+ _y_array=const_cast<DataArrayDouble *>(coordsY);
if(_y_array)
_y_array->incrRef();
if(_z_array)
_z_array->decrRef();
- _z_array=coordsZ;
+ _z_array=const_cast<DataArrayDouble *>(coordsZ);
if(_z_array)
_z_array->incrRef();
declareAsNew();
}
+/*!
+ * See MEDCouplingUMesh::checkTypeConsistencyAndContig for more information
+ */
+DataArrayInt *MEDCouplingCMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+{
+ int sz=code.size();
+ if(sz!=0 && sz!=3)
+ throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkTypeConsistencyAndContig : code should be of size 2 exactly !");
+ if(code[0]==INTERP_KERNEL::NORM_ERROR)
+ {
+ int nbNodes=getNumberOfNodes();
+ if(code[2]==-1)
+ {
+ if(code[1]==nbNodes)
+ return 0;
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkTypeConsistencyAndContig : number of nodes mismatch !");
+ }
+ else
+ idsPerType[code[2]]->deepCpy();
+ }
+ else
+ {
+ int nbCells=getNumberOfCellsWithType((INTERP_KERNEL::NormalizedCellType)code[0]);
+ if(code[2]==-1)
+ {
+ if(code[1]==nbCells)
+ return 0;
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkTypeConsistencyAndContig : number of cells mismatch !");
+ }
+ else
+ idsPerType[code[2]]->deepCpy();
+ }
+ return 0;
+}
+
+/*!
+ * See MEDCouplingUMesh::splitProfilePerType for more information
+ */
+void MEDCouplingCMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+{
+ int nbCells=getNumberOfCells();
+ code.resize(3);
+ code[0]=(int)getTypeOfCell(0);
+ code[1]=nbCells;
+ code[2]=0;
+ idsInPflPerType.push_back(profile->deepCpy());
+ idsPerType.push_back(profile->deepCpy());
+}
+
MEDCouplingUMesh *MEDCouplingCMesh::buildUnstructured() const throw(INTERP_KERNEL::Exception)
{
int spaceDim=getSpaceDimension();
int j=0;
for (int idim=0; idim<dim; idim++)
{
- DataArrayDouble *c=getCoordsAt(idim);
+ const DataArrayDouble *c=getCoordsAt(idim);
if(c)
{
const double *coords=c->getConstPointer();
double *pt=ret->getPointer();
int tmp[3];
getSplitNodeValues(tmp);
- DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
+ const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
const double *tabsPtr[3];
for(int j=0;j<spaceDim;j++)
- tabsPtr[j]=tabs[j]->getConstPointer();
+ {
+ tabsPtr[j]=tabs[j]->getConstPointer();
+ ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0).c_str());
+ }
int tmp2[3];
for(int i=0;i<nbNodes;i++)
{
double *pt=ret->getPointer();
int tmp[3];
getSplitCellValues(tmp);
- DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
+ const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
std::vector<double> tabsPtr[3];
for(int j=0;j<spaceDim;j++)
{
int sz=tabs[j]->getNbOfElems()-1;
+ ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0).c_str());
const double *srcPtr=tabs[j]->getConstPointer();
tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz);
std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),srcPtr+1,tabsPtr[j].begin(),std::plus<double>());
connI->decrRef();
}
-void MEDCouplingCMesh::getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingCMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
{
+ int it,order;
+ double time=getTime(it,order);
tinyInfo.clear();
+ tinyInfoD.clear();
littleStrings.clear();
littleStrings.push_back(getName());
+ littleStrings.push_back(getDescription());
+ littleStrings.push_back(getTimeUnit());
const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array};
for(int i=0;i<3;i++)
{
tinyInfo.push_back(val);
littleStrings.push_back(st);
}
+ tinyInfo.push_back(it);
+ tinyInfo.push_back(order);
+ tinyInfoD.push_back(time);
}
void MEDCouplingCMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
a2Ptr=std::copy(thisArr[i]->getConstPointer(),thisArr[i]->getConstPointer()+thisArr[i]->getNumberOfTuples(),a2Ptr);
}
-void MEDCouplingCMesh::unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+void MEDCouplingCMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
setName(littleStrings[0].c_str());
+ setDescription(littleStrings[1].c_str());
+ setTimeUnit(littleStrings[2].c_str());
DataArrayDouble **thisArr[3]={&_x_array,&_y_array,&_z_array};
const double *data=a2->getConstPointer();
for(int i=0;i<3;i++)
{
(*(thisArr[i]))=DataArrayDouble::New();
(*(thisArr[i]))->alloc(tinyInfo[i],1);
- (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+1].c_str());
+ (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+3].c_str());
std::copy(data,data+tinyInfo[i],(*(thisArr[i]))->getPointer());
data+=tinyInfo[i];
}
}
+ setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGCMESH_HXX__
static MEDCouplingCMesh *New();
MEDCouplingMesh *deepCpy() const;
MEDCouplingCMesh *clone(bool recDeepCpy) const;
- void updateTime();
+ void updateTime() const;
MEDCouplingMeshType getType() const { return CARTESIAN; }
void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
bool isEqual(const MEDCouplingMesh *other, double prec) const;
void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception);
void checkCoherency() const throw(INTERP_KERNEL::Exception);
+ void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
+ void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
int getNumberOfCells() const;
int getNumberOfNodes() const;
int getSpaceDimension() const;
int getNodeIdFromPos(int i, int j, int k) const;
static void GetPosFromId(int nodeId, int spaceDim, const int *split, int *res);
INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
+ std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
std::string simpleRepr() const;
std::string advancedRepr() const;
- DataArrayDouble *getCoordsAt(int i) const throw(INTERP_KERNEL::Exception);
- void setCoordsAt(int i, DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
- void setCoords(DataArrayDouble *coordsX,
- DataArrayDouble *coordsY=0,
- DataArrayDouble *coordsZ=0);
+ const DataArrayDouble *getCoordsAt(int i) const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception);
+ void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
+ void setCoords(const DataArrayDouble *coordsX,
+ const DataArrayDouble *coordsY=0,
+ const DataArrayDouble *coordsZ=0);
// tools
+ DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
+ void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
MEDCouplingMesh *buildPart(const int *start, const int *end) const;
MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const;
void getSplitCellValues(int *res) const;
void getSplitNodeValues(int *res) const;
//serialisation-unserialization
- void getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- void unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
private:
MEDCouplingCMesh();
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "MEDCouplingDefinitionTime.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+
+#include <cmath>
+
+using namespace ParaMEDMEM;
+
+const double MEDCouplingDefinitionTime::EPS_DFT=1e-15;
+
+MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(const MEDCouplingFieldDouble *f, int meshId, const std::vector<int>& arrId, int fieldId) throw(INTERP_KERNEL::Exception)
+{
+ static const char msg[]="TimeSlice::New : mismatch of arrays number of a fieldDouble and its policy !!! Internal error !!!";
+ if(!f)
+ throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSlice::New : empty field !");
+ switch(f->getTimeDiscretization())
+ {
+ case ONE_TIME:
+ {
+ if(arrId.size()!=1)
+ throw INTERP_KERNEL::Exception(msg);
+ return new MEDCouplingDefinitionTimeSliceInst(f,meshId,arrId[0],fieldId);
+ }
+ case CONST_ON_TIME_INTERVAL:
+ {
+ if(arrId.size()!=1)
+ throw INTERP_KERNEL::Exception(msg);
+ return new MEDCouplingDefinitionTimeSliceCstOnTI(f,meshId,arrId[0],fieldId);
+ }
+ case LINEAR_TIME:
+ {
+ if(arrId.size()!=2)
+ throw INTERP_KERNEL::Exception(msg);
+ return new MEDCouplingDefinitionTimeSliceLT(f,meshId,arrId[0],arrId[1],fieldId);
+ }
+ case NO_TIME:
+ throw INTERP_KERNEL::Exception("Invalide time discretization ! NO_TIME ! Impossible to build a definition time slice !");
+ default:
+ throw INTERP_KERNEL::Exception("Invalide time discretization : Not recognized !");
+ }
+}
+
+MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSlice::New(TypeOfTimeDiscretization type, const std::vector<int>& tiI, const std::vector<double>& tiD) throw(INTERP_KERNEL::Exception)
+{
+ switch(type)
+ {
+ case ONE_TIME:
+ return MEDCouplingDefinitionTimeSliceInst::New(tiI,tiD);
+ case CONST_ON_TIME_INTERVAL:
+ return MEDCouplingDefinitionTimeSliceCstOnTI::New(tiI,tiD);
+ case LINEAR_TIME:
+ return MEDCouplingDefinitionTimeSliceLT::New(tiI,tiD);
+ default:
+ throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSlice::New : unrecognized time discretization type !");
+ }
+}
+
+bool MEDCouplingDefinitionTimeSlice::isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const
+{
+ if(_mesh_id!=other._mesh_id)
+ return false;
+ if(_array_id!=other._array_id)
+ return false;
+ if(_field_id!=other._field_id)
+ return false;
+ return true;
+}
+
+int MEDCouplingDefinitionTimeSlice::getStartId() const
+{
+ return _array_id;
+}
+
+int MEDCouplingDefinitionTimeSlice::getEndId() const
+{
+ return _array_id;
+}
+
+void MEDCouplingDefinitionTimeSlice::appendRepr(std::ostream& stream) const
+{
+ stream << " *** MeshId : " << _mesh_id << " ArrayId : " << _array_id;
+}
+
+MEDCouplingDefinitionTimeSlice::MEDCouplingDefinitionTimeSlice(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId) throw(INTERP_KERNEL::Exception):_mesh_id(meshId),_array_id(arrId),_field_id(fieldId)
+{
+ int tmp1,tmp2;
+ double t1=f->getStartTime(tmp1,tmp2);
+ double t2=f->getEndTime(tmp1,tmp2);
+ if(t2<t1)
+ throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSlice : End time strictly before Start time ...");
+}
+
+bool MEDCouplingDefinitionTimeSlice::isFullyIncludedInMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const
+{
+ double t1=getStartTime();
+ double t2=getEndTime();
+ double o1=other->getStartTime();
+ double o2=other->getEndTime();
+ return o1>t1-eps && o2<t2+eps;
+}
+
+bool MEDCouplingDefinitionTimeSlice::isOverllapingWithMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const
+{
+ double t1=getStartTime();
+ double t2=getEndTime();
+ double o1=other->getStartTime();
+ double o2=other->getEndTime();
+ return (o1<t1+eps && o2<t1+eps) || (o1>t2-eps && o2>t2-eps);
+}
+
+bool MEDCouplingDefinitionTimeSlice::isAfterMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const
+{
+ double t2=getEndTime();
+ double o1=other->getStartTime();
+ double o2=other->getEndTime();
+ return (o1>t2-eps && o2>t2-eps);
+}
+
+bool MEDCouplingDefinitionTimeSlice::isBeforeMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const
+{
+ double t1=getStartTime();
+ double o1=other->getStartTime();
+ double o2=other->getEndTime();
+ return (o1<t1+eps && o2<t1+eps);
+}
+
+MEDCouplingDefinitionTimeSliceInst *MEDCouplingDefinitionTimeSliceInst::New(const std::vector<int>& tiI, const std::vector<double>& tiD)
+{
+ MEDCouplingDefinitionTimeSliceInst *ret=new MEDCouplingDefinitionTimeSliceInst;
+ ret->unserialize(tiI,tiD);
+ return ret;
+}
+
+void MEDCouplingDefinitionTimeSliceInst::getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const
+{
+ tiI.resize(3);
+ tiI[0]=_mesh_id; tiI[1]=_array_id; tiI[2]=_field_id;
+ tiD.resize(1);
+ tiD[0]=_instant;
+}
+
+void MEDCouplingDefinitionTimeSliceInst::unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD)
+{
+ _mesh_id=tiI[0]; _array_id=tiI[1]; _field_id=tiI[2];
+ _instant=tiD[0];
+}
+
+TypeOfTimeDiscretization MEDCouplingDefinitionTimeSliceInst::getTimeType() const
+{
+ return ONE_TIME;
+}
+
+MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSliceInst::copy() const
+{
+ return new MEDCouplingDefinitionTimeSliceInst(*this);
+}
+
+bool MEDCouplingDefinitionTimeSliceInst::isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const
+{
+ if(!MEDCouplingDefinitionTimeSlice::isEqual(other,eps))
+ return false;
+ const MEDCouplingDefinitionTimeSliceInst *otherC=dynamic_cast<const MEDCouplingDefinitionTimeSliceInst *>(&other);
+ if(!otherC)
+ return false;
+ return fabs(otherC->_instant-_instant)<eps;
+}
+
+void MEDCouplingDefinitionTimeSliceInst::getHotSpotsTime(std::vector<double>& ret) const
+{
+ ret.resize(1);
+ ret[0]=_instant;
+}
+
+void MEDCouplingDefinitionTimeSliceInst::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception)
+{
+ meshId=_mesh_id;
+ arrId=_array_id;
+ arrIdInField=0;
+ fieldId=_field_id;
+}
+
+bool MEDCouplingDefinitionTimeSliceInst::isContaining(double tmp, double eps) const
+{
+ return fabs(tmp-_instant)<eps;
+}
+
+void MEDCouplingDefinitionTimeSliceInst::appendRepr(std::ostream& stream) const
+{
+ stream << "single point " << _instant;
+ MEDCouplingDefinitionTimeSlice::appendRepr(stream);
+}
+
+double MEDCouplingDefinitionTimeSliceInst::getStartTime() const
+{
+ return _instant;
+}
+
+double MEDCouplingDefinitionTimeSliceInst::getEndTime() const
+{
+ return _instant;
+}
+
+MEDCouplingDefinitionTimeSliceInst::MEDCouplingDefinitionTimeSliceInst(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId) throw(INTERP_KERNEL::Exception):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId)
+{
+ int tmp1,tmp2;
+ double t1=f->getStartTime(tmp1,tmp2);
+ double t2=f->getEndTime(tmp1,tmp2);
+ double eps=f->getTimeTolerance();
+ if(fabs(t1-t2)>eps)
+ throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTimeSliceInst : times differs in this");
+ _instant=t1;
+}
+
+MEDCouplingDefinitionTimeSliceCstOnTI *MEDCouplingDefinitionTimeSliceCstOnTI::New(const std::vector<int>& tiI, const std::vector<double>& tiD)
+{
+ MEDCouplingDefinitionTimeSliceCstOnTI *ret=new MEDCouplingDefinitionTimeSliceCstOnTI;
+ ret->unserialize(tiI,tiD);
+ return ret;
+}
+
+MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSliceCstOnTI::copy() const
+{
+ return new MEDCouplingDefinitionTimeSliceCstOnTI(*this);
+}
+
+bool MEDCouplingDefinitionTimeSliceCstOnTI::isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const
+{
+ if(!MEDCouplingDefinitionTimeSlice::isEqual(other,eps))
+ return false;
+ const MEDCouplingDefinitionTimeSliceCstOnTI *otherC=dynamic_cast<const MEDCouplingDefinitionTimeSliceCstOnTI *>(&other);
+ if(!otherC)
+ return false;
+ if(fabs(otherC->_start-_start)>eps)
+ return false;
+ return fabs(otherC->_end-_end)<eps;
+}
+
+void MEDCouplingDefinitionTimeSliceCstOnTI::getHotSpotsTime(std::vector<double>& ret) const
+{
+ ret.resize(1);
+ ret[0]=(_start+_end)/2.;
+}
+
+void MEDCouplingDefinitionTimeSliceCstOnTI::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception)
+{
+ meshId=_mesh_id;
+ arrId=_array_id;
+ arrIdInField=0;
+ fieldId=_field_id;
+}
+
+bool MEDCouplingDefinitionTimeSliceCstOnTI::isContaining(double tmp, double eps) const
+{
+ return _start-eps<tmp && _end+eps>tmp;
+}
+
+void MEDCouplingDefinitionTimeSliceCstOnTI::appendRepr(std::ostream& stream) const
+{
+ stream << "Constant on time interval [" << _start << "," << _end << "]";
+ MEDCouplingDefinitionTimeSlice::appendRepr(stream);
+}
+
+double MEDCouplingDefinitionTimeSliceCstOnTI::getStartTime() const
+{
+ return _start;
+}
+
+double MEDCouplingDefinitionTimeSliceCstOnTI::getEndTime() const
+{
+ return _end;
+}
+
+void MEDCouplingDefinitionTimeSliceCstOnTI::getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const
+{
+ tiI.resize(3);
+ tiI[0]=_mesh_id; tiI[1]=_array_id; tiI[2]=_field_id;
+ tiD.resize(2);
+ tiD[0]=_start; tiD[1]=_end;
+}
+
+void MEDCouplingDefinitionTimeSliceCstOnTI::unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD)
+{
+ _mesh_id=tiI[0]; _array_id=tiI[1]; _field_id=tiI[2];
+ _start=tiD[0]; _end=tiD[1];
+}
+
+TypeOfTimeDiscretization MEDCouplingDefinitionTimeSliceCstOnTI::getTimeType() const
+{
+ return CONST_ON_TIME_INTERVAL;
+}
+
+MEDCouplingDefinitionTimeSliceCstOnTI::MEDCouplingDefinitionTimeSliceCstOnTI(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId) throw(INTERP_KERNEL::Exception):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId)
+{
+ int tmp1,tmp2;
+ double t1=f->getStartTime(tmp1,tmp2);
+ double t2=f->getEndTime(tmp1,tmp2);
+ _start=t1;
+ _end=t2;
+}
+
+MEDCouplingDefinitionTimeSliceLT *MEDCouplingDefinitionTimeSliceLT::New(const std::vector<int>& tiI, const std::vector<double>& tiD)
+{
+ MEDCouplingDefinitionTimeSliceLT *ret=new MEDCouplingDefinitionTimeSliceLT;
+ ret->unserialize(tiI,tiD);
+ return ret;
+}
+
+MEDCouplingDefinitionTimeSlice *MEDCouplingDefinitionTimeSliceLT::copy() const
+{
+ return new MEDCouplingDefinitionTimeSliceLT(*this);
+}
+
+bool MEDCouplingDefinitionTimeSliceLT::isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const
+{
+ if(!MEDCouplingDefinitionTimeSlice::isEqual(other,eps))
+ return false;
+ const MEDCouplingDefinitionTimeSliceLT *otherC=dynamic_cast<const MEDCouplingDefinitionTimeSliceLT *>(&other);
+ if(!otherC)
+ return false;
+ if(_array_id_end!=otherC->_array_id_end)
+ return false;
+ if(fabs(otherC->_start-_start)>eps)
+ return false;
+ return fabs(otherC->_end-_end)<eps;
+}
+
+void MEDCouplingDefinitionTimeSliceLT::getHotSpotsTime(std::vector<double>& ret) const
+{
+ ret.resize(2);
+ ret[0]=_start;
+ ret[1]=_end;
+}
+
+void MEDCouplingDefinitionTimeSliceLT::getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception)
+{
+ if(fabs(tm-_start)<eps)
+ {
+ meshId=_mesh_id;
+ arrId=_array_id;
+ arrIdInField=0;
+ fieldId=_field_id;
+ return ;
+ }
+ if(fabs(tm-_end)<eps)
+ {
+ meshId=_mesh_id;
+ arrId=_array_id_end;
+ arrIdInField=1;
+ fieldId=_field_id;
+ return ;
+ }
+ throw INTERP_KERNEL::Exception("LinearTime request not in boundary of this ! use hot spots !");
+}
+
+bool MEDCouplingDefinitionTimeSliceLT::isContaining(double tmp, double eps) const
+{
+ return _start-eps<tmp && _end+eps>tmp;
+}
+
+void MEDCouplingDefinitionTimeSliceLT::appendRepr(std::ostream& stream) const
+{
+ stream << "Linear on time interval [" << _start << "," << _end << "]";
+ MEDCouplingDefinitionTimeSlice::appendRepr(stream);
+ stream << " EndArrayId : " << _array_id_end;
+}
+
+double MEDCouplingDefinitionTimeSliceLT::getStartTime() const
+{
+ return _start;
+}
+
+double MEDCouplingDefinitionTimeSliceLT::getEndTime() const
+{
+ return _end;
+}
+
+int MEDCouplingDefinitionTimeSliceLT::getEndId() const
+{
+ return _array_id_end;
+}
+
+void MEDCouplingDefinitionTimeSliceLT::getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const
+{
+ tiI.resize(4);
+ tiI[0]=_mesh_id; tiI[1]=_array_id; tiI[2]=_field_id; tiI[3]=_array_id_end;
+ tiD.resize(2);
+ tiD[0]=_start; tiD[1]=_end;
+}
+
+void MEDCouplingDefinitionTimeSliceLT::unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD)
+{
+ _mesh_id=tiI[0]; _array_id=tiI[1]; _field_id=tiI[2]; _array_id_end=tiI[3];
+ _start=tiD[0]; _end=tiD[1];
+}
+
+TypeOfTimeDiscretization MEDCouplingDefinitionTimeSliceLT::getTimeType() const
+{
+ return LINEAR_TIME;
+}
+
+MEDCouplingDefinitionTimeSliceLT::MEDCouplingDefinitionTimeSliceLT(const MEDCouplingFieldDouble *f, int meshId, int arrId, int arr2Id, int fieldId) throw(INTERP_KERNEL::Exception):MEDCouplingDefinitionTimeSlice(f,meshId,arrId,fieldId),_array_id_end(arr2Id)
+{
+ int tmp1,tmp2;
+ double t1=f->getStartTime(tmp1,tmp2);
+ double t2=f->getEndTime(tmp1,tmp2);
+ _start=t1;
+ _end=t2;
+}
+
+MEDCouplingDefinitionTime::MEDCouplingDefinitionTime():_eps(EPS_DFT)
+{
+}
+
+MEDCouplingDefinitionTime::MEDCouplingDefinitionTime(const std::vector<const MEDCouplingFieldDouble *>& fs, const std::vector<int>& meshRefs, const std::vector<std::vector<int> >& arrRefs) throw(INTERP_KERNEL::Exception)
+{
+ std::size_t sz=fs.size();
+ if(sz!=arrRefs.size())
+ throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime constructor : internal error ! should never happen !");
+ _slices.resize(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ if(arrRefs.empty())
+ throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime constructor : A field is null in list impossible to build a time definition !");
+ _slices[i]=MEDCouplingDefinitionTimeSlice::New(fs[i],meshRefs[i],arrRefs[i],i);
+ }
+ if(sz<=1)
+ return ;
+ const MEDCouplingDefinitionTimeSlice *ref=_slices[0];
+ _eps=fs[0]->getTimeTolerance();
+ for(std::size_t i=1;i<sz;i++)
+ {
+ if(!ref->isAfterMe(_slices[i],_eps))
+ throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime constructors : the sequences of fields does NOT defines a stricly ascendant monotonic time sequence !");
+ // double t1=ref->getEndTime();
+ // double t2=_slices[i]->getStartTime();
+ // if(fabs(t1-t2)<_eps)
+ // if(ref->getEndId() != _slices[i]->getStartId())
+ // throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime constructor : 2 slices refers to the same time and underlying arrays differs !");
+ ref=_slices[i];
+ }
+}
+
+void MEDCouplingDefinitionTime::assign(const MEDCouplingDefinitionTime& other)
+{
+ std::size_t sz=other._slices.size();
+ _slices.resize(sz);
+ for(std::size_t i=0;i<sz;i++)
+ _slices[i]=other._slices[i]->copy();
+}
+
+bool MEDCouplingDefinitionTime::isEqual(const MEDCouplingDefinitionTime& other) const
+{
+ std::size_t sz=_slices.size();
+ if(sz!=other._slices.size())
+ return false;
+ for(std::size_t i=0;i<sz;i++)
+ if(!_slices[i]->isEqual(*other._slices[i],_eps))
+ return false;
+ return true;
+}
+
+void MEDCouplingDefinitionTime::getIdsOnTimeRight(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception)
+{
+ std::vector<int> meshIds;
+ std::vector<int> arrIds;
+ std::vector<int> arrIdsInField;
+ std::vector<int> fieldIds;
+ getIdsOnTime(tm,meshIds,arrIds,arrIdsInField,fieldIds);
+ meshId=meshIds.back();
+ arrId=arrIds.back();
+ arrIdInField=arrIdsInField.back();
+ fieldId=fieldIds.back();
+}
+
+void MEDCouplingDefinitionTime::getIdsOnTimeLeft(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception)
+{
+ std::vector<int> meshIds;
+ std::vector<int> arrIds;
+ std::vector<int> arrIdsInField;
+ std::vector<int> fieldIds;
+ getIdsOnTime(tm,meshIds,arrIds,arrIdsInField,fieldIds);
+ meshId=meshIds.front();
+ arrId=arrIds.front();
+ arrIdInField=arrIdsInField.front();
+ fieldId=fieldIds.front();
+}
+
+void MEDCouplingDefinitionTime::getIdsOnTime(double tm, std::vector<int>& meshIds, std::vector<int>& arrIds, std::vector<int>& arrIdsInField, std::vector<int>& fieldIds) const throw(INTERP_KERNEL::Exception)
+{
+ std::vector<int> ids;
+ int id=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++,id++)
+ if((*it)->isContaining(tm,_eps))
+ ids.push_back(id);
+ if(ids.empty())
+ throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime::getIdsOnTime : No matching slice for such time !");
+ int sz=ids.size();
+ if(sz>2)
+ throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime::getIdsOnTime : Too many slices match this time !");
+ //
+ meshIds.resize(sz);
+ arrIds.resize(sz);
+ arrIdsInField.resize(sz);
+ fieldIds.resize(sz);
+ for(int i=0;i<sz;i++)
+ _slices[ids[i]]->getIdsOnTime(tm,_eps,meshIds[i],arrIds[i],arrIdsInField[i],fieldIds[i]);
+}
+
+std::vector<double> MEDCouplingDefinitionTime::getHotSpotsTime() const
+{
+ std::vector<double> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++)
+ {
+ std::vector<double> tmp;
+ (*it)->getHotSpotsTime(tmp);
+ if(!ret.empty())
+ {
+ if(fabs(ret.back()-tmp.front())>_eps)
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ else
+ ret.insert(ret.end(),tmp.begin()+1,tmp.end());
+ }
+ else
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+void MEDCouplingDefinitionTime::appendRepr(std::ostream& stream) const
+{
+ stream << "Time definition :\n";
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingDefinitionTimeSlice> >::const_iterator it=_slices.begin();it!=_slices.end();it++)
+ {
+ stream << " - ";
+ (*it)->appendRepr(stream);
+ stream << std::endl;
+ }
+}
+
+void MEDCouplingDefinitionTime::getTinySerializationInformation(std::vector<int>& tinyInfoI, std::vector<double>& tinyInfoD) const
+{
+ int sz=_slices.size();
+ tinyInfoD.resize(1);
+ tinyInfoD[0]=_eps;
+ tinyInfoI.resize(3*sz+2);
+ tinyInfoI[0]=sz;
+ std::vector<int> coreData;
+ for(int i=0;i<sz;i++)
+ {
+ std::vector<int> tmp1;
+ std::vector<double> tmp2;
+ tinyInfoI[i+2]=(int)_slices[i]->getTimeType();
+ _slices[i]->getTinySerializationInformation(tmp1,tmp2);
+ tinyInfoI[i+sz+2]=tmp1.size();
+ tinyInfoI[i+2*sz+2]=tmp2.size();
+ coreData.insert(coreData.end(),tmp1.begin(),tmp1.end());
+ tinyInfoD.insert(tinyInfoD.end(),tmp2.begin(),tmp2.end());
+ }
+ tinyInfoI[1]=coreData.size();
+ tinyInfoI.insert(tinyInfoI.end(),coreData.begin(),coreData.end());
+}
+
+void MEDCouplingDefinitionTime::unserialize(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+{
+ int sz=tinyInfoI[0];
+ _slices.resize(sz);
+ _eps=tinyInfoD[0];
+ int offset1=0;
+ int offset2=1;
+ for(int i=0;i<sz;i++)
+ {
+ TypeOfTimeDiscretization ty=(TypeOfTimeDiscretization) tinyInfoI[i+2];
+ int sz1=tinyInfoI[i+sz+2];
+ int sz2=tinyInfoI[i+2*sz+2];
+ std::vector<int> tmp1(tinyInfoI.begin()+3*sz+2+offset1,tinyInfoI.begin()+3*sz+2+offset1+sz1);
+ std::vector<double> tmp2(tinyInfoD.begin()+offset2,tinyInfoD.begin()+offset2+sz2);
+ MEDCouplingDefinitionTimeSlice *pt=MEDCouplingDefinitionTimeSlice::New(ty,tmp1,tmp2);
+ _slices[i]=pt;
+ offset1+=sz1;
+ offset2+=sz2;
+ }
+}
+
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#ifndef __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__
+#define __PARAMEDMEM_MEDCOUPLINGDEFINITIONTIME_HXX__
+
+#include "MEDCouplingRefCountObject.hxx"
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+
+#include "InterpKernelException.hxx"
+
+#include <vector>
+#include <sstream>
+
+namespace ParaMEDMEM
+{
+ class MEDCouplingFieldDouble;
+
+ class MEDCouplingDefinitionTimeSlice : public RefCountObject
+ {
+ public:
+ static MEDCouplingDefinitionTimeSlice *New(const MEDCouplingFieldDouble *f, int meshId, const std::vector<int>& arrId, int fieldId) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingDefinitionTimeSlice *New(TypeOfTimeDiscretization type, const std::vector<int>& tiI, const std::vector<double>& tiD) throw(INTERP_KERNEL::Exception);
+ int getArrayId() const { return _array_id; }
+ virtual MEDCouplingDefinitionTimeSlice *copy() const = 0;
+ virtual bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
+ virtual void getHotSpotsTime(std::vector<double>& ret) const = 0;
+ virtual void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception) = 0;
+ virtual bool isContaining(double tmp, double eps) const = 0;
+ virtual int getStartId() const;
+ virtual int getEndId() const;
+ virtual void appendRepr(std::ostream& stream) const;
+ virtual double getStartTime() const = 0;
+ virtual double getEndTime() const = 0;
+ virtual void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const = 0;
+ virtual TypeOfTimeDiscretization getTimeType() const = 0;
+ bool isFullyIncludedInMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
+ bool isOverllapingWithMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
+ bool isAfterMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
+ bool isBeforeMe(const MEDCouplingDefinitionTimeSlice *other, double eps) const;
+ protected:
+ MEDCouplingDefinitionTimeSlice() { }
+ MEDCouplingDefinitionTimeSlice(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId) throw(INTERP_KERNEL::Exception);
+ protected:
+ int _mesh_id;
+ int _array_id;
+ int _field_id;
+ };
+
+ class MEDCouplingDefinitionTimeSliceInst : public MEDCouplingDefinitionTimeSlice
+ {
+ public:
+ static MEDCouplingDefinitionTimeSliceInst *New(const std::vector<int>& tiI, const std::vector<double>& tiD);
+ MEDCouplingDefinitionTimeSlice *copy() const;
+ bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
+ void getHotSpotsTime(std::vector<double>& ret) const;
+ void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception);
+ bool isContaining(double tmp, double eps) const;
+ void appendRepr(std::ostream& stream) const;
+ double getStartTime() const;
+ double getEndTime() const;
+ void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const;
+ void unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD);
+ TypeOfTimeDiscretization getTimeType() const;
+ public:
+ MEDCouplingDefinitionTimeSliceInst(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId) throw(INTERP_KERNEL::Exception);
+ protected:
+ MEDCouplingDefinitionTimeSliceInst() { }
+ protected:
+ double _instant;
+ };
+
+ class MEDCouplingDefinitionTimeSliceCstOnTI : public MEDCouplingDefinitionTimeSlice
+ {
+ public:
+ static MEDCouplingDefinitionTimeSliceCstOnTI *New(const std::vector<int>& tiI, const std::vector<double>& tiD);
+ MEDCouplingDefinitionTimeSlice *copy() const;
+ bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
+ void getHotSpotsTime(std::vector<double>& ret) const;
+ void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception);
+ bool isContaining(double tmp, double eps) const;
+ void appendRepr(std::ostream& stream) const;
+ double getStartTime() const;
+ double getEndTime() const;
+ void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const;
+ void unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD);
+ TypeOfTimeDiscretization getTimeType() const;
+ public:
+ MEDCouplingDefinitionTimeSliceCstOnTI(const MEDCouplingFieldDouble *f, int meshId, int arrId, int fieldId) throw(INTERP_KERNEL::Exception);
+ protected:
+ MEDCouplingDefinitionTimeSliceCstOnTI() { }
+ protected:
+ double _start;
+ double _end;
+ };
+
+ class MEDCouplingDefinitionTimeSliceLT : public MEDCouplingDefinitionTimeSlice
+ {
+ public:
+ static MEDCouplingDefinitionTimeSliceLT *New(const std::vector<int>& tiI, const std::vector<double>& tiD);
+ MEDCouplingDefinitionTimeSlice *copy() const;
+ bool isEqual(const MEDCouplingDefinitionTimeSlice& other, double eps) const;
+ void getHotSpotsTime(std::vector<double>& ret) const;
+ void getIdsOnTime(double tm, double eps, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception);
+ bool isContaining(double tmp, double eps) const;
+ void appendRepr(std::ostream& stream) const;
+ double getStartTime() const;
+ double getEndTime() const;
+ int getEndId() const;
+ void getTinySerializationInformation(std::vector<int>& tiI, std::vector<double>& tiD) const;
+ void unserialize(const std::vector<int>& tiI, const std::vector<double>& tiD);
+ TypeOfTimeDiscretization getTimeType() const;
+ public:
+ MEDCouplingDefinitionTimeSliceLT(const MEDCouplingFieldDouble *f, int meshId, int arrId, int arr2Id, int fieldId) throw(INTERP_KERNEL::Exception);
+ protected:
+ MEDCouplingDefinitionTimeSliceLT() { }
+ protected:
+ int _array_id_end;
+ double _start;
+ double _end;
+ };
+
+ class MEDCouplingDefinitionTime
+ {
+ public:
+ MEDCouplingDefinitionTime();
+ MEDCouplingDefinitionTime(const std::vector<const MEDCouplingFieldDouble *>& fs, const std::vector<int>& meshRefs, const std::vector<std::vector<int> >& arrRefs) throw(INTERP_KERNEL::Exception);
+ void assign(const MEDCouplingDefinitionTime& other);
+ bool isEqual(const MEDCouplingDefinitionTime& other) const;
+ double getTimeResolution() const { return _eps; }
+ void getIdsOnTimeRight(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception);
+ void getIdsOnTimeLeft(double tm, int& meshId, int& arrId, int& arrIdInField, int& fieldId) const throw(INTERP_KERNEL::Exception);
+ void getIdsOnTime(double tm, std::vector<int>& meshIds, std::vector<int>& arrIds, std::vector<int>& arrIdsInField, std::vector<int>& fieldIds) const throw(INTERP_KERNEL::Exception);
+ std::vector<double> getHotSpotsTime() const;
+ void appendRepr(std::ostream& stream) const;
+ public:
+ void getTinySerializationInformation(std::vector<int>& tinyInfoI, std::vector<double>& tinyInfoD) const;
+ void unserialize(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
+ private:
+ double _eps;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingDefinitionTimeSlice> > _slices;
+ static const double EPS_DFT;
+ };
+}
+
+#endif
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingExtrudedMesh.hxx"
int nbOfCells2D=_mesh2D->getNumberOfCells();
int locId=std::distance(ids,where)%nbOfCells2D;
INTERP_KERNEL::NormalizedCellType tmp=_mesh2D->getTypeOfCell(locId);
- return INTERP_KERNEL::CellModel::getCellModel(tmp).getExtrudedType();
+ return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType();
+}
+
+std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingExtrudedMesh::getAllGeoTypes() const
+{
+ const std::set<INTERP_KERNEL::NormalizedCellType>& ret2D=_mesh2D->getAllTypes();
+ std::set<INTERP_KERNEL::NormalizedCellType> ret;
+ for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=ret2D.begin();it!=ret2D.end();it++)
+ ret.insert(INTERP_KERNEL::CellModel::GetCellModel(*it).getExtrudedType());
+ return ret;
}
int MEDCouplingExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
for(int i=0;i<nbOfCells2D;i++)
{
INTERP_KERNEL::NormalizedCellType t=_mesh2D->getTypeOfCell(i);
- if(INTERP_KERNEL::CellModel::getCellModel(t).getExtrudedType()==type)
+ if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type)
ret++;
}
return ret*_mesh1D->getNumberOfCells();
{
std::ostringstream ret;
ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n";
+ ret << "Description of mesh : \"" << getDescription() << "\"\n";
+ int tmpp1,tmpp2;
+ double tt=getTime(tmpp1,tmpp2);
+ ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
+ ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n";
ret << "Number of cells : " << getNumberOfCells() << "(" << _mesh2D->getNumberOfCells() << "x" << _mesh1D->getNumberOfCells() << ")\n";
ret << "1D Mesh info : _____________________\n\n\n";
{
std::ostringstream ret;
ret << "3D Extruded mesh from a 2D Surf Mesh with name : \"" << getName() << "\"\n";
+ ret << "Description of mesh : \"" << getDescription() << "\"\n";
+ int tmpp1,tmpp2;
+ double tt=getTime(tmpp1,tmpp2);
+ ret << "Time attached to the mesh (unit) : " << tt << " (" << getTimeUnit() << ")\n";
+ ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Cell id where 1D mesh has been deduced : " << _cell_2D_id << "\n";
ret << "Number of cells : " << getNumberOfCells() << "(" << _mesh2D->getNumberOfCells() << "x" << _mesh1D->getNumberOfCells() << ")\n";
ret << "1D Mesh info : _____________________\n\n\n";
{
}
+void MEDCouplingExtrudedMesh::checkCoherency1(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency();
+}
+
+void MEDCouplingExtrudedMesh::checkCoherency2(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency1(eps);
+}
+
void MEDCouplingExtrudedMesh::getBoundingBox(double *bbox) const
{
double bbox2D[6];
bbox[2*id+1]+=tmp[id];
}
-void MEDCouplingExtrudedMesh::updateTime()
+void MEDCouplingExtrudedMesh::updateTime() const
{
if(_mesh2D)
{
int MEDCouplingExtrudedMesh::getCellContainingPoint(const double *pos, double eps) const
{
- //not implemented yet
- return -1;
+ throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::getCellContainingPoint : not implemented yet !");
}
MEDCouplingExtrudedMesh::~MEDCouplingExtrudedMesh()
_mesh1D->scale(point,factor);
}
+DataArrayInt *MEDCouplingExtrudedMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
+}
+
+void MEDCouplingExtrudedMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
+}
+
MEDCouplingMesh *MEDCouplingExtrudedMesh::buildPart(const int *start, const int *end) const
{
// not implemented yet !
revDescIndx->decrRef();
}
-void MEDCouplingExtrudedMesh::getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingExtrudedMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
{
std::vector<int> tinyInfo1;
std::vector<std::string> ls1;
- _mesh2D->getTinySerializationInformation(tinyInfo1,ls1);
+ std::vector<double> ls3;
+ _mesh2D->getTinySerializationInformation(ls3,tinyInfo1,ls1);
std::vector<int> tinyInfo2;
std::vector<std::string> ls2;
- _mesh1D->getTinySerializationInformation(tinyInfo2,ls2);
+ std::vector<double> ls4;
+ _mesh1D->getTinySerializationInformation(ls4,tinyInfo2,ls2);
tinyInfo.clear(); littleStrings.clear();
tinyInfo.insert(tinyInfo.end(),tinyInfo1.begin(),tinyInfo1.end());
littleStrings.insert(littleStrings.end(),ls1.begin(),ls1.end());
tinyInfo.push_back(tinyInfo1.size());
tinyInfo.push_back(_mesh3D_ids->getNbOfElems());
littleStrings.push_back(getName());
+ littleStrings.push_back(getDescription());
}
void MEDCouplingExtrudedMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
//
a1->alloc(la1+tinyInfo[sz-1],1);
a2->alloc(la2,1);
- littleStrings.resize(ls1.size()+ls2.size()+1);
+ littleStrings.resize(ls1.size()+ls2.size()+2);
}
void MEDCouplingExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
a2_2->decrRef();
}
-void MEDCouplingExtrudedMesh::unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
+void MEDCouplingExtrudedMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
- setName(littleStrings.back().c_str());
+ setName(littleStrings[littleStrings.size()-2].c_str());
+ setDescription(littleStrings.back().c_str());
int sz=tinyInfo.size();
int sz1=tinyInfo[sz-2];
_cell_2D_id=tinyInfo[sz-3];
a2Ptr+=a2tmp->getNbOfElems();
a1Ptr+=a1tmp->getNbOfElems();
ls2.insert(ls2.end(),littleStrings.begin(),littleStrings.begin()+ls1.size());
- _mesh2D->unserialization(ti1,a1tmp,a2tmp,ls2);
+ std::vector<double> d1(1);
+ _mesh2D->unserialization(d1,ti1,a1tmp,a2tmp,ls2);
a1tmp->decrRef(); a2tmp->decrRef();
//
ls2.clear();
- ls2.insert(ls2.end(),littleStrings.begin()+ls1.size(),littleStrings.end()-1);
+ ls2.insert(ls2.end(),littleStrings.begin()+ls1.size(),littleStrings.end()-2);
_mesh1D=MEDCouplingUMesh::New();
a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New();
_mesh1D->resizeForUnserialization(ti2,a1tmp,a2tmp,ls1);
std::copy(a2Ptr,a2Ptr+a2tmp->getNbOfElems(),a2tmp->getPointer());
std::copy(a1Ptr,a1Ptr+a1tmp->getNbOfElems(),a1tmp->getPointer());
a1Ptr+=a1tmp->getNbOfElems();
- _mesh1D->unserialization(ti2,a1tmp,a2tmp,ls2);
+ _mesh1D->unserialization(d1,ti2,a1tmp,a2tmp,ls2);
a1tmp->decrRef(); a2tmp->decrRef();
//
_mesh3D_ids=DataArrayInt::New();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGEXTRUDEDMESH_HXX__
void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception);
INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
+ std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
std::string simpleRepr() const;
std::string advancedRepr() const;
void checkCoherency() const throw (INTERP_KERNEL::Exception);
+ void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
+ void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
void getBoundingBox(double *bbox) const;
- void updateTime();
+ void updateTime() const;
void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *getMesh2D() const { return _mesh2D; }
MEDCouplingUMesh *getMesh1D() const { return _mesh1D; }
void rotate(const double *center, const double *vector, double angle);
void translate(const double *vector);
void scale(const double *point, double factor);
+ DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
+ void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
MEDCouplingMesh *buildPart(const int *start, const int *end) const;
MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const;
DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
DataArrayDouble *getCoordinatesAndOwner() const;
DataArrayDouble *getBarycenterAndOwner() const;
//Serialization unserialisation
- void getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- void unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
private:
MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingField.hxx"
return false;
if(_desc!=other->_desc)
return false;
+ if(_nature!=other->_nature)
+ return false;
if(!_type->isEqual(other->_type,valsPrec))
return false;
if(_mesh==0 && other->_mesh==0)
{
if(!_type->isEqualWithoutConsideringStr(other->_type,valsPrec))
return false;
+ if(_nature!=other->_nature)
+ return false;
if(_mesh==0 && other->_mesh==0)
return true;
if(_mesh==0 || other->_mesh==0)
{
if(!_type->isEqual(other->_type,1.))
return false;
+ if(_nature!=other->_nature)
+ return false;
if(_mesh==other->_mesh)
return true;
return _mesh->areCompatibleForMerge(other->_mesh);
{
if(!_type->isEqual(other->_type,1.e-12))
return false;
+ if(_nature!=other->_nature)
+ return false;
return _mesh==other->_mesh;
}
-void MEDCouplingField::updateTime()
+void MEDCouplingField::updateTime() const
{
if(_mesh)
updateTimeWith(*_mesh);
return _type->getEnum();
}
+void MEDCouplingField::setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception)
+{
+ _nature=nat;
+}
+
+/*!
+ * This method returns is case of success an instance of DataArrayDouble the user is in reponsability to deal with.
+ * If 'this->_mesh' is not set an exception will be thrown.
+ * For a field on node the array of coords will be returned. For a field on cell a ParaMEDMEM::DataArrayDouble instance
+ * containing the barycenter of cells will be returned. And for a field on gauss point the explicit position of gauss points.
+ */
+DataArrayDouble *MEDCouplingField::getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception)
+{
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingField::getLocalizationOfDiscr : No mesh set !");
+ return _type->getLocalizationOfDiscValues(_mesh);
+}
+
/*!
* This method retrieves the measure field of 'this'. If no '_mesh' is defined an exception will be thrown.
* Warning the retrieved field life cycle is the responsability of caller.
delete _type;
}
-MEDCouplingField::MEDCouplingField(MEDCouplingFieldDiscretization *type):_mesh(0),_type(type)
+MEDCouplingField::MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature):_nature(nature),_mesh(0),_type(type)
{
}
-MEDCouplingField::MEDCouplingField(TypeOfField type):_mesh(0),_type(MEDCouplingFieldDiscretization::New(type))
+MEDCouplingField::MEDCouplingField(TypeOfField type):_nature(NoNature),_mesh(0),_type(MEDCouplingFieldDiscretization::New(type))
{
}
-MEDCouplingField::MEDCouplingField(const MEDCouplingField& other):_name(other._name),_desc(other._desc),
+MEDCouplingField::MEDCouplingField(const MEDCouplingField& other):_name(other._name),_desc(other._desc),_nature(other._nature),
_mesh(0),_type(other._type->clone())
{
if(other._mesh)
{
return _type->buildSubMeshData(_mesh,start,end,di);
}
+
+/*!
+ * This method returns number of tuples expected regarding its discretization and its _mesh attribute.
+ * This method expected a not null _mesh instance. If null, an exception will be thrown.
+ */
+int MEDCouplingField::getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception)
+{
+ if(_mesh)
+ return _type->getNumberOfTuples(_mesh);
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfTuplesExpected : Empty mesh !");
+}
+
+/*!
+ * This method returns number of mesh placed expected regarding its discretization and its _mesh attribute.
+ * This method expected a not null _mesh instance. If null, an exception will be thrown.
+ */
+int MEDCouplingField::getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception)
+{
+ if(_mesh)
+ return _type->getNumberOfMeshPlaces(_mesh);
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfMeshPlacesExpected : Empty mesh !");
+}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGFIELD_HXX__
#include "MEDCoupling.hxx"
#include "MEDCouplingTimeLabel.hxx"
+#include "MEDCouplingNatureOfField.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpKernelException.hxx"
namespace ParaMEDMEM
{
class DataArrayInt;
+ class DataArrayDouble;
class MEDCouplingMesh;
class MEDCouplingFieldDouble;
class MEDCouplingFieldDiscretization;
void setDescription(const char *desc) { _desc=desc; }
const char *getName() const { return _name.c_str(); }
TypeOfField getTypeOfField() const;
+ NatureOfField getNature() const { return _nature; }
+ virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
MEDCouplingMesh *buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const;
MEDCouplingFieldDiscretization *getDiscretization() const { return _type; }
+ int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
// Gauss point specific methods
void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
void getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const throw(INTERP_KERNEL::Exception);
const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
protected:
- void updateTime();
+ void updateTime() const;
protected:
MEDCouplingField(TypeOfField type);
MEDCouplingField(const MEDCouplingField& other);
- MEDCouplingField(MEDCouplingFieldDiscretization *type);
+ MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature=NoNature);
virtual ~MEDCouplingField();
protected:
std::string _name;
std::string _desc;
+ NatureOfField _nature;
const MEDCouplingMesh *_mesh;
MEDCouplingFieldDiscretization *_type;
};
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingFieldDiscretization.hxx"
#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "CellModel.hxx"
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "CellModel.hxx"
#include "InterpolationUtils.hxx"
+#include "InterpKernelAutoPtr.hxx"
+#include "InterpKernelGaussCoords.hxx"
#include <set>
+#include <list>
#include <limits>
#include <algorithm>
#include <functional>
const TypeOfField MEDCouplingFieldDiscretizationP1::TYPE=ON_NODES;
+const int MEDCouplingFieldDiscretizationPerCell::DFT_INVALID_LOCID_VALUE=-1;
+
const char MEDCouplingFieldDiscretizationGauss::REPR[]="GAUSS";
const TypeOfField MEDCouplingFieldDiscretizationGauss::TYPE=ON_GAUSS_PT;
/*!
* Excepted for MEDCouplingFieldDiscretizationPerCell no underlying TimeLabel object : nothing to do in generally.
*/
-void MEDCouplingFieldDiscretization::updateTime()
+void MEDCouplingFieldDiscretization::updateTime() const
{
}
throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
}
-void MEDCouplingFieldDiscretization::renumberEntitiesFromO2NArr(const int *old2NewPtr, DataArrayDouble *arr, const char *msg)
+void MEDCouplingFieldDiscretization::renumberEntitiesFromO2NArr(double eps, const int *old2NewPtr, DataArrayDouble *arr, const char *msg)
{
int oldNbOfElems=arr->getNumberOfTuples();
int nbOfComp=arr->getNumberOfComponents();
arr->reAlloc(newNbOfTuples);
double *ptToFill=arr->getPointer();
std::fill(ptToFill,ptToFill+nbOfComp*newNbOfTuples,std::numeric_limits<double>::max());
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfComp];
for(int i=0;i<oldNbOfElems;i++)
{
int newNb=old2NewPtr[i];
std::copy(ptSrc+i*nbOfComp,ptSrc+(i+1)*nbOfComp,ptToFill+newNb*nbOfComp);
else
{
- if(!std::equal(ptSrc+i*nbOfComp,ptSrc+(i+1)*nbOfComp,ptToFill+newNb*nbOfComp))
+ std::transform(ptSrc+i*nbOfComp,ptSrc+(i+1)*nbOfComp,ptToFill+newNb*nbOfComp,(double *)tmp,std::minus<double>());
+ std::transform((double *)tmp,((double *)tmp)+nbOfComp,(double *)tmp,std::ptr_fun<double,double>(fabs));
+ //if(!std::equal(ptSrc+i*nbOfComp,ptSrc+(i+1)*nbOfComp,ptToFill+newNb*nbOfComp))
+ if(*std::max_element((double *)tmp,((double *)tmp)+nbOfComp)>eps)
{
arrCpy->decrRef();
std::ostringstream oss;
return mesh->getNumberOfCells();
}
+int MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
+{
+ return mesh->getNumberOfCells();
+}
+
+DataArrayInt *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplingMesh *mesh) const
+{
+ int nbOfTuples=mesh->getNumberOfCells();
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(nbOfTuples+1,1);
+ ret->iota(0);
+ return ret;
+}
+
void MEDCouplingFieldDiscretizationP0::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
{
arr->getTuple(id,res);
}
+DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
+{
+ std::vector<int> elts,eltsIndex;
+ mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,elts,eltsIndex);
+ int spaceDim=mesh->getSpaceDimension();
+ int nbOfComponents=arr->getNumberOfComponents();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ ret->alloc(nbOfPoints,nbOfComponents);
+ double *ptToFill=ret->getPointer();
+ for(int i=0;i<nbOfPoints;i++,ptToFill+=nbOfComponents)
+ if(eltsIndex[i+1]-eltsIndex[i]>=1)
+ arr->getTuple(elts[eltsIndex[i]],ptToFill);
+ else
+ {
+ std::ostringstream oss; oss << "Point #" << i << " with coordinates : (";
+ std::copy(loc+i*spaceDim,loc+(i+1)*spaceDim,std::ostream_iterator<double>(oss,", "));
+ oss << ") detected outside mesh : unable to apply P0::getValueOnMulti ! ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ ret->incrRef();
+ return ret;
+}
+
/*!
* Nothing to do. It's not a bug.
*/
-void MEDCouplingFieldDiscretizationP0::renumberValuesOnNodes(const int *, DataArrayDouble *) const
+void MEDCouplingFieldDiscretizationP0::renumberValuesOnNodes(double , const int *, DataArrayDouble *) const
{
}
-void MEDCouplingFieldDiscretizationP0::renumberValuesOnCells(const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationP0::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const
{
- renumberEntitiesFromO2NArr(old2New,arr,"Cell");
+ renumberEntitiesFromO2NArr(epsOnVals,old2New,arr,"Cell");
}
void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const
return mesh->getNumberOfNodes();
}
+int MEDCouplingFieldDiscretizationP1::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
+{
+ return mesh->getNumberOfNodes();
+}
+
+DataArrayInt *MEDCouplingFieldDiscretizationP1::getOffsetArr(const MEDCouplingMesh *mesh) const
+{
+ int nbOfTuples=mesh->getNumberOfNodes();
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(nbOfTuples+1,1);
+ ret->iota(0);
+ return ret;
+}
+
DataArrayDouble *MEDCouplingFieldDiscretizationP1::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
{
return mesh->getCoordinatesAndOwner();
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(id);
if(type!=INTERP_KERNEL::NORM_SEG2 && type!=INTERP_KERNEL::NORM_TRI3 && type!=INTERP_KERNEL::NORM_TETRA4)
throw INTERP_KERNEL::Exception("P1 getValueOn is not specified for not simplex cells !");
+ getValueInCell(mesh,id,arr,loc,res);
+}
+
+/*!
+ * This method localizes a point defined by 'loc' in a cell with id 'cellId' into mesh 'mesh'.
+ * The result is put into res expected to be of size at least arr->getNumberOfComponents()
+ */
+void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mesh, int cellId, const DataArrayDouble *arr, const double *loc, double *res) const
+{
std::vector<int> conn;
std::vector<double> coo;
- mesh->getNodeIdsOfCell(id,conn);
+ mesh->getNodeIdsOfCell(cellId,conn);
for(std::vector<int>::const_iterator iter=conn.begin();iter!=conn.end();iter++)
mesh->getCoordinatesOfNode(*iter,coo);
int spaceDim=mesh->getSpaceDimension();
std::vector<const double *> vec(nbOfNodes);
for(int i=0;i<nbOfNodes;i++)
vec[i]=&coo[i*spaceDim];
- double *tmp=new double[nbOfNodes];
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfNodes];
INTERP_KERNEL::barycentric_coords(vec,loc,tmp);
int sz=arr->getNumberOfComponents();
- double *tmp2=new double[sz];
+ INTERP_KERNEL::AutoPtr<double> tmp2=new double[sz];
std::fill(res,res+sz,0.);
for(int i=0;i<nbOfNodes;i++)
{
- arr->getTuple(conn[i],tmp2);
- std::transform(tmp2,tmp2+sz,tmp2,std::bind2nd(std::multiplies<double>(),tmp[i]));
- std::transform(res,res+sz,tmp2,res,std::plus<double>());
+ arr->getTuple(conn[i],(double *)tmp2);
+ std::transform((double *)tmp2,((double *)tmp2)+sz,(double *)tmp2,std::bind2nd(std::multiplies<double>(),tmp[i]));
+ std::transform(res,res+sz,(double *)tmp2,res,std::plus<double>());
}
- delete [] tmp;
- delete [] tmp2;
}
void MEDCouplingFieldDiscretizationP1::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const
arr->getTuple(id,res);
}
-void MEDCouplingFieldDiscretizationP1::renumberValuesOnNodes(const int *old2NewPtr, DataArrayDouble *arr) const
+DataArrayDouble *MEDCouplingFieldDiscretizationP1::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
+{
+ std::vector<int> elts,eltsIndex;
+ mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,elts,eltsIndex);
+ int spaceDim=mesh->getSpaceDimension();
+ int nbOfComponents=arr->getNumberOfComponents();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ ret->alloc(nbOfPoints,nbOfComponents);
+ double *ptToFill=ret->getPointer();
+ for(int i=0;i<nbOfPoints;i++)
+ if(eltsIndex[i+1]-eltsIndex[i]>=1)
+ getValueInCell(mesh,elts[eltsIndex[i]],arr,loc+i*spaceDim,ptToFill+i*nbOfComponents);
+ else
+ {
+ std::ostringstream oss; oss << "Point #" << i << " with coordinates : (";
+ std::copy(loc+i*spaceDim,loc+(i+1)*spaceDim,std::ostream_iterator<double>(oss,", "));
+ oss << ") detected outside mesh : unable to apply P1::getValueOnMulti ! ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ ret->incrRef();
+ return ret;
+}
+
+void MEDCouplingFieldDiscretizationP1::renumberValuesOnNodes(double epsOnVals, const int *old2NewPtr, DataArrayDouble *arr) const
{
- renumberEntitiesFromO2NArr(old2NewPtr,arr,"Node");
+ renumberEntitiesFromO2NArr(epsOnVals,old2NewPtr,arr,"Node");
}
/*!
* Nothing to do it's not a bug.
*/
-void MEDCouplingFieldDiscretizationP1::renumberValuesOnCells(const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationP1::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const
{
}
_discr_per_cell=arr->deepCpy();
}
-void MEDCouplingFieldDiscretizationPerCell::updateTime()
+void MEDCouplingFieldDiscretizationPerCell::updateTime() const
{
if(_discr_per_cell)
updateTimeWith(*_discr_per_cell);
int nbTuples=m->getNumberOfCells();
_discr_per_cell->alloc(nbTuples,1);
int *ptr=_discr_per_cell->getPointer();
- std::fill(ptr,ptr+nbTuples,-1);
+ std::fill(ptr,ptr+nbTuples,DFT_INVALID_LOCID_VALUE);
}
}
+void MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells() const throw(INTERP_KERNEL::Exception)
+{
+ if(!_discr_per_cell)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : no discretization defined !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> test=_discr_per_cell->getIdsEqual(DFT_INVALID_LOCID_VALUE);
+ if(test->getNumberOfTuples()!=0)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : presence of orphan cells !");
+}
+
+const DataArrayInt *MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds() const
+{
+ return _discr_per_cell;
+}
+
MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss()
{
}
return ret;
}
+int MEDCouplingFieldDiscretizationGauss::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
+{
+ return mesh->getNumberOfCells();
+}
+
+DataArrayInt *MEDCouplingFieldDiscretizationGauss::getOffsetArr(const MEDCouplingMesh *mesh) const
+{
+ int nbOfTuples=mesh->getNumberOfCells();
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(nbOfTuples+1,1);
+ int *retPtr=ret->getPointer();
+ const int *start=_discr_per_cell->getConstPointer();
+ retPtr[0]=0;
+ for(int i=0;i<nbOfTuples;i++,start++)
+ retPtr[i+1]=retPtr[i]+_loc[*start].getNumberOfGaussPt();
+ return ret;
+}
+
void MEDCouplingFieldDiscretizationGauss::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
{
DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
{
- throw INTERP_KERNEL::Exception("Not implemented yet !");
+ checkNoOrphanCells();
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
+ int nbOfTuples=getNumberOfTuples(mesh);
+ DataArrayDouble *ret=DataArrayDouble::New();
+ int spaceDim=mesh->getSpaceDimension();
+ ret->alloc(nbOfTuples,spaceDim);
+ std::vector< std::vector<int> > locIds;
+ std::vector<DataArrayInt *> parts=splitIntoSingleGaussDicrPerCellType(locIds);
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > parts2(parts.size());
+ std::copy(parts.begin(),parts.end(),parts2.begin());
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> offsets=buildNbOfGaussPointPerCellField();
+ offsets->computeOffsets();
+ const int *ptrOffsets=offsets->getConstPointer();
+ const double *coords=umesh->getCoords()->getConstPointer();
+ const int *connI=umesh->getNodalConnectivityIndex()->getConstPointer();
+ const int *conn=umesh->getNodalConnectivity()->getConstPointer();
+ double *valsToFill=ret->getPointer();
+ for(std::size_t i=0;i<parts2.size();i++)
+ {
+ INTERP_KERNEL::GaussCoords calculator;
+ for(std::vector<int>::const_iterator it=locIds[i].begin();it!=locIds[i].end();it++)
+ {
+ const MEDCouplingGaussLocalization& cli=_loc[*it];//curLocInfo
+ INTERP_KERNEL::NormalizedCellType typ=cli.getType();
+ const std::vector<double>& wg=cli.getWeights();
+ calculator.addGaussInfo(typ,INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension(),
+ &cli.getGaussCoords()[0],wg.size(),&cli.getRefCoords()[0],
+ INTERP_KERNEL::CellModel::GetCellModel(typ).getNumberOfNodes());
+ }
+ int nbt=parts2[i]->getNumberOfTuples();
+ for(const int *w=parts2[i]->getConstPointer();w!=parts2[i]->getConstPointer()+nbt;w++)
+ {
+ const MEDCouplingGaussLocalization& cli=_loc[*w];
+ calculator.calculateCoords(cli.getType(),coords,spaceDim,conn+connI[*w]+1,valsToFill+spaceDim*(ptrOffsets[*w]));
+ }
+ }
+ ret->copyStringInfoFrom(*umesh->getCoords());
+ return ret;
}
void MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *partBg, const int *partEnd,
for(int i=0;i<nbOfLoc;i++)
{
std::vector<int> tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta);
- MEDCouplingGaussLocalization elt=MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo(dim,tmp);
+ MEDCouplingGaussLocalization elt=MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(dim,tmp);
_loc.push_back(elt);
}
}
throw INTERP_KERNEL::Exception("getValueOnPos(i,j,k) : Not applyable for Gauss points !");
}
+DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
+{
+ throw INTERP_KERNEL::Exception("getValueOnMulti : Not implemented yet for gauss points !");
+}
+
MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
/*!
* No implementation needed !
*/
-void MEDCouplingFieldDiscretizationGauss::renumberValuesOnNodes(const int *, DataArrayDouble *) const
+void MEDCouplingFieldDiscretizationGauss::renumberValuesOnNodes(double , const int *, DataArrayDouble *) const
{
}
-void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCells(const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
{
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
+ if((int)cm.getDimension()!=m->getMeshDimension())
+ {
+ std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType : mismatch of dimensions ! MeshDim==" << m->getMeshDimension();
+ oss << " whereas Type '" << cm.getRepr() << "' has dimension " << cm.getDimension() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
buildDiscrPerCellIfNecessary(m);
int id=_loc.size();
MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg);
return ret;
}
+/*!
+ * This method do the assumption that there is no orphan cell. If there is an exception is thrown.
+ * This method makes the assumption too that '_discr_per_cell' is defined. If not an exception is thrown.
+ * This method returns a newly created array with number of tuples equals to '_discr_per_cell->getNumberOfTuples' and number of components equal to 1.
+ * The i_th tuple in returned array is the number of gauss point if the corresponding cell.
+ */
+DataArrayInt *MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField() const throw(INTERP_KERNEL::Exception)
+{
+ if(!_discr_per_cell)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField : no discretization array set !");
+ int nbOfTuples=_discr_per_cell->getNumberOfTuples();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ const int *w=_discr_per_cell->getConstPointer();
+ ret->alloc(nbOfTuples,1);
+ int *valsToFill=ret->getPointer();
+ for(int i=0;i<nbOfTuples;i++,w++)
+ if(*w!=DFT_INVALID_LOCID_VALUE)
+ valsToFill[i]=_loc[*w].getNumberOfGaussPt();
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField : orphan cell detected !");
+ ret->incrRef();
+ return ret;
+}
+
/*!
* This method makes the assumption that _discr_per_cell is set.
* This method reduces as much as possible number size of _loc.
_loc=tmpLoc;
}
+/*!
+ * This method is usefull when 'this' describes a field discretization with several gauss discretization on a \b same cell type.
+ * For example same NORM_TRI3 cells having 6 gauss points and others with 12 gauss points.
+ * This method returns 2 arrays with same size : the return value and 'locIds' output parameter.
+ * For a given i into [0,locIds.size) ret[i] represents the set of cell ids of i_th set an locIds[i] represents the set of discretisation of the set.
+ * The return vector contains a set of newly created instance to deal with.
+ * The returned vector represents a \b partition of cells ids with a gauss discretization set.
+ *
+ * If no descretization is set in 'this' and exception will be thrown.
+ */
+std::vector<DataArrayInt *> MEDCouplingFieldDiscretizationGauss::splitIntoSingleGaussDicrPerCellType(std::vector< std::vector<int> >& locIds) const throw(INTERP_KERNEL::Exception)
+{
+ if(!_discr_per_cell)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::splitIntoSingleGaussDicrPerCellType : no descretization set !");
+ locIds.clear();
+ std::vector<DataArrayInt *> ret;
+ const int *discrPerCell=_discr_per_cell->getConstPointer();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=_discr_per_cell->getIdsNotEqual(-1);
+ int nbOfTuplesSet=ret2->getNumberOfTuples();
+ std::list<int> idsRemaining(ret2->getConstPointer(),ret2->getConstPointer()+nbOfTuplesSet);
+ std::list<int>::iterator it=idsRemaining.begin();
+ while(it!=idsRemaining.end())
+ {
+ std::vector<int> ids;
+ std::set<int> curLocIds;
+ std::set<INTERP_KERNEL::NormalizedCellType> curCellTypes;
+ while(it!=idsRemaining.end())
+ {
+ int curDiscrId=discrPerCell[*it];
+ INTERP_KERNEL::NormalizedCellType typ=_loc[curDiscrId].getType();
+ if(curCellTypes.find(typ)!=curCellTypes.end())
+ {
+ if(curLocIds.find(curDiscrId)!=curLocIds.end())
+ {
+ curLocIds.insert(curDiscrId);
+ curCellTypes.insert(typ);
+ ids.push_back(*it);
+ it=idsRemaining.erase(it);
+ }
+ else
+ it++;
+ }
+ else
+ {
+ curLocIds.insert(curDiscrId);
+ curCellTypes.insert(typ);
+ ids.push_back(*it);
+ it=idsRemaining.erase(it);
+ }
+ }
+ it=idsRemaining.begin();
+ ret.resize(ret.size()+1);
+ DataArrayInt *part=DataArrayInt::New();
+ part->alloc(ids.size(),1);
+ std::copy(ids.begin(),ids.end(),part->getPointer());
+ ret.back()=part;
+ locIds.resize(locIds.size()+1);
+ locIds.back().insert(locIds.back().end(),curLocIds.begin(),curLocIds.end());
+ }
+ return ret;
+}
+
MEDCouplingFieldDiscretizationGaussNE::MEDCouplingFieldDiscretizationGaussNE()
{
}
for(int i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(cm.isDynamic())
throw INTERP_KERNEL::Exception("Not implemented yet Gauss node on elements for polygons and polyedrons !");
ret+=cm.getNumberOfNodes();
return ret;
}
+int MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
+{
+ return mesh->getNumberOfCells();
+}
+
+DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCouplingMesh *mesh) const
+{
+ int nbOfTuples=mesh->getNumberOfCells();
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(nbOfTuples+1,1);
+ int *retPtr=ret->getPointer();
+ retPtr[0]=0;
+ for(int i=0;i<nbOfTuples;i++)
+ {
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
+ if(cm.isDynamic())
+ throw INTERP_KERNEL::Exception("Not implemented yet Gauss node on elements for polygons and polyedrons !");
+ retPtr[i+1]=retPtr[i]+cm.getNumberOfNodes();
+ }
+ return ret;
+}
+
void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
{
for(int i=1;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(std::distance(array,std::find(array,array+nbOfCells,i-1)));
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
array3[i]=array3[i-1]+cm.getNumberOfNodes();
}
int j=0;
for(int i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
for(int k=0;k<(int)cm.getNumberOfNodes();k++,j++)
array2[j]=array3[array[i]]+k;
}
for(int i=0;i<cellId;i++)
{
INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(i);
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
offset+=cm.getNumberOfNodes();
}
return da->getIJ(offset+nodeIdInCell,compoId);
throw INTERP_KERNEL::Exception("getValueOnPos(i,j,k) : Not applyable for Gauss points !");
}
+DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
+{
+ throw INTERP_KERNEL::Exception("getValueOnMulti : Not implemented for Gauss NE !");
+}
+
MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
/*!
* No implementation needed !
*/
-void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnNodes(const int *, DataArrayDouble *) const
+void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnNodes(double , const int *, DataArrayDouble *) const
{
}
-void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCells(const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const
+void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const
{
throw INTERP_KERNEL::Exception("Not implemented yet !");
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGFIELDDISCRETIZATION_HXX__
static MEDCouplingFieldDiscretization *New(TypeOfField type);
double getPrecision() const { return _precision; }
void setPrecision(double val) { _precision=val; }
- void updateTime();
+ void updateTime() const;
static TypeOfField getTypeOfFieldFromStringRepr(const char *repr) throw(INTERP_KERNEL::Exception);
virtual TypeOfField getEnum() const = 0;
virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const = 0;
virtual MEDCouplingFieldDiscretization *clone() const = 0;
virtual const char *getStringRepr() const = 0;
virtual int getNumberOfTuples(const MEDCouplingMesh *mesh) const = 0;
+ virtual int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const = 0;
+ virtual DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const = 0;
virtual void normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const throw(INTERP_KERNEL::Exception);
virtual void normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const throw(INTERP_KERNEL::Exception);
virtual void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception);
virtual MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const = 0;
virtual void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const = 0;
virtual void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const = 0;
+ virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const = 0;
virtual MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const = 0;
- virtual void renumberValuesOnNodes(const int *old2New, DataArrayDouble *arr) const = 0;
- virtual void renumberValuesOnCells(const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const = 0;
+ virtual void renumberValuesOnNodes(double epsOnVals, const int *old2New, DataArrayDouble *arr) const = 0;
+ virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const = 0;
virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const = 0;
virtual void getSerializationIntArray(DataArrayInt *& arr) const;
virtual void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
virtual ~MEDCouplingFieldDiscretization();
protected:
MEDCouplingFieldDiscretization();
- static void renumberEntitiesFromO2NArr(const int *old2NewPtr, DataArrayDouble *arr, const char *msg);
+ static void renumberEntitiesFromO2NArr(double epsOnVals, const int *old2NewPtr, DataArrayDouble *arr, const char *msg);
static void renumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const char *msg);
protected:
double _precision;
const char *getStringRepr() const;
bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const;
int getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
- void renumberValuesOnNodes(const int *old2New, DataArrayDouble *arr) const;
- void renumberValuesOnCells(const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const;
+ DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
+ void renumberValuesOnNodes(double epsOnVals, const int *old2New, DataArrayDouble *arr) const;
+ void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const;
void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
public:
const char *getStringRepr() const;
bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const;
int getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
+ DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
- void renumberValuesOnNodes(const int *old2New, DataArrayDouble *arr) const;
- void renumberValuesOnCells(const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const;
+ void renumberValuesOnNodes(double epsOnVals, const int *old2New, DataArrayDouble *arr) const;
+ void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const;
void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
+ protected:
+ void getValueInCell(const MEDCouplingMesh *mesh, int cellId, const DataArrayDouble *arr, const double *loc, double *res) const;
public:
static const char REPR[];
static const TypeOfField TYPE;
*/
class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationPerCell : public MEDCouplingFieldDiscretization
{
+ public:
+ const DataArrayInt *getArrayOfDiscIds() const;
protected:
MEDCouplingFieldDiscretizationPerCell();
MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other);
~MEDCouplingFieldDiscretizationPerCell();
- void updateTime();
+ void updateTime() const;
void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception);
bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const;
bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
+ void checkNoOrphanCells() const throw(INTERP_KERNEL::Exception);
protected:
void buildDiscrPerCellIfNecessary(const MEDCouplingMesh *m);
protected:
DataArrayInt *_discr_per_cell;
+ static const int DFT_INVALID_LOCID_VALUE;
};
class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationGauss : public MEDCouplingFieldDiscretizationPerCell
MEDCouplingFieldDiscretization *clone() const;
const char *getStringRepr() const;
int getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
+ DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
- void renumberValuesOnNodes(const int *old2New, DataArrayDouble *arr) const;
- void renumberValuesOnCells(const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const;
+ void renumberValuesOnNodes(double epsOnVals, const int *old2New, DataArrayDouble *arr) const;
+ void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const;
void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
void setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
void getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const throw(INTERP_KERNEL::Exception);
const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
+ std::vector<DataArrayInt *> splitIntoSingleGaussDicrPerCellType(std::vector< std::vector<int> >& locIds) const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *buildNbOfGaussPointPerCellField() const throw(INTERP_KERNEL::Exception);
protected:
MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other);
void zipGaussLocalizations();
const char *getStringRepr() const;
bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const;
int getNumberOfTuples(const MEDCouplingMesh *mesh) const;
+ int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const;
+ DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const;
void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const;
void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const;
void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const;
+ DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const;
MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const;
- void renumberValuesOnNodes(const int *old2New, DataArrayDouble *arr) const;
- void renumberValuesOnCells(const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const;
+ void renumberValuesOnNodes(double epsOnVals, const int *old2New, DataArrayDouble *arr) const;
+ void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, DataArrayDouble *arr) const;
void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
protected:
MEDCouplingFieldDiscretizationGaussNE(const MEDCouplingFieldDiscretizationGaussNE& other);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingTimeDiscretization.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
return new MEDCouplingFieldDouble(type,td);
}
+MEDCouplingFieldDouble *MEDCouplingFieldDouble::New(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td)
+{
+ return new MEDCouplingFieldDouble(ft,td);
+}
+
+void MEDCouplingFieldDouble::setTimeUnit(const char *unit)
+{
+ _time_discr->setTimeUnit(unit);
+}
+
+const char *MEDCouplingFieldDouble::getTimeUnit() const
+{
+ return _time_discr->getTimeUnit();
+}
+
MEDCouplingFieldDouble *MEDCouplingFieldDouble::clone(bool recDeepCpy) const
{
return new MEDCouplingFieldDouble(*this,recDeepCpy);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const
{
- MEDCouplingTimeDiscretization *tdo=_time_discr->buildNewTimeReprFromThis(_time_discr,td,deepCpy);
+ MEDCouplingTimeDiscretization *tdo=_time_discr->buildNewTimeReprFromThis(td,deepCpy);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),tdo,_type->clone());
ret->setMesh(getMesh());
ret->setName(getName());
const MEDCouplingFieldDouble *otherC=dynamic_cast<const MEDCouplingFieldDouble *>(other);
if(!otherC)
return false;
- if(_nature!=otherC->_nature)
- return false;
if(!MEDCouplingField::isEqual(other,meshPrec,valsPrec))
return false;
if(!_time_discr->isEqual(otherC->_time_discr,valsPrec))
const MEDCouplingFieldDouble *otherC=dynamic_cast<const MEDCouplingFieldDouble *>(other);
if(!otherC)
return false;
- if(_nature!=otherC->_nature)
- return false;
if(!MEDCouplingField::isEqualWithoutConsideringStr(other,meshPrec,valsPrec))
return false;
if(!_time_discr->isEqualWithoutConsideringStr(otherC->_time_discr,valsPrec))
const MEDCouplingFieldDouble *otherC=dynamic_cast<const MEDCouplingFieldDouble *>(other);
if(!otherC)
return false;
- if(_nature!=otherC->_nature)
- return false;
if(!_time_discr->areCompatible(otherC->_time_discr))
return false;
return true;
const MEDCouplingFieldDouble *otherC=dynamic_cast<const MEDCouplingFieldDouble *>(other);
if(!otherC)
return false;
- if(_nature!=otherC->_nature)
- return false;
if(!_time_discr->areStrictlyCompatible(otherC->_time_discr))
return false;
return true;
const MEDCouplingFieldDouble *otherC=dynamic_cast<const MEDCouplingFieldDouble *>(other);
if(!otherC)
return false;
- if(_nature!=otherC->_nature)
- return false;
if(!_time_discr->areStrictlyCompatibleForMul(otherC->_time_discr))
return false;
return true;
}
+/*!
+ * Method with same principle than MEDCouplingFieldDouble::areStrictlyCompatible method except that
+ * number of components between 'this' and 'other' can be different here (for operator/).
+ */
+bool MEDCouplingFieldDouble::areCompatibleForDiv(const MEDCouplingField *other) const
+{
+ if(!MEDCouplingField::areStrictlyCompatible(other))
+ return false;
+ const MEDCouplingFieldDouble *otherC=dynamic_cast<const MEDCouplingFieldDouble *>(other);
+ if(!otherC)
+ return false;
+ if(!_time_discr->areStrictlyCompatibleForDiv(otherC->_time_discr))
+ return false;
+ return true;
+}
+
+/*!
+ * This method is invocated before any attempt of melding. This method is very close to areStrictlyCompatible,
+ * except that 'this' and other can have different number of components.
+ */
+bool MEDCouplingFieldDouble::areCompatibleForMeld(const MEDCouplingFieldDouble *other) const
+{
+ if(!MEDCouplingField::areStrictlyCompatible(other))
+ return false;
+ if(!_time_discr->areCompatibleForMeld(other->_time_discr))
+ return false;
+ return true;
+}
+
/*!
* Method with same principle than MEDCouplingFieldDouble::areStrictlyCompatible method except that
* number of components between 'this' and 'other' can be different here (for operator/).
* This method performs half job of MEDCouplingFieldDouble::renumberNodes. That is to say no permutation of cells is done on underlying mesh.
* That is to say, the field content is changed by this method.
*/
-void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const int *old2NewBg) throw(INTERP_KERNEL::Exception)
+void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const int *old2NewBg, double eps) throw(INTERP_KERNEL::Exception)
{
std::vector<DataArrayDouble *> arrays;
_time_discr->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
- _type->renumberValuesOnNodes(old2NewBg,*iter);
+ _type->renumberValuesOnNodes(eps,old2NewBg,*iter);
}
/*!
return _time_discr->getEnum();
}
-MEDCouplingFieldDouble::MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingField(type),_nature(NoNature),
+MEDCouplingFieldDouble::MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingField(type),
_time_discr(MEDCouplingTimeDiscretization::New(td))
{
}
-MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCpy):MEDCouplingField(other),_nature(other._nature),
+MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td):MEDCouplingField(*ft),
+ _time_discr(MEDCouplingTimeDiscretization::New(td))
+{
+}
+
+MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCpy):MEDCouplingField(other),
_time_discr(other._time_discr->performCpy(deepCpy))
{
}
-MEDCouplingFieldDouble::MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeDiscretization *td, MEDCouplingFieldDiscretization *type):MEDCouplingField(type),
- _nature(n),_time_discr(td)
+MEDCouplingFieldDouble::MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeDiscretization *td, MEDCouplingFieldDiscretization *type):MEDCouplingField(type,n),_time_discr(td)
{
}
void MEDCouplingFieldDouble::getValueOnPos(int i, int j, int k, double *res) const throw(INTERP_KERNEL::Exception)
{
const DataArrayDouble *arr=_time_discr->getArray();
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOnPos");
_type->getValueOnPos(arr,_mesh,i,j,k,res);
}
void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double *res) const throw(INTERP_KERNEL::Exception)
{
const DataArrayDouble *arr=_time_discr->getArray();
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOn");
_type->getValueOn(arr,_mesh,spaceLoc,res);
}
+/*!
+ * Returns a newly allocated array with 'nbOfPoints' tuples and nb of components equal to 'this->getNumberOfComponents()'.
+ */
+DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, int nbOfPoints) const throw(INTERP_KERNEL::Exception)
+{
+ const DataArrayDouble *arr=_time_discr->getArray();
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOnMulti");
+ return _type->getValueOnMulti(arr,_mesh,spaceLoc,nbOfPoints);
+}
+
/*!
* Returns value of 'this' on time 'time' of point 'spaceLoc' using spatial discretization.
* If 'time' is not covered by this->_time_discr an exception will be thrown.
void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, double *res) const throw(INTERP_KERNEL::Exception)
{
std::vector< const DataArrayDouble *> arrs=_time_discr->getArraysForTime(time);
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOn");
std::vector<double> res2;
for(std::vector< const DataArrayDouble *>::const_iterator iter=arrs.begin();iter!=arrs.end();iter++)
{
_time_discr->fillFromAnalytic(loc,nbOfComp,func);
}
+/*!
+ * This method is very similar to this one MEDCouplingMesh::fillFromAnalytic2.
+ * The main difference is that the field as been started to be constructed here.
+ * An exception is throw if no underlying mesh is set before the call of this method.
+ */
+void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception)
+{
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
+ _time_discr->fillFromAnalytic2(loc,nbOfComp,func);
+}
+
+/*!
+ * This method is very similar to this one MEDCouplingMesh::fillFromAnalytic3.
+ * The main difference is that the field as been started to be constructed here.
+ * An exception is throw if no underlying mesh is set before the call of this method.
+ */
+void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception)
+{
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
+ _time_discr->fillFromAnalytic3(loc,nbOfComp,varsOrder,func);
+}
+
/*!
* Applyies the function specified by pointer 'func' on each tuples on all arrays contained in _time_discr.
* If '*func' returns false during one evaluation an exception will be thrown.
* If '*func' fails in evaluation during one evaluation an exception will be thrown.
* The field will contain 'nbOfComp' components after the call.
*/
-void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func)
+void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception)
{
_time_discr->applyFunc(nbOfComp,func);
}
+/*!
+ * This method is equivalent to MEDCouplingFieldDouble::applyFunc, except that here components info are used to determine variables position in 'func'.
+ * If there is vars detected in 'func' that is not in an info on components an exception will be thrown.
+ */
+void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception)
+{
+ _time_discr->applyFunc2(nbOfComp,func);
+}
+
+/*!
+ * This method is equivalent to MEDCouplingFieldDouble::applyFunc, except that here 'varsOrder' is used to determine variables position in 'func'.
+ * If there is vars detected in 'func' that is not in 'varsOrder' an exception will be thrown.
+ */
+void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception)
+{
+ _time_discr->applyFunc3(nbOfComp,varsOrder,func);
+}
+
/*!
* Applyies the function specified by the string repr 'func' on each tuples on all arrays contained in _time_discr.
* If '*func' fails in evaluation during one evaluation an exception will be thrown.
* The field will contain exactly the same number of components after the call.
*/
-void MEDCouplingFieldDouble::applyFunc(const char *func)
+void MEDCouplingFieldDouble::applyFunc(const char *func) throw(INTERP_KERNEL::Exception)
{
_time_discr->applyFunc(func);
}
return getArray()->getNbOfElems();
}
-void MEDCouplingFieldDouble::updateTime()
+void MEDCouplingFieldDouble::updateTime() const
{
MEDCouplingField::updateTime();
updateTimeWith(*_time_discr);
void MEDCouplingFieldDouble::setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception)
{
+ MEDCouplingField::setNature(nat);
_type->checkCompatibilityWithNature(nat);
- _nature=nat;
}
double MEDCouplingFieldDouble::getIJK(int cellId, int nodeIdInCell, int compoId) const
_time_discr->setEndArray(array,this);
}
+void MEDCouplingFieldDouble::setArrays(const std::vector<DataArrayDouble *>& arrs) throw(INTERP_KERNEL::Exception)
+{
+ _time_discr->setArrays(arrs,this);
+}
+
void MEDCouplingFieldDouble::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
tinyInfo.clear();
_time_discr->getTinySerializationStrInformation(tinyInfo);
tinyInfo.push_back(_name);
tinyInfo.push_back(_desc);
+ tinyInfo.push_back(getTimeUnit());
}
/*!
_nature=(NatureOfField)tinyInfoI[2];
_type->finishUnserialization(tmp2);
int nbOfElemS=tinyInfoS.size();
- _name=tinyInfoS[nbOfElemS-2];
- _desc=tinyInfoS[nbOfElemS-1];
+ _name=tinyInfoS[nbOfElemS-3];
+ _desc=tinyInfoS[nbOfElemS-2];
+ setTimeUnit(tinyInfoS[nbOfElemS-1].c_str());
}
/*!
if(_mesh==0 || other==0)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::changeUnderlyingMesh : is expected to operate on not null meshes !");
DataArrayInt *cellCor,*nodeCor;
- _mesh->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor);
+ other->checkGeoEquivalWith(_mesh,levOfCheck,prec,cellCor,nodeCor);
if(cellCor)
{
renumberCellsWithoutMesh(cellCor->getConstPointer(),false);
/*!
* Merge nodes of underlying mesh. In case of some node will be merged the underlying mesh instance will change.
+ * The first 'eps' stands for geometric approximation. The second 'epsOnVals' is for epsilon on values in case of node merging.
+ * If 2 nodes distant from less than 'eps' and with value different with more than 'epsOnVals' an exception will be thrown.
*/
-bool MEDCouplingFieldDouble::mergeNodes(double eps) throw(INTERP_KERNEL::Exception)
+bool MEDCouplingFieldDouble::mergeNodes(double eps, double epsOnVals) throw(INTERP_KERNEL::Exception)
{
const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
_time_discr->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
- _type->renumberValuesOnNodes(arr->getConstPointer(),*iter);
+ _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),*iter);
+ setMesh(meshC2);
+ return true;
+}
+
+/*!
+ * Merge nodes with (barycenter computation) of underlying mesh. In case of some node will be merged the underlying mesh instance will change.
+ * The first 'eps' stands for geometric approximation. The second 'epsOnVals' is for epsilon on values in case of node merging.
+ * If 2 nodes distant from less than 'eps' and with value different with more than 'epsOnVals' an exception will be thrown.
+ */
+bool MEDCouplingFieldDouble::mergeNodes2(double eps, double epsOnVals) throw(INTERP_KERNEL::Exception)
+{
+ const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
+ if(!meshC)
+ throw INTERP_KERNEL::Exception("Invalid support mesh to apply mergeNodes on it : must be a MEDCouplingPointSet one !");
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCpy());
+ bool ret;
+ int ret2;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=meshC2->mergeNodes2(eps,ret,ret2);
+ if(!ret)//no nodes have been merged.
+ return ret;
+ std::vector<DataArrayDouble *> arrays;
+ _time_discr->getArrays(arrays);
+ for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
+ if(*iter)
+ _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),*iter);
setMesh(meshC2);
return true;
}
/*!
* This method applyies ParaMEDMEM::MEDCouplingPointSet::zipCoords method on 'this->_mesh' that should be set and of type ParaMEDMEM::MEDCouplingPointSet.
* If some nodes have disappeared true is returned.
+ * 'epsOnVals' stands for epsilon in case of merge of cells. This value is used as tolerance in case the corresponding values differ.
*/
-bool MEDCouplingFieldDouble::zipCoords() throw(INTERP_KERNEL::Exception)
+bool MEDCouplingFieldDouble::zipCoords(double epsOnVals) throw(INTERP_KERNEL::Exception)
{
const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
_time_discr->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
- _type->renumberValuesOnNodes(arr->getConstPointer(),*iter);
+ _type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),*iter);
setMesh(meshC2);
return true;
}
/*!
* This method applyies ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer on 'this->_mesh' that should be set and of type ParaMEDMEM::MEDCouplingUMesh.
* The semantic of 'compType' is given in ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer method.
+ * 'epsOnVals' stands for epsilon in case of merge of cells. This value is used as tolerance in case the corresponding values differ.
*/
-bool MEDCouplingFieldDouble::zipConnectivity(int compType) throw(INTERP_KERNEL::Exception)
+bool MEDCouplingFieldDouble::zipConnectivity(int compType, double epsOnVals) throw(INTERP_KERNEL::Exception)
{
const MEDCouplingUMesh *meshC=dynamic_cast<const MEDCouplingUMesh *>(_mesh);
if(!meshC)
_time_discr->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
- _type->renumberValuesOnCells(meshC,arr->getConstPointer(),*iter);
+ _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),*iter);
setMesh(meshC2);
return true;
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGFIELDDOUBLE_HXX__
#include "MEDCoupling.hxx"
#include "MEDCouplingField.hxx"
#include "MEDCouplingTimeDiscretization.hxx"
-#include "MEDCouplingNatureOfField.hxx"
#include "MEDCouplingMemArray.hxx"
namespace ParaMEDMEM
{
+ class MEDCouplingFieldTemplate;
+
class MEDCOUPLING_EXPORT MEDCouplingFieldDouble : public MEDCouplingField
{
public:
static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=NO_TIME);
+ static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td=NO_TIME);
+ void setTimeUnit(const char *unit);
+ const char *getTimeUnit() const;
void copyTinyStringsFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
std::string simpleRepr() const;
void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
void renumberCellsWithoutMesh(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
void renumberNodes(const int *old2NewBg) throw(INTERP_KERNEL::Exception);
- void renumberNodesWithoutMesh(const int *old2NewBg) throw(INTERP_KERNEL::Exception);
+ void renumberNodesWithoutMesh(const int *old2NewBg, double eps=1e-15) throw(INTERP_KERNEL::Exception);
DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *buildSubPart(const DataArrayInt *part) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *buildSubPart(const int *partBg, const int *partEnd) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const;
TypeOfTimeDiscretization getTimeDiscretization() const;
void checkCoherency() const throw(INTERP_KERNEL::Exception);
- NatureOfField getNature() const { return _nature; }
void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
void setTimeTolerance(double val) { _time_discr->setTimeTolerance(val); }
double getTimeTolerance() const { return _time_discr->getTimeTolerance(); }
double getIJK(int cellId, int nodeIdInCell, int compoId) const;
void setArray(DataArrayDouble *array);
void setEndArray(DataArrayDouble *array);
- DataArrayDouble *getArray() const { return _time_discr->getArray(); }
- DataArrayDouble *getEndArray() const { return _time_discr->getEndArray(); }
+ void setArrays(const std::vector<DataArrayDouble *>& arrs) throw(INTERP_KERNEL::Exception);
+ const DataArrayDouble *getArray() const { return _time_discr->getArray(); }
+ DataArrayDouble *getArray() { return _time_discr->getArray(); }
+ const DataArrayDouble *getEndArray() const { return _time_discr->getEndArray(); }
+ DataArrayDouble *getEndArray() { return _time_discr->getEndArray(); }
+ std::vector<DataArrayDouble *> getArrays() const { std::vector<DataArrayDouble *> ret; _time_discr->getArrays(ret); return ret; }
double accumulate(int compId) const;
void accumulate(double *res) const;
double getMaxValue() const throw(INTERP_KERNEL::Exception);
void getValueOnPos(int i, int j, int k, double *res) const throw(INTERP_KERNEL::Exception);
void getValueOn(const double *spaceLoc, double *res) const throw(INTERP_KERNEL::Exception);
void getValueOn(const double *spaceLoc, double time, double *res) const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getValueOnMulti(const double *spaceLoc, int nbOfPoints) const throw(INTERP_KERNEL::Exception);
//! \b temporary
void applyLin(double a, double b, int compoId);
MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
void fillFromAnalytic(int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+ void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+ void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
void applyFunc(int nbOfComp, FunctionToEvaluate func);
void applyFunc(int nbOfComp, double val);
- void applyFunc(int nbOfComp, const char *func);
- void applyFunc(const char *func);
+ void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+ void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+ void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
+ void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
int getNumberOfValues() const throw(INTERP_KERNEL::Exception);
- void updateTime();
+ void updateTime() const;
//
void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
//
void changeUnderlyingMesh(const MEDCouplingMesh *other, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
void substractInPlaceDM(const MEDCouplingFieldDouble *f, int levOfCheck, double prec) throw(INTERP_KERNEL::Exception);
- bool mergeNodes(double eps) throw(INTERP_KERNEL::Exception);
- bool mergeNodes2(double eps) throw(INTERP_KERNEL::Exception);
- bool zipCoords() throw(INTERP_KERNEL::Exception);
- bool zipConnectivity(int compType) throw(INTERP_KERNEL::Exception);
+ bool mergeNodes(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
+ bool mergeNodes2(double eps, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
+ bool zipCoords(double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
+ bool zipConnectivity(int compType, double epsOnVals=1e-15) throw(INTERP_KERNEL::Exception);
bool simplexize(int policy) throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *determinant() const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *operator/(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception) { return DivideFields(this,&other); }
const MEDCouplingFieldDouble &operator/=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
static MEDCouplingFieldDouble *DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception);
+ public:
+ const MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() const { return _time_discr; }
+ MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() { return _time_discr; }
private:
MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td);
+ MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td);
MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCpy);
MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeDiscretization *td, MEDCouplingFieldDiscretization *type);
~MEDCouplingFieldDouble();
private:
- NatureOfField _nature;
MEDCouplingTimeDiscretization *_time_discr;
};
}
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "MEDCouplingFieldOverTime.hxx"
+#include "MEDCouplingMesh.hxx"
+
+#include <cmath>
+
+using namespace ParaMEDMEM;
+
+MEDCouplingFieldOverTime *MEDCouplingFieldOverTime::New(const std::vector<MEDCouplingFieldDouble *>& fs) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDCouplingFieldOverTime(fs);
+}
+
+double MEDCouplingFieldOverTime::getTimeTolerance() const throw(INTERP_KERNEL::Exception)
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ if(_fs.empty())
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : empty set !");
+ for(;it!=_fs.end();it++)
+ if((const MEDCouplingFieldDouble *)(*it)!=0)
+ return (*it)->getTimeTolerance();
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::getTimeTolerance : only empty fields in this !");
+}
+
+void MEDCouplingFieldOverTime::checkCoherency() const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingMultiFields::checkCoherency();
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ for(;it!=_fs.end();it++)
+ if((*it)->getTimeDiscretization()==NO_TIME)
+ {
+ std::ostringstream oss; oss << "MEDCouplingFieldOverTime::checkCoherency : At rank #" << std::distance(_fs.begin(),it) << " the field has no time !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(_fs.empty())
+ return ;
+ it=_fs.begin();
+ const MEDCouplingFieldDouble& ref=*(*(it++));
+ int tt1,tt2;
+ double reft=ref.getEndTime(tt1,tt2);
+ double eps=getTimeTolerance();
+ int id=1;
+ for(;it!=_fs.end();it++,id++)
+ {
+ if(!ref.getMesh()->areCompatibleForMerge((*it)->getMesh()))
+ {
+ std::ostringstream oss; oss << "Field slice at rank #" << id << " is not compatible with the first !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ double curt=(*it)->getStartTime(tt1,tt2);
+ if(curt<reft-eps)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldOverTime::checkCoherency : fields are NOT sorted properly in ascending time !");
+ reft=(*it)->getEndTime(tt1,tt2);
+ }
+}
+
+std::string MEDCouplingFieldOverTime::simpleRepr() const
+{
+ std::ostringstream ret;
+ ret << "MEDCouplingFieldOverTime with name : \"" << getName() << "\"\n";
+ ret << "Description of MEDCouplingFieldOverTime is : \"" << getDescription() << "\"\n";
+ ret << "Number of discretization : " << _fs.size() << "\n";
+ ret << "Number of different meshes : ";
+ std::vector<MEDCouplingMesh *> ms;
+ std::vector<int> refms;
+ try
+ {
+ ms=getDifferentMeshes(refms);
+ ret << ms.size() << "\n";
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ { ret << "Current instance is INVALID !\n"; }
+ try
+ {
+ MEDCouplingDefinitionTime dt=getDefinitionTimeZone();
+ dt.appendRepr(ret);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ { ret << "Definition zone is INVALID !\n"; }
+ return ret.str();
+}
+
+bool MEDCouplingFieldOverTime::isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const
+{
+ if(!MEDCouplingMultiFields::isEqual(other,meshPrec,valsPrec))
+ return false;
+ const MEDCouplingFieldOverTime *otherC=dynamic_cast<const MEDCouplingFieldOverTime *>(other);
+ if(!otherC)
+ return false;
+ // to implement
+ return true;
+}
+
+bool MEDCouplingFieldOverTime::isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const
+{
+ if(!MEDCouplingMultiFields::isEqualWithoutConsideringStr(other,meshPrec,valsPrec))
+ return false;
+ const MEDCouplingFieldOverTime *otherC=dynamic_cast<const MEDCouplingFieldOverTime *>(other);
+ if(!otherC)
+ return false;
+ // to implement
+ return true;
+}
+
+std::vector<MEDCouplingMesh *> MEDCouplingFieldOverTime::getMeshes() const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency();
+ return MEDCouplingMultiFields::getMeshes();
+}
+
+std::vector<MEDCouplingMesh *> MEDCouplingFieldOverTime::getDifferentMeshes(std::vector<int>& refs) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency();
+ return MEDCouplingMultiFields::getDifferentMeshes(refs);
+}
+
+std::vector<DataArrayDouble *> MEDCouplingFieldOverTime::getArrays() const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency();
+ return MEDCouplingMultiFields::getArrays();
+}
+
+std::vector<DataArrayDouble *> MEDCouplingFieldOverTime::getDifferentArrays(std::vector< std::vector<int> >& refs) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency();
+ return MEDCouplingMultiFields::getDifferentArrays(refs);
+}
+
+MEDCouplingDefinitionTime MEDCouplingFieldOverTime::getDefinitionTimeZone() const
+{
+ std::vector< std::vector<int> > tmp;
+ getDifferentArrays(tmp);
+ std::vector<const MEDCouplingFieldDouble *> tmp2(_fs.begin(),_fs.end());
+ std::vector<int> tmp3;
+ getDifferentMeshes(tmp3);
+ return MEDCouplingDefinitionTime(tmp2,tmp3,tmp);
+}
+
+MEDCouplingFieldOverTime::MEDCouplingFieldOverTime(const std::vector<MEDCouplingFieldDouble *>& fs) throw(INTERP_KERNEL::Exception):MEDCouplingMultiFields(fs)
+{
+ checkCoherency();
+}
+
+MEDCouplingFieldOverTime::MEDCouplingFieldOverTime()
+{
+}
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#ifndef __PARAMEDMEM_MEDCOUPLINGFIELDOVERTIME_HXX__
+#define __PARAMEDMEM_MEDCOUPLINGFIELDOVERTIME_HXX__
+
+#include "MEDCouplingMultiFields.hxx"
+#include "MEDCouplingDefinitionTime.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+
+#include <vector>
+
+namespace ParaMEDMEM
+{
+ class MEDCouplingFieldOverTime : public MEDCouplingMultiFields
+ {
+ public:
+ static MEDCouplingFieldOverTime *New(const std::vector<MEDCouplingFieldDouble *>& fs) throw(INTERP_KERNEL::Exception);
+ void checkCoherency() const throw(INTERP_KERNEL::Exception);
+ double getTimeTolerance() const throw(INTERP_KERNEL::Exception);
+ std::string simpleRepr() const;
+ bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
+ bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
+ //void getIdsToFetch(double time, int& fieldId, int& arrId, int& meshId) const;
+ //void setFieldOnId(int fieldId, MEDCouplingFieldDouble *f);
+ //void dispatchPointers();
+ std::vector<MEDCouplingMesh *> getMeshes() const throw(INTERP_KERNEL::Exception);
+ std::vector<MEDCouplingMesh *> getDifferentMeshes(std::vector<int>& refs) const throw(INTERP_KERNEL::Exception);
+ std::vector<DataArrayDouble *> getArrays() const throw(INTERP_KERNEL::Exception);
+ std::vector<DataArrayDouble *> getDifferentArrays(std::vector< std::vector<int> >& refs) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingDefinitionTime getDefinitionTimeZone() const;
+ protected:
+ MEDCouplingFieldOverTime();
+ private:
+ MEDCouplingFieldOverTime(const std::vector<MEDCouplingFieldDouble *>& fs) throw(INTERP_KERNEL::Exception);
+ };
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "MEDCouplingFieldTemplate.hxx"
+#include "MEDCouplingMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldDiscretization.hxx"
+
+using namespace ParaMEDMEM;
+
+MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDCouplingFieldTemplate(f);
+}
+
+/*!
+ * The user should \b not use this method. Only useful for CORBA serialization/unserialization.
+ */
+MEDCouplingFieldTemplate *MEDCouplingFieldTemplate::New(TypeOfField type)
+{
+ return new MEDCouplingFieldTemplate(type);
+}
+
+MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception):MEDCouplingField(*f)
+{
+ checkCoherency();
+}
+
+MEDCouplingFieldTemplate::MEDCouplingFieldTemplate(TypeOfField type):MEDCouplingField(type)
+{
+}
+
+void MEDCouplingFieldTemplate::checkCoherency() const throw(INTERP_KERNEL::Exception)
+{
+ if(_mesh==0)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldTemplate::checkCoherency : Empty mesh !");
+}
+
+std::string MEDCouplingFieldTemplate::simpleRepr() const
+{
+ std::ostringstream ret;
+ ret << "FieldTemplate with name : \"" << getName() << "\"\n";
+ ret << "Description of field is : \"" << getDescription() << "\"\n";
+ ret << "FieldTemplate space discretization is : " << _type->getStringRepr() << "\n";
+ ret << "FieldTemplate nature of field is : " << MEDCouplingNatureOfField::getRepr(_nature) << "\n";
+ if(_mesh)
+ ret << "Mesh support information :\n__________________________\n" << _mesh->simpleRepr();
+ else
+ ret << "Mesh support information : No mesh set !\n";
+ return ret.str();
+}
+
+std::string MEDCouplingFieldTemplate::advancedRepr() const
+{
+ return simpleRepr();
+}
+
+void MEDCouplingFieldTemplate::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+{
+ tinyInfo.clear();
+ tinyInfo.push_back((int)_type->getEnum());
+ tinyInfo.push_back((int)_nature);
+ std::vector<int> tinyInfo2;
+ _type->getTinySerializationIntInformation(tinyInfo2);
+ tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
+ tinyInfo.push_back(tinyInfo2.size());
+}
+
+void MEDCouplingFieldTemplate::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
+{
+ tinyInfo.clear();
+ _type->getTinySerializationDbleInformation(tinyInfo);
+}
+
+void MEDCouplingFieldTemplate::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
+{
+ tinyInfo.clear();
+ tinyInfo.push_back(_name);
+ tinyInfo.push_back(_desc);
+}
+
+void MEDCouplingFieldTemplate::resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt)
+{
+ dataInt=0;
+ std::vector<int> tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end());
+ _type->resizeForUnserialization(tinyInfoITmp,dataInt);
+}
+
+void MEDCouplingFieldTemplate::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
+{
+ _nature=(NatureOfField)tinyInfoI[1];
+ _type->finishUnserialization(tinyInfoD);
+ _name=tinyInfoS[0];
+ _desc=tinyInfoS[1];
+}
+
+void MEDCouplingFieldTemplate::serialize(DataArrayInt *&dataInt) const
+{
+ _type->getSerializationIntArray(dataInt);
+}
+
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#ifndef __PARAMEDMEM_MEDCOUPLINGFIELDTEMPLATE_HXX__
+#define __PARAMEDMEM_MEDCOUPLINGFIELDTEMPLATE_HXX__
+
+#include "MEDCouplingField.hxx"
+
+namespace ParaMEDMEM
+{
+ class MEDCouplingFieldDouble;
+
+ class MEDCouplingFieldTemplate : public MEDCouplingField
+ {
+ public:
+ static MEDCouplingFieldTemplate *New(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingFieldTemplate *New(TypeOfField type);
+ std::string simpleRepr() const;
+ std::string advancedRepr() const;
+ void checkCoherency() const throw(INTERP_KERNEL::Exception);
+ //
+ void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
+ void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+ void resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt);
+ void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ void serialize(DataArrayInt *&dataInt) const;
+ //
+ private:
+ MEDCouplingFieldTemplate(const MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldTemplate(TypeOfField type);
+ };
+}
+
+#endif
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingGaussLocalization.hxx"
void ParaMEDMEM::MEDCouplingGaussLocalization::checkCoherency() const throw(INTERP_KERNEL::Exception)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(_type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
int nbNodes=cm.getNumberOfNodes();
int dim=cm.getDimension();
if(!cm.isDynamic())
{
if(_type!=other._type)
return false;
- if(!areAlmostEqual(_ref_coord,other._ref_coord,eps))
+ if(!AreAlmostEqual(_ref_coord,other._ref_coord,eps))
return false;
- if(!areAlmostEqual(_gauss_coord,other._gauss_coord,eps))
+ if(!AreAlmostEqual(_gauss_coord,other._gauss_coord,eps))
return false;
- if(!areAlmostEqual(_weight,other._weight,eps))
+ if(!AreAlmostEqual(_weight,other._weight,eps))
return false;
return true;
}
double ParaMEDMEM::MEDCouplingGaussLocalization::getRefCoord(int ptIdInCell, int comp) const throw(INTERP_KERNEL::Exception)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(_type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
int nbNodes=cm.getNumberOfNodes();
int dim=cm.getDimension();
if(ptIdInCell<0 || ptIdInCell>=nbNodes)
*/
void ParaMEDMEM::MEDCouplingGaussLocalization::setRefCoord(int ptIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(_type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
int nbNodes=cm.getNumberOfNodes();
int dim=cm.getDimension();
if(ptIdInCell<0 || ptIdInCell>=nbNodes)
/*!
* The format of 'tinyData' parameter is the same than pushed in method ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo.
*/
-ParaMEDMEM::MEDCouplingGaussLocalization ParaMEDMEM::MEDCouplingGaussLocalization::buildNewInstanceFromTinyInfo(int dim, const std::vector<int>& tinyData)
+ParaMEDMEM::MEDCouplingGaussLocalization ParaMEDMEM::MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(int dim, const std::vector<int>& tinyData)
{
std::vector<double> v1(dim*tinyData[1]),v2(dim*tinyData[2]),v3(tinyData[2]);
return ParaMEDMEM::MEDCouplingGaussLocalization((INTERP_KERNEL::NormalizedCellType)tinyData[0],v1,v2,v3);
int ParaMEDMEM::MEDCouplingGaussLocalization::checkCoherencyOfRequest(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(_type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type);
int dim=cm.getDimension();
int nbGsPts=getNumberOfGaussPt();
if(gaussPtIdInCell<0 || gaussPtIdInCell>=nbGsPts)
return dim;
}
-bool ParaMEDMEM::MEDCouplingGaussLocalization::areAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps)
+bool ParaMEDMEM::MEDCouplingGaussLocalization::AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps)
{
int sz=v1.size();
if(sz!=(int)v2.size())
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGGAUSSLOCALIZATION_HXX__
void setGaussCoord(int gaussPtIdInCell, int comp, double newVal) throw(INTERP_KERNEL::Exception);
void setWeight(int gaussPtIdInCell, double newVal) throw(INTERP_KERNEL::Exception);
//
- static MEDCouplingGaussLocalization buildNewInstanceFromTinyInfo(int dim, const std::vector<int>& tinyData);
+ static MEDCouplingGaussLocalization BuildNewInstanceFromTinyInfo(int dim, const std::vector<int>& tinyData);
+ static bool AreAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
private:
int checkCoherencyOfRequest(int gaussPtIdInCell, int comp) const throw(INTERP_KERNEL::Exception);
- static bool areAlmostEqual(const std::vector<double>& v1, const std::vector<double>& v2, double eps);
private:
INTERP_KERNEL::NormalizedCellType _type;
std::vector<double> _ref_coord;
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingMemArray.txx"
stream << "\n";
}
+std::vector<std::string> DataArray::getVarsOnComponent() const
+{
+ int nbOfCompo=(int)_info_on_compo.size();
+ std::vector<std::string> ret(nbOfCompo);
+ for(int i=0;i<nbOfCompo;i++)
+ ret[i]=getVarOnComponent(i);
+ return ret;
+}
+
+std::vector<std::string> DataArray::getUnitsOnComponent() const
+{
+ int nbOfCompo=(int)_info_on_compo.size();
+ std::vector<std::string> ret(nbOfCompo);
+ for(int i=0;i<nbOfCompo;i++)
+ ret[i]=getUnitOnComponent(i);
+ return ret;
+}
+
std::string DataArray::getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception)
{
if(i<(int)_info_on_compo.size())
}
}
+/*!
+ * In the info part of i_th component this method returns the var part.
+ * For example, if getInfoOnComponent(0) return "SIGXY (N/m^2)", getVarOnComponent(0) will return "SIGXY"
+ */
+std::string DataArray::getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception)
+{
+ if(i<(int)_info_on_compo.size())
+ {
+ std::string st0=_info_on_compo[i];
+ std::size_t p1=st0.find_last_of('[');
+ std::size_t p2=st0.find_last_of(']');
+ if(p1==std::string::npos || p2==std::string::npos)
+ return st0;
+ if(p1>p2)
+ return st0;
+ if(p1==0)
+ return std::string();
+ std::size_t p3=st0.find_last_not_of(' ',p1-1);
+ return st0.substr(0,p3+1);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "getVarOnComponent : Invalid component id transmitted (" << i << ") >= " << (int) _info_on_compo.size();
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+/*!
+ * In the info part of i_th component this method returns the var part.
+ * For example, if getInfoOnComponent(0) return "SIGXY (N/m^2)", getUnitOnComponent(0) will return "N/m^2"
+ */
+std::string DataArray::getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception)
+{
+ if(i<(int)_info_on_compo.size())
+ {
+ std::string st0=_info_on_compo[i];
+ std::size_t p1=st0.find_last_of('[');
+ std::size_t p2=st0.find_last_of(']');
+ if(p1==std::string::npos || p2==std::string::npos)
+ return std::string();
+ if(p1>p2)
+ return std::string();
+ return st0.substr(p1+1,p2-p1-1);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "getUnitOnComponent : Invalid component id transmitted (" << i << ") >= " << (int) _info_on_compo.size();
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
void DataArray::setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception)
{
if(i<(int)_info_on_compo.size())
}
}
+void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNumberOfTuples()!=other.getNumberOfTuples())
+ {
+ std::ostringstream oss; oss << msg << " : mismatch number of tuples : expected " << other.getNumberOfTuples() << " having " << getNumberOfTuples() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(getNumberOfComponents()!=other.getNumberOfComponents())
+ {
+ std::ostringstream oss; oss << msg << " : mismatch number of components : expected " << other.getNumberOfComponents() << " having " << getNumberOfComponents() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNumberOfTuples()!=nbOfTuples)
+ {
+ std::ostringstream oss; oss << msg << " : mismatch number of tuples : expected " << nbOfTuples << " having " << getNumberOfTuples() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(getNumberOfComponents()!=nbOfCompo)
+ {
+ std::ostringstream oss; oss << msg << " : mismatch number of components : expected " << nbOfCompo << " having " << getNumberOfComponents() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+void DataArray::checkNbOfElems(int nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNbOfElems()!=nbOfElems)
+ {
+ std::ostringstream oss; oss << msg << " : mismatch number of elems : Expected " << nbOfElems << " having " << getNbOfElems() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+void DataArray::CheckValueInRange(int ref, int value, const char *msg) throw(INTERP_KERNEL::Exception)
+{
+ if(value<0 || value>=ref)
+ {
+ std::ostringstream oss; oss << "DataArray::CheckValueInRange : " << msg << " ! Expected in range [0," << ref << ") having " << value << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+void DataArray::CheckClosingParInRange(int ref, int value, const char *msg) throw(INTERP_KERNEL::Exception)
+{
+ if(value<0 || value>ref)
+ {
+ std::ostringstream oss; oss << "DataArray::CheckClosingParInRange : " << msg << " ! Expected a range in [0," << ref << ") having closing open parenthesis " << value << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception)
+{
+ if(end<begin)
+ {
+ std::ostringstream oss; oss << msg << " : end before begin !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(step<=0)
+ {
+ std::ostringstream oss; oss << msg << " : invalid step should be > 0 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return (end-1-begin)/step+1;
+}
+
DataArrayDouble *DataArrayDouble::New()
{
return new DataArrayDouble;
}
}
+void DataArrayDouble::cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception)
+{
+ other.checkAllocated();
+ int nbOfTuples=other.getNumberOfTuples();
+ int nbOfComp=other.getNumberOfComponents();
+ allocIfNecessary(nbOfTuples,nbOfComp);
+ int nbOfElems=nbOfTuples*nbOfComp;
+ double *pt=getPointer();
+ const double *ptI=other.getConstPointer();
+ for(int i=0;i<nbOfElems;i++)
+ pt[i]=ptI[i];
+ copyStringInfoFrom(other);
+}
+
+void DataArrayDouble::allocIfNecessary(int nbOfTuple, int nbOfCompo)
+{
+ if(isAllocated())
+ {
+ if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=getNumberOfComponents())
+ alloc(nbOfTuple,nbOfCompo);
+ }
+ else
+ alloc(nbOfTuple,nbOfCompo);
+}
+
void DataArrayDouble::alloc(int nbOfTuple, int nbOfCompo)
{
_nb_of_tuples=nbOfTuple;
if(!ptr)
throw INTERP_KERNEL::Exception("DataArrayDouble::iota : allocate first !");
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayDouble::iota : works only for arrays with only one component!");
+ throw INTERP_KERNEL::Exception("DataArrayDouble::iota : works only for arrays with only one component, you can call 'rearrange' method before !");
int ntuples=getNumberOfTuples();
for(int i=0;i<ntuples;i++)
ptr[i]=init+double(i);
bool DataArrayDouble::isUniform(double val, double eps) const
{
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayDouble::isUniform : must be applied on DataArrayDouble with only one component !");
+ throw INTERP_KERNEL::Exception("DataArrayDouble::isUniform : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
int nbOfTuples=getNumberOfTuples();
const double *w=getConstPointer();
const double *end=w+nbOfTuples;
_mem.sort();
}
+void DataArrayDouble::checkMonotonic(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ if(!isMonotonic(eps))
+ throw INTERP_KERNEL::Exception("DataArrayDouble::checkMonotonic : 'this' is not monotonic !");
+}
+
+bool DataArrayDouble::isMonotonic(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::isMonotonic : only supported with 'this' array with ONE component !");
+ int nbOfElements=getNumberOfTuples();
+ const double *ptr=getConstPointer();
+ if(nbOfElements==0)
+ return true;
+ double ref=ptr[0];
+ for(int i=1;i<nbOfElements;i++)
+ {
+ if(ptr[i]<ref+eps)
+ return false;
+ ref=ptr[i];
+ }
+ return true;
+}
+
std::string DataArrayDouble::repr() const
{
std::ostringstream ret;
}
/*!
- * This method is equivalent to DataArrayInt::selectByTupleId except that an analyze to the content of input range to check that it will not lead to memory corruption !
+ * This method is equivalent to DataArrayDouble::selectByTupleId except that an analyze to the content of input range to check that it will not lead to memory corruption !
*/
DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception)
{
return ret;
}
+/*!
+ * Idem than DataArrayInt::selectByTupleIdSafe except that the input array is not constructed explicitely.
+ * The convention is as python one. ['bg','end') with steps of 'step'.
+ * Returns a newly created array.
+ */
+DataArrayDouble *DataArrayDouble::selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception)
+{
+ if(end<bg)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::selectByTupleId2 : end before begin !");
+ if(step<=0)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::selectByTupleId2 : invalid step should > 0 !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ int nbComp=getNumberOfComponents();
+ int newNbOfTuples=(end-1-bg)/step+1;
+ ret->alloc(newNbOfTuples,nbComp);
+ double *pt=ret->getPointer();
+ const double *srcPt=getConstPointer()+bg*nbComp;
+ for(int i=0;i<newNbOfTuples;i++,srcPt+=step*nbComp)
+ std::copy(srcPt,srcPt+nbComp,pt+i*nbComp);
+ ret->copyStringInfoFrom(*this);
+ ret->incrRef();
+ return ret;
+}
+
/*!
* This methods has a similar behaviour than std::string::substr. This method returns a newly created DataArrayInt that is part of this with same number of components.
* The intervall is specified by [tupleIdBg,tupleIdEnd) except if tupleIdEnd ==-1 in this case the [tupleIdBg,this->end()) will be kept.
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
int newNbOfCompo=compoIds.size();
int oldNbOfCompo=getNumberOfComponents();
+ for(std::vector<int>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
+ if((*it)<0 || (*it)>=oldNbOfCompo)
+ {
+ std::ostringstream oss; oss << "DataArrayDouble::keepSelectedComponents : invalid requested component : " << *it << " whereas it should be in [0," << oldNbOfCompo << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
int nbOfTuples=getNumberOfTuples();
ret->alloc(nbOfTuples,newNbOfCompo);
ret->copyPartOfStringInfoFrom(*this,compoIds);
nc[nbOfCompo*i+compoIds[j]]=*ac;
}
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ * 'strictCompoCompare' specifies if DataArray 'a' should have exactly same number of components and tuples than 'this' (true) or not (false). By default set to true with maximal test.
+ */
+void DataArrayDouble::setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception)
+{
+ const char msg[]="DataArrayDouble::setPartOfValues1";
+ checkAllocated();
+ a->checkAllocated();
+ int newNbOfTuples=DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg);
+ int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ DataArray::CheckValueInRange(nbOfTuples,bgTuples,"invalid begin tuple value");
+ DataArray::CheckClosingParInRange(nbOfTuples,endTuples,"invalid end tuple value");
+ DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
+ DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
+ if(strictCompoCompare)
+ a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+ double *pt=getPointer()+bgTuples*nbComp+bgComp;
+ const double *srcPt=a->getConstPointer();
+ for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(int j=0;j<newNbOfComp;j++,srcPt++)
+ pt[j*stepComp]=*srcPt;
+}
+
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ */
+void DataArrayDouble::setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception)
+{
+ const char msg[]="DataArrayDouble::setPartOfValuesSimple1";
+ checkAllocated();
+ int newNbOfTuples=DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg);
+ int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ DataArray::CheckValueInRange(nbOfTuples,bgTuples,"invalid begin tuple value");
+ DataArray::CheckClosingParInRange(nbOfTuples,endTuples,"invalid end tuple value");
+ DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
+ DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ double *pt=getPointer()+bgTuples*nbComp+bgComp;
+ for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(int j=0;j<newNbOfComp;j++)
+ pt[j*stepComp]=a;
+}
+
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ * 'strictCompoCompare' specifies if DataArray 'a' should have exactly same number of components and tuples than 'this' (true) or not (false). By default set to true with maximal test.
+ */
+void DataArrayDouble::setPartOfValues2(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception)
+{
+ const char msg[]="DataArrayDouble::setPartOfValues2";
+ checkAllocated();
+ a->checkAllocated();
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ for(const int *z=bgComp;z!=endComp;z++)
+ DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
+ int newNbOfTuples=std::distance(bgTuples,endTuples);
+ int newNbOfComp=std::distance(bgComp,endComp);
+ a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
+ if(strictCompoCompare)
+ a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+ double *pt=getPointer();
+ const double *srcPt=a->getConstPointer();
+ for(const int *w=bgTuples;w!=endTuples;w++)
+ for(const int *z=bgComp;z!=endComp;z++,srcPt++)
+ {
+ DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
+ pt[(*w)*nbComp+(*z)]=*srcPt;
+ }
+}
+
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ */
+void DataArrayDouble::setPartOfValuesSimple2(double a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ for(const int *z=bgComp;z!=endComp;z++)
+ DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
+ double *pt=getPointer();
+ for(const int *w=bgTuples;w!=endTuples;w++)
+ for(const int *z=bgComp;z!=endComp;z++)
+ {
+ DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
+ pt[(*w)*nbComp+(*z)]=a;
+ }
+}
+
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ * 'strictCompoCompare' specifies if DataArray 'a' should have exactly same number of components and tuples than 'this' (true) or not (false). By default set to true with maximal test.
+ */
+void DataArrayDouble::setPartOfValues3(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception)
+{
+ const char msg[]="DataArrayDouble::setPartOfValues3";
+ checkAllocated();
+ a->checkAllocated();
+ int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
+ DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ int newNbOfTuples=std::distance(bgTuples,endTuples);
+ a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
+ if(strictCompoCompare)
+ a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+ double *pt=getPointer()+bgComp;
+ const double *srcPt=a->getConstPointer();
+ for(const int *w=bgTuples;w!=endTuples;w++)
+ for(int j=0;j<newNbOfComp;j++,srcPt++)
+ {
+ DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
+ pt[(*w)*nbComp+j*stepComp]=*srcPt;
+ }
+}
+
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ */
+void DataArrayDouble::setPartOfValuesSimple3(double a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception)
+{
+ const char msg[]="DataArrayDouble::setPartOfValuesSimple3";
+ checkAllocated();
+ int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
+ DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ double *pt=getPointer()+bgComp;
+ for(const int *w=bgTuples;w!=endTuples;w++)
+ for(int j=0;j<newNbOfComp;j++)
+ {
+ DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
+ pt[(*w)*nbComp+j*stepComp]=a;
+ }
+}
+
void DataArrayDouble::SetArrayIn(DataArrayDouble *newArray, DataArrayDouble* &arrayToSet)
{
if(newArray!=arrayToSet)
double DataArrayDouble::getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception)
{
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : must be applied on DataArrayDouble with only one component !");
+ throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
int nbOfTuples=getNumberOfTuples();
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : array exists but number of tuples must be > 0 !");
double DataArrayDouble::getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception)
{
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : must be applied on DataArrayDouble with only one component !");
+ throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
int nbOfTuples=getNumberOfTuples();
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : array exists but number of tuples must be > 0 !");
double DataArrayDouble::getAverageValue() const throw(INTERP_KERNEL::Exception)
{
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayDouble::getAverageValue : must be applied on DataArrayDouble with only one component !");
+ throw INTERP_KERNEL::Exception("DataArrayDouble::getAverageValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !");
int nbOfTuples=getNumberOfTuples();
if(nbOfTuples<=0)
throw INTERP_KERNEL::Exception("DataArrayDouble::getAverageValue : array exists but number of tuples must be > 0 !");
declareAsNew();
}
+void DataArrayDouble::applyLin(double a, double b) throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ double *ptr=getPointer();
+ int nbOfElems=getNbOfElems();
+ for(int i=0;i<nbOfElems;i++,ptr++)
+ *ptr=a*(*ptr)+b;
+ declareAsNew();
+}
+
+/*!
+ * This method applies the operation 'numerator/x' for each element 'x' in 'this'.
+ * If there is a value in 'this' exactly equal to 0. an exception is thrown.
+ * Warning if presence of null this is modified for each values previous than place where exception was thrown !
+ */
+void DataArrayDouble::applyInv(double numerator) throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ double *ptr=getPointer();
+ int nbOfElems=getNbOfElems();
+ for(int i=0;i<nbOfElems;i++,ptr++)
+ {
+ if(*ptr!=0.)
+ {
+ *ptr=numerator/(*ptr);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayDouble::applyInv : presence of null value in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents();
+ oss << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ declareAsNew();
+}
+
DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int oldNbOfComp=getNumberOfComponents();
if((int)vars.size()>oldNbOfComp)
{
- std::ostringstream oss; oss << "The field has a " << oldNbOfComp << " components and there are ";
+ std::ostringstream oss; oss << "The field has " << oldNbOfComp << " components and there are ";
oss << vars.size() << " variables : ";
std::copy(vars.begin(),vars.end(),std::ostream_iterator<std::string>(oss," "));
throw INTERP_KERNEL::Exception(oss.str().c_str());
return newArr;
}
-void DataArrayDouble::applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception)
+/*!
+ * This method is equivalent than DataArrayDouble::applyFunc, except that here components names are used to determine vars orders.
+ * If 'func' contains vars that are not in \c this->getInfoOnComponent() an exception will be thrown.
+ */
+DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
- char *funcStr=expr.compileX86();
- MYFUNCPTR funcPtr=(MYFUNCPTR)funcStr;//he he...
+ std::set<std::string> vars;
+ expr.getTrueSetOfVars(vars);
+ int oldNbOfComp=getNumberOfComponents();
+ if((int)vars.size()>oldNbOfComp)
+ {
+ std::ostringstream oss; oss << "The field has " << oldNbOfComp << " components and there are ";
+ oss << vars.size() << " variables : ";
+ std::copy(vars.begin(),vars.end(),std::ostream_iterator<std::string>(oss," "));
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ expr.prepareExprEvaluation(getVarsOnComponent());
//
- double *ptr=getPointer();
- int nbOfComp=getNumberOfComponents();
+ DataArrayDouble *newArr=DataArrayDouble::New();
int nbOfTuples=getNumberOfTuples();
- int nbOfElems=nbOfTuples*nbOfComp;
- for(int i=0;i<nbOfElems;i++,ptr++)
- *ptr=funcPtr(*ptr);
- declareAsNew();
+ newArr->alloc(nbOfTuples,nbOfComp);
+ const double *ptr=getConstPointer();
+ double *ptrToFill=newArr->getPointer();
+ for(int i=0;i<nbOfTuples;i++)
+ {
+ try
+ {
+ expr.evaluateExpr(nbOfComp,ptr+i*oldNbOfComp,ptrToFill+i*nbOfComp);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ std::ostringstream oss; oss << "For tuple # " << i << " with value (";
+ std::copy(ptr+oldNbOfComp*i,ptr+oldNbOfComp*(i+1),std::ostream_iterator<double>(oss,", "));
+ oss << ") : Evaluation of function failed !" << e.what();
+ newArr->decrRef();
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return newArr;
}
-void DataArrayDouble::applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception)
+/*!
+ * This method is equivalent than DataArrayDouble::applyFunc, except that here order of vars is passed explicitely in parameter.
+ * In 'func' contains vars not in 'varsOrder' an exception will be thrown.
+ */
+DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
- char *funcStr=expr.compileX86_64();
- MYFUNCPTR funcPtr=(MYFUNCPTR)funcStr;//he he...
+ std::set<std::string> vars;
+ expr.getTrueSetOfVars(vars);
+ int oldNbOfComp=getNumberOfComponents();
+ if((int)vars.size()>oldNbOfComp)
+ {
+ std::ostringstream oss; oss << "The field has " << oldNbOfComp << " components and there are ";
+ oss << vars.size() << " variables : ";
+ std::copy(vars.begin(),vars.end(),std::ostream_iterator<std::string>(oss," "));
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ expr.prepareExprEvaluation(varsOrder);
//
- double *ptr=getPointer();
- int nbOfComp=getNumberOfComponents();
+ DataArrayDouble *newArr=DataArrayDouble::New();
+ int nbOfTuples=getNumberOfTuples();
+ newArr->alloc(nbOfTuples,nbOfComp);
+ const double *ptr=getConstPointer();
+ double *ptrToFill=newArr->getPointer();
+ for(int i=0;i<nbOfTuples;i++)
+ {
+ try
+ {
+ expr.evaluateExpr(nbOfComp,ptr+i*oldNbOfComp,ptrToFill+i*nbOfComp);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ std::ostringstream oss; oss << "For tuple # " << i << " with value (";
+ std::copy(ptr+oldNbOfComp*i,ptr+oldNbOfComp*(i+1),std::ostream_iterator<double>(oss,", "));
+ oss << ") : Evaluation of function failed !" << e.what();
+ newArr->decrRef();
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return newArr;
+}
+
+void DataArrayDouble::applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ INTERP_KERNEL::ExprParser expr(func);
+ expr.parse();
+ char *funcStr=expr.compileX86();
+ MYFUNCPTR funcPtr;
+ *((void **)&funcPtr)=funcStr;//he he...
+ //
+ double *ptr=getPointer();
+ int nbOfComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ int nbOfElems=nbOfTuples*nbOfComp;
+ for(int i=0;i<nbOfElems;i++,ptr++)
+ *ptr=funcPtr(*ptr);
+ declareAsNew();
+}
+
+void DataArrayDouble::applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ INTERP_KERNEL::ExprParser expr(func);
+ expr.parse();
+ char *funcStr=expr.compileX86_64();
+ MYFUNCPTR funcPtr;
+ *((void **)&funcPtr)=funcStr;//he he...
+ //
+ double *ptr=getPointer();
+ int nbOfComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
int nbOfElems=nbOfTuples*nbOfComp;
for(int i=0;i<nbOfElems;i++,ptr++)
DataArrayDouble *DataArrayDouble::Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
{
- int nbOfComp=a1->getNumberOfComponents();
- if(nbOfComp!=a2->getNumberOfComponents())
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array add !");
- int nbOfTuple=a1->getNumberOfTuples();
- if(nbOfTuple!=a2->getNumberOfTuples())
- throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array add !");
+ int nbOfTuple=a2->getNumberOfTuples();
+ int nbOfComp=a2->getNumberOfComponents();
+ a1->checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array Add !");
DataArrayDouble *ret=DataArrayDouble::New();
ret->alloc(nbOfTuple,nbOfComp);
std::transform(a1->getConstPointer(),a1->getConstPointer()+nbOfTuple*nbOfComp,a2->getConstPointer(),ret->getPointer(),std::plus<double>());
void DataArrayDouble::addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
{
- int nbOfComp=getNumberOfComponents();
- if(nbOfComp!=other->getNumberOfComponents())
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array add !");
- int nbOfTuple=getNumberOfTuples();
- if(nbOfTuple!=other->getNumberOfTuples())
- throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array add !");
+ int nbOfTuple=other->getNumberOfTuples();
+ int nbOfComp=other->getNumberOfComponents();
+ checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array add equal !");
std::transform(getConstPointer(),getConstPointer()+nbOfTuple*nbOfComp,other->getConstPointer(),getPointer(),std::plus<double>());
declareAsNew();
}
DataArrayDouble *DataArrayDouble::Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
{
- int nbOfComp=a1->getNumberOfComponents();
- if(nbOfComp!=a2->getNumberOfComponents())
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array Substract !");
- int nbOfTuple=a1->getNumberOfTuples();
- if(nbOfTuple!=a2->getNumberOfTuples())
- throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Substract !");
+ int nbOfTuple=a2->getNumberOfTuples();
+ int nbOfComp=a2->getNumberOfComponents();
+ a1->checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array Substract !");
DataArrayDouble *ret=DataArrayDouble::New();
ret->alloc(nbOfTuple,nbOfComp);
std::transform(a1->getConstPointer(),a1->getConstPointer()+nbOfTuple*nbOfComp,a2->getConstPointer(),ret->getPointer(),std::minus<double>());
void DataArrayDouble::substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
{
- int nbOfComp=getNumberOfComponents();
- if(nbOfComp!=other->getNumberOfComponents())
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array substract !");
- int nbOfTuple=getNumberOfTuples();
- if(nbOfTuple!=other->getNumberOfTuples())
- throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array substract !");
+ int nbOfTuple=other->getNumberOfTuples();
+ int nbOfComp=other->getNumberOfComponents();
+ checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array substract equal !");
std::transform(getConstPointer(),getConstPointer()+nbOfTuple*nbOfComp,other->getConstPointer(),getPointer(),std::minus<double>());
declareAsNew();
}
int nbOfComp=a1->getNumberOfComponents();
int nbOfComp2=a2->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
- throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array multiply !");
+ throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Multiply !");
DataArrayDouble *ret=0;
if(nbOfComp==nbOfComp2)
{
ret->copyStringInfoFrom(*aMax);
}
else
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array multiply !");
+ throw INTERP_KERNEL::Exception("Nb of components mismatch for array Multiply !");
}
return ret;
}
int nbOfComp=a1->getNumberOfComponents();
int nbOfComp2=a2->getNumberOfComponents();
if(nbOfTuple!=nbOfTuple2)
- throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array divide !");
+ throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Divide !");
DataArrayDouble *ret=0;
if(nbOfComp==nbOfComp2)
{
ret->copyStringInfoFrom(*a1);
}
else
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array divide !");
+ throw INTERP_KERNEL::Exception("Nb of components mismatch for array Divide !");
}
return ret;
}
declareAsNew();
}
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * Server side.
+ */
+void DataArrayDouble::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+{
+ tinyInfo.resize(2);
+ if(isAllocated())
+ {
+ tinyInfo[0]=getNumberOfTuples();
+ tinyInfo[1]=getNumberOfComponents();
+ }
+ else
+ {
+ tinyInfo[0]=-1;
+ tinyInfo[1]=-1;
+ }
+}
+
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * Server side.
+ */
+void DataArrayDouble::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
+{
+ if(isAllocated())
+ {
+ int nbOfCompo=getNumberOfComponents();
+ tinyInfo.resize(nbOfCompo+1);
+ tinyInfo[0]=getName();
+ for(int i=0;i<nbOfCompo;i++)
+ tinyInfo[i+1]=getInfoOnComponent(i);
+ }
+ else
+ {
+ tinyInfo.resize(1);
+ tinyInfo[0]=getName();
+ }
+}
+
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * This method returns if a feeding is needed.
+ */
+bool DataArrayDouble::resizeForUnserialization(const std::vector<int>& tinyInfoI)
+{
+ int nbOfTuple=tinyInfoI[0];
+ int nbOfComp=tinyInfoI[1];
+ if(nbOfTuple!=-1 || nbOfComp!=-1)
+ {
+ alloc(nbOfTuple,nbOfComp);
+ return true;
+ }
+ return false;
+}
+
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ */
+void DataArrayDouble::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
+{
+ setName(tinyInfoS[0].c_str());
+ if(isAllocated())
+ {
+ int nbOfCompo=getNumberOfComponents();
+ for(int i=0;i<nbOfCompo;i++)
+ setInfoOnComponent(i,tinyInfoS[i+1].c_str());
+ }
+}
+
DataArrayInt *DataArrayInt::New()
{
return new DataArrayInt;
}
}
+void DataArrayInt::cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception)
+{
+ other.checkAllocated();
+ int nbOfTuples=other.getNumberOfTuples();
+ int nbOfComp=other.getNumberOfComponents();
+ allocIfNecessary(nbOfTuples,nbOfComp);
+ int nbOfElems=nbOfTuples*nbOfComp;
+ int *pt=getPointer();
+ const int *ptI=other.getConstPointer();
+ for(int i=0;i<nbOfElems;i++)
+ pt[i]=ptI[i];
+ copyStringInfoFrom(other);
+}
+
+void DataArrayInt::allocIfNecessary(int nbOfTuple, int nbOfCompo)
+{
+ if(isAllocated())
+ {
+ if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=getNumberOfComponents())
+ alloc(nbOfTuple,nbOfCompo);
+ }
+ else
+ alloc(nbOfTuple,nbOfCompo);
+}
+
void DataArrayInt::alloc(int nbOfTuple, int nbOfCompo)
{
_nb_of_tuples=nbOfTuple;
if(!ptr)
throw INTERP_KERNEL::Exception("DataArrayInt::iota : allocate first !");
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::iota : works only for arrays with only one component!");
+ throw INTERP_KERNEL::Exception("DataArrayInt::iota : works only for arrays with only one component, you can call 'rearrange' method before !");
int ntuples=getNumberOfTuples();
for(int i=0;i<ntuples;i++)
ptr[i]=init+i;
_mem.reprZip(getNumberOfComponents(),stream);
}
-void DataArrayInt::transformWithIndArr(const int *indArr)
+void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd) throw(INTERP_KERNEL::Exception)
{
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component !");
+ throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !");
+ int nbElemsIn=std::distance(indArrBg,indArrEnd);
int nbOfTuples=getNumberOfTuples();
int *pt=getPointer();
+ for(int i=0;i<nbOfTuples;i++,pt++)
+ {
+ if(*pt>=0 && *pt<nbElemsIn)
+ *pt=indArrBg[*pt];
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::transformWithIndArr : error on tuple #" << i << " value is " << *pt << " and indirectionnal array as a size equal to " << nbElemsIn;
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ declareAsNew();
+}
+
+/*!
+ * 'this' should be allocated and with numberOfComponents set to one. If not an exception will be thrown.
+ * This method takes as input an array defined by ['arrBg','arrEnd'). The size of the array (std::distance(arrBg,arrEnd)) is equal to the number of cast + 1.
+ * The values contained in ['arrBg','arrEnd') should be sorted ascendently. No check of this will be done. If not the result is not waranted.
+ * For each cast j the value range that defines the cast is equal to [arrBg[j],arrBg[j+1]).
+ * This method returns three arrays (to be managed by the caller).
+ * This method is typically usefull for entity number spliting by types for example.
+ * Example : If 'this' contains [6,5,0,3,2,7,8,1,4] and if ['arrBg','arrEnd') contains [0,4,9] then the output of this method will be :
+ * - 'castArr' : [1,1,0,0,0,1,1,0,1]
+ * - 'rankInsideCast' : [2,1,0,3,2,3,4,1,0]
+ * - 'return' : [0,1]
+ *
+ * @param castArr is a returned param has the same number of tuples than 'this' and number of components set to one. In case of sucess, this param contains for each tuple in 'this' in which cast it holds.
+ * @param rankInsideCast is an another returned param has the same number of tuples than 'this' and number of components set to one too. In case of sucess, this param contains for each tuple its rank inside its cast.
+ * @param castsPresent the casts that 'this' contains.
+ * @throw if a value in 'this' is greater or equal to the last value of ['arrBg','arrEnd')
+ */
+void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd,
+ DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("Call splitByValueRange method on DataArrayInt with only one component, you can call 'rearrange' method before !");
+ int nbOfTuples=getNumberOfTuples();
+ std::size_t nbOfCast=std::distance(arrBg,arrEnd);
+ if(nbOfCast<2)
+ throw INTERP_KERNEL::Exception("DataArrayInt::splitByValueRange : The input array giving the cast range values should be of size >=2 !");
+ nbOfCast--;
+ const int *work=getConstPointer();
+ typedef std::reverse_iterator<const int *> rintstart;
+ rintstart bg(arrEnd);//OK no problem because size of 'arr' is greater of equal 2
+ rintstart end(arrBg);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret3=DataArrayInt::New();
+ ret1->alloc(nbOfTuples,1);
+ ret2->alloc(nbOfTuples,1);
+ int *ret1Ptr=ret1->getPointer();
+ int *ret2Ptr=ret2->getPointer();
+ std::set<std::size_t> castsDetected;
for(int i=0;i<nbOfTuples;i++)
- pt[i]=indArr[pt[i]];
+ {
+ rintstart res=std::find_if(bg,end,std::bind2nd(std::less_equal<int>(), work[i]));
+ std::size_t pos=std::distance(bg,res);
+ std::size_t pos2=nbOfCast-pos;
+ if(pos2<nbOfCast)
+ {
+ ret1Ptr[i]=(int)pos2;
+ ret2Ptr[i]=work[i]-arrBg[pos2];
+ castsDetected.insert(pos2);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::splitByValueRange : At rank #" << i << " the value is " << work[i] << " whereas the last value is " << *bg;
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ ret3->alloc((int)castsDetected.size(),1);
+ std::copy(castsDetected.begin(),castsDetected.end(),ret3->getPointer());
+ ret1->incrRef();
+ castArr=ret1;
+ ret2->incrRef();
+ rankInsideCast=ret2;
+ ret3->incrRef();
+ castsPresent=ret3;
+}
+
+DataArrayInt *DataArrayInt::transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("Call transformWithIndArrR method on DataArrayInt with only one component, you can call 'rearrange' method before !");
+ int nbElemsIn=std::distance(indArrBg,indArrEnd);
+ int nbOfTuples=getNumberOfTuples();
+ int *pt=getPointer();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ ret->alloc(nbOfTuples,1);
+ ret->fillWithValue(-1);
+ int *tmp=ret->getPointer();
+ for(int i=0;i<nbOfTuples;i++,pt++)
+ {
+ int pos=indArrBg[*pt];
+ if(pos>=0 && pos<nbElemsIn)
+ tmp[pos]=i;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::transformWithIndArrR : error on tuple #" << i << " value is " << *pt << " and indirectionnal array as a size equal to " << nbElemsIn;
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ ret->incrRef();
+ return ret;
}
/*!
declareAsNew();
}
+/*!
+ * This method expects that 'this' is allocated, if not an exception is thrown.
+ * This method in case of success returns a newly created array the user should deal with.
+ * In the case of having a renumber array in "old to new" format. More info on renumbering \ref MEDCouplingArrayRenumbering "here".
+ */
DataArrayInt *DataArrayInt::renumber(const int *old2New) const
{
int nbTuples=getNumberOfTuples();
return ret;
}
+/*!
+ * Idem than DataArrayInt::selectByTupleIdSafe except that the input array is not constructed explicitely.
+ * The convention is as python one. ['bg','end') with steps of 'step'.
+ * Returns a newly created array.
+ */
+DataArrayInt *DataArrayInt::selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception)
+{
+ if(end<bg)
+ throw INTERP_KERNEL::Exception("DataArrayInt::selectByTupleId2 : end before begin !");
+ if(step<=0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::selectByTupleId2 : invalid step should > 0 !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ int nbComp=getNumberOfComponents();
+ int newNbOfTuples=(end+1-bg)/step-1;
+ ret->alloc(newNbOfTuples,nbComp);
+ int *pt=ret->getPointer();
+ const int *srcPt=getConstPointer()+bg*nbComp;
+ for(int i=0;i<newNbOfTuples;i++,srcPt+=step*nbComp)
+ std::copy(srcPt,srcPt+nbComp,pt+i*nbComp);
+ ret->copyStringInfoFrom(*this);
+ ret->incrRef();
+ return ret;
+}
+
+/*!
+ * This method works only for arrays having single component.
+ * If this contains the array a1 containing [9,10,0,6,4,11,3,7] this method returns an array a2 [5,6,0,3,2,7,1,4].
+ * By doing a1.renumber(a2) the user will obtain array a3 equal to a1 sorted.
+ * This method is useful for renumbering (in MED file for example). This method is used by MEDCouplingFieldDouble::renumberCells when check is set to true.
+ * This method throws an exception if more 2 or more elements in 'this' are same.
+ */
+DataArrayInt *DataArrayInt::checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::checkAndPreparePermutation : number of components must == 1 !");
+ int nbTuples=getNumberOfTuples();
+ const int *pt=getConstPointer();
+ int *pt2=CheckAndPreparePermutation(pt,pt+nbTuples);
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->useArray(pt2,true,CPP_DEALLOC,nbTuples,1);
+ return ret;
+}
+
+/*!
+ * This method makes the assumption that 'this' is correctly set, and has exactly one component. If not an exception will be thrown.
+ * Given a sujective application defined by 'this' from a set of size this->getNumberOfTuples() to a set of size targetNb.
+ * 'targetNb'<this->getNumberOfTuples(). 'this' should be surjective that is to say for each id in [0,'targetNb') it exists at least one tupleId tid
+ * so that this->getIJ(tid,0)==id.
+ * If not an exception will be thrown.
+ * This method returns 2 newly allocated arrays 'arr' and 'arrI', corresponding respectively to array and its corresponding index.
+ * This method is usefull for methods that returns old2New numbering concecutive to a reduction ( MEDCouplingUMesh::zipConnectivityTraducer, MEDCouplingUMesh::zipConnectivityTraducer for example)
+ * Example : if 'this' equals [0,3,2,3,2,2,1,2] this method will return arrI=[0,1,2,6,8] arr=[0, 6, 2,4,5,7, 1,3]
+ * That is to say elt id 2 has arrI[2+1]-arrI[2]=4 places in 'this'. The corresponding tuple ids are [2,4,5,7].
+ */
+void DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : number of components must == 1 !");
+ int nbOfTuples=getNumberOfTuples();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> retI(DataArrayInt::New());
+ retI->alloc(targetNb+1,1);
+ const int *input=getConstPointer();
+ std::vector< std::vector<int> > tmp(targetNb);
+ for(int i=0;i<nbOfTuples;i++)
+ {
+ int tmp2=input[i];
+ if(tmp2<targetNb)
+ tmp[tmp2].push_back(i);
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::changeSurjectiveFormat : At pos " << i << " presence of element " << tmp2 << " higher than " << targetNb;
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ int *retIPtr=retI->getPointer();
+ *retIPtr=0;
+ for(std::vector< std::vector<int> >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++,retIPtr++)
+ retIPtr[1]=retIPtr[0]+(*it1).size();
+ if(nbOfTuples!=retI->getIJ(targetNb,0))
+ throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : big problem should never happen !");
+ ret->alloc(nbOfTuples,1);
+ int *retPtr=ret->getPointer();
+ for(std::vector< std::vector<int> >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++)
+ retPtr=std::copy((*it1).begin(),(*it1).end(),retPtr);
+ ret->incrRef();
+ retI->incrRef();
+ arr=ret;
+ arrI=retI;
+}
+
+/*!
+ * This method expects that 'this' is allocated and with only one component. If not an exception will be thrown.
+ * This method returns a newly created array with 'this->getNumberOfTuples()' tuples and 1 component.
+ * This methods returns an 'old2New' corresponding array that allows to follow the following rules :
+ * - Lower a value in tuple in 'this' is, higher is its priority.
+ * - If two tuples i and j have same value if i<j then ret[i]<ret[j]
+ * - The first tuple with the lowest value will have the value 0, inversely the last tuple with highest value will have value 'this->getNumberOfTuples()-1'
+ *
+ * Example if 'this' contains the following array : [2,0,1,1,0,1,2,0,1,1,0,0] this method returns [10,0,5,6,1,7,11,2,8,9,3,4]
+ */
+DataArrayInt *DataArrayInt::buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildPermArrPerLevel : number of components must == 1 !");
+ int nbOfTuples=getNumberOfTuples();
+ const int *pt=getConstPointer();
+ std::map<int,int> m;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ ret->alloc(nbOfTuples,1);
+ int *opt=ret->getPointer();
+ for(int i=0;i<nbOfTuples;i++,pt++,opt++)
+ {
+ int val=*pt;
+ std::map<int,int>::iterator it=m.find(val);
+ if(it!=m.end())
+ {
+ *opt=(*it).second;
+ (*it).second++;
+ }
+ else
+ {
+ *opt=0;
+ m.insert(std::pair<int,int>(val,1));
+ }
+ }
+ int sum=0;
+ for(std::map<int,int>::iterator it=m.begin();it!=m.end();it++)
+ {
+ int vt=(*it).second;
+ (*it).second=sum;
+ sum+=vt;
+ }
+ pt=getConstPointer();
+ opt=ret->getPointer();
+ for(int i=0;i<nbOfTuples;i++,pt++,opt++)
+ *opt+=m[*pt];
+ //
+ ret->incrRef();
+ return ret;
+}
+
/*!
* This method checks that 'this' is with numberofcomponents == 1 and that it is equal to
* stdext::iota() of size getNumberOfTuples. This method is particalary usefull for DataArrayInt instances
bool DataArrayInt::isUniform(int val) const
{
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::isUniform : must be applied on DataArrayInt with only one component !");
+ throw INTERP_KERNEL::Exception("DataArrayInt::isUniform : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
int nbOfTuples=getNumberOfTuples();
const int *w=getConstPointer();
const int *end=w+nbOfTuples;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
int newNbOfCompo=compoIds.size();
int oldNbOfCompo=getNumberOfComponents();
+ for(std::vector<int>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
+ DataArray::CheckValueInRange(oldNbOfCompo,(*it),"keepSelectedComponents invalid requested component");
int nbOfTuples=getNumberOfTuples();
ret->alloc(nbOfTuples,newNbOfCompo);
ret->copyPartOfStringInfoFrom(*this,compoIds);
nc[nbOfCompo*i+compoIds[j]]=*ac;
}
-void DataArrayInt::SetArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet)
-{
- if(newArray!=arrayToSet)
- {
- if(arrayToSet)
- arrayToSet->decrRef();
- arrayToSet=newArray;
- if(arrayToSet)
- arrayToSet->incrRef();
- }
-}
-
-DataArrayInt *DataArrayInt::getIdsEqual(int val) const throw(INTERP_KERNEL::Exception)
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ * 'strictCompoCompare' specifies if DataArray 'a' should have exactly same number of components and tuples than 'this' (true) or not (false). By default set to true with maximal test.
+ */
+void DataArrayInt::setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception)
{
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqual : the array must have only one component !");
- const int *cptr=getConstPointer();
- std::vector<int> res;
+ const char msg[]="DataArrayInt::setPartOfValues1";
+ checkAllocated();
+ a->checkAllocated();
+ int newNbOfTuples=DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg);
+ int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
- if(*cptr==val)
- res.push_back(i);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc(res.size(),1);
- std::copy(res.begin(),res.end(),ret->getPointer());
- return ret;
+ DataArray::CheckValueInRange(nbOfTuples,bgTuples,"invalid begin tuple value");
+ DataArray::CheckClosingParInRange(nbOfTuples,endTuples,"invalid end tuple value");
+ DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
+ DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
+ if(strictCompoCompare)
+ a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+ int *pt=getPointer()+bgTuples*nbComp+bgComp;
+ const int *srcPt=a->getConstPointer();
+ for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(int j=0;j<newNbOfComp;j++,srcPt++)
+ pt[j*stepComp]=*srcPt;
}
-DataArrayInt *DataArrayInt::getIdsEqualList(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception)
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ */
+void DataArrayInt::setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception)
{
- if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : the array must have only one component !");
- std::set<int> vals2(vals.begin(),vals.end());
- const int *cptr=getConstPointer();
- std::vector<int> res;
+ const char msg[]="DataArrayInt::setPartOfValuesSimple1";
+ checkAllocated();
+ int newNbOfTuples=DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg);
+ int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ int nbComp=getNumberOfComponents();
int nbOfTuples=getNumberOfTuples();
- for(int i=0;i<nbOfTuples;i++,cptr++)
- if(vals2.find(*cptr)!=vals2.end())
- res.push_back(i);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc(res.size(),1);
- std::copy(res.begin(),res.end(),ret->getPointer());
- return ret;
+ DataArray::CheckValueInRange(nbOfTuples,bgTuples,"invalid begin tuple value");
+ DataArray::CheckClosingParInRange(nbOfTuples,endTuples,"invalid end tuple value");
+ DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
+ DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ int *pt=getPointer()+bgTuples*nbComp+bgComp;
+ for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+ for(int j=0;j<newNbOfComp;j++)
+ pt[j*stepComp]=a;
}
-DataArrayInt *DataArrayInt::Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2)
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ * 'strictCompoCompare' specifies if DataArray 'a' should have exactly same number of components and tuples than 'this' (true) or not (false). By default set to true with maximal test.
+ */
+void DataArrayInt::setPartOfValues2(const DataArrayInt *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception)
{
- int nbOfComp=a1->getNumberOfComponents();
+ const char msg[]="DataArrayInt::setPartOfValues2";
+ checkAllocated();
+ a->checkAllocated();
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ for(const int *z=bgComp;z!=endComp;z++)
+ DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
+ int newNbOfTuples=std::distance(bgTuples,endTuples);
+ int newNbOfComp=std::distance(bgComp,endComp);
+ a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
+ if(strictCompoCompare)
+ a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+ int *pt=getPointer();
+ const int *srcPt=a->getConstPointer();
+ for(const int *w=bgTuples;w!=endTuples;w++)
+ for(const int *z=bgComp;z!=endComp;z++,srcPt++)
+ {
+ DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
+ pt[(*w)*nbComp+(*z)]=*srcPt;
+ }
+}
+
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ */
+void DataArrayInt::setPartOfValuesSimple2(int a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ for(const int *z=bgComp;z!=endComp;z++)
+ DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
+ int *pt=getPointer();
+ for(const int *w=bgTuples;w!=endTuples;w++)
+ for(const int *z=bgComp;z!=endComp;z++)
+ {
+ DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
+ pt[(*w)*nbComp+(*z)]=a;
+ }
+}
+
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ * 'strictCompoCompare' specifies if DataArray 'a' should have exactly same number of components and tuples than 'this' (true) or not (false). By default set to true with maximal test.
+ */
+void DataArrayInt::setPartOfValues3(const DataArrayInt *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception)
+{
+ const char msg[]="DataArrayInt::setPartOfValues3";
+ checkAllocated();
+ a->checkAllocated();
+ int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
+ DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ int newNbOfTuples=std::distance(bgTuples,endTuples);
+ a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
+ if(strictCompoCompare)
+ a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+ int *pt=getPointer()+bgComp;
+ const int *srcPt=a->getConstPointer();
+ for(const int *w=bgTuples;w!=endTuples;w++)
+ for(int j=0;j<newNbOfComp;j++,srcPt++)
+ {
+ DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
+ pt[(*w)*nbComp+j*stepComp]=*srcPt;
+ }
+}
+
+/*!
+ * This method performs a partial assignment of 'this' using 'a' as input. Other input parameters specifies the subpart being considered by the assignment.
+ */
+void DataArrayInt::setPartOfValuesSimple3(int a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception)
+{
+ const char msg[]="DataArrayInt::setPartOfValuesSimple3";
+ checkAllocated();
+ int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg);
+ int nbComp=getNumberOfComponents();
+ int nbOfTuples=getNumberOfTuples();
+ DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value");
+ DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value");
+ int *pt=getPointer()+bgComp;
+ for(const int *w=bgTuples;w!=endTuples;w++)
+ for(int j=0;j<newNbOfComp;j++)
+ {
+ DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id");
+ pt[(*w)*nbComp+j*stepComp]=a;
+ }
+}
+
+void DataArrayInt::SetArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet)
+{
+ if(newArray!=arrayToSet)
+ {
+ if(arrayToSet)
+ arrayToSet->decrRef();
+ arrayToSet=newArray;
+ if(arrayToSet)
+ arrayToSet->incrRef();
+ }
+}
+
+DataArrayInt *DataArrayInt::getIdsEqual(int val) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqual : the array must have only one component, you can call 'rearrange' method before !");
+ const int *cptr=getConstPointer();
+ std::vector<int> res;
+ int nbOfTuples=getNumberOfTuples();
+ for(int i=0;i<nbOfTuples;i++,cptr++)
+ if(*cptr==val)
+ res.push_back(i);
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(res.size(),1);
+ std::copy(res.begin(),res.end(),ret->getPointer());
+ return ret;
+}
+
+DataArrayInt *DataArrayInt::getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !");
+ const int *cptr=getConstPointer();
+ std::vector<int> res;
+ int nbOfTuples=getNumberOfTuples();
+ for(int i=0;i<nbOfTuples;i++,cptr++)
+ if(*cptr!=val)
+ res.push_back(i);
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(res.size(),1);
+ std::copy(res.begin(),res.end(),ret->getPointer());
+ return ret;
+}
+
+DataArrayInt *DataArrayInt::getIdsEqualList(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : the array must have only one component, you can call 'rearrange' method before !");
+ std::set<int> vals2(vals.begin(),vals.end());
+ const int *cptr=getConstPointer();
+ std::vector<int> res;
+ int nbOfTuples=getNumberOfTuples();
+ for(int i=0;i<nbOfTuples;i++,cptr++)
+ if(vals2.find(*cptr)!=vals2.end())
+ res.push_back(i);
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(res.size(),1);
+ std::copy(res.begin(),res.end(),ret->getPointer());
+ return ret;
+}
+
+DataArrayInt *DataArrayInt::getIdsNotEqualList(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : the array must have only one component, you can call 'rearrange' method before !");
+ std::set<int> vals2(vals.begin(),vals.end());
+ const int *cptr=getConstPointer();
+ std::vector<int> res;
+ int nbOfTuples=getNumberOfTuples();
+ for(int i=0;i<nbOfTuples;i++,cptr++)
+ if(vals2.find(*cptr)==vals2.end())
+ res.push_back(i);
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(res.size(),1);
+ std::copy(res.begin(),res.end(),ret->getPointer());
+ return ret;
+}
+
+/*!
+ * This method expects to be called when number of components of this is equal to one.
+ * This method returns true if it exists a tuple so that the value is contained in 'vals'.
+ * If not any tuple contains one of the values contained in 'vals' false is returned.
+ */
+bool DataArrayInt::presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception)
+{
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
+ std::set<int> vals2(vals.begin(),vals.end());
+ const int *cptr=getConstPointer();
+ int nbOfTuples=getNumberOfTuples();
+ bool found=false;
+ for(const int *w=cptr;w!=cptr+nbOfTuples && !found;w++)
+ found=(vals2.find(*w)!=vals2.end());
+ return found;
+}
+
+DataArrayInt *DataArrayInt::Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2)
+{
+ int nbOfComp=a1->getNumberOfComponents();
if(nbOfComp!=a2->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Nb of components mismatch for array Aggregation !");
int nbOfTuple1=a1->getNumberOfTuples();
declareAsNew();
}
+void DataArrayInt::applyLin(int a, int b) throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ int *ptr=getPointer();
+ int nbOfElems=getNbOfElems();
+ for(int i=0;i<nbOfElems;i++,ptr++)
+ *ptr=a*(*ptr)+b;
+ declareAsNew();
+}
+
+/*!
+ * This method applies the operation 'numerator/x' for each element 'x' in 'this'.
+ * If there is a value in 'this' exactly equal to 0. an exception is thrown.
+ * Warning if presence of null this is modified for each values previous than place where exception was thrown !
+ */
+void DataArrayInt::applyInv(int numerator) throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ int *ptr=getPointer();
+ int nbOfElems=getNbOfElems();
+ for(int i=0;i<nbOfElems;i++,ptr++)
+ {
+ if(*ptr!=0)
+ {
+ *ptr=numerator/(*ptr);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::applyInv : presence of null value in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents();
+ oss << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ declareAsNew();
+}
+
+void DataArrayInt::applyDivideBy(int val) throw(INTERP_KERNEL::Exception)
+{
+ if(val==0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to divide by 0 !");
+ checkAllocated();
+ int *ptr=getPointer();
+ int nbOfElems=getNbOfElems();
+ std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::divides<int>(),val));
+ declareAsNew();
+}
+
+void DataArrayInt::applyModulus(int val) throw(INTERP_KERNEL::Exception)
+{
+ if(val<=0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to operate modulus on value <= 0 !");
+ checkAllocated();
+ int *ptr=getPointer();
+ int nbOfElems=getNbOfElems();
+ std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::modulus<int>(),val));
+ declareAsNew();
+}
+
+/*!
+ * This method applies the operation 'numerator%x' for each element 'x' in 'this'.
+ * If there is a value in 'this' exactly equals or lower than 0. an exception is thrown.
+ * Warning if presence of null this is modified for each values previous than place where exception was thrown !
+ */
+void DataArrayInt::applyRModulus(int val) throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ int *ptr=getPointer();
+ int nbOfElems=getNbOfElems();
+ for(int i=0;i<nbOfElems;i++,ptr++)
+ {
+ if(*ptr>0)
+ {
+ *ptr=val%(*ptr);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::applyRModulus : presence of value <=0 in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents();
+ oss << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ declareAsNew();
+}
+
DataArrayInt *DataArrayInt::Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception)
{
std::vector<const DataArrayInt *> arr(2);
return ret;
}
+/*!
+ * This method performs the work on itself. This method works on array with number of component equal to one and allocated. If not an exception is thrown.
+ * This method conserves the number of tuples and number of components (1). No reallocation is done.
+ * For an array [3,5,1,2,0,8] it becomes [0,3,8,9,11,11]. For each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0.
+ * This could be usefull for allToAllV in MPI with contiguous policy.
+ */
+void DataArrayInt::computeOffsets() throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !");
+ int nbOfTuples=getNumberOfTuples();
+ if(nbOfTuples==0)
+ return ;
+ int *work=getPointer();
+ int tmp=work[0];
+ work[0]=0;
+ for(int i=1;i<nbOfTuples;i++)
+ {
+ int tmp2=work[i];
+ work[i]=work[i-1]+tmp;
+ tmp=tmp2;
+ }
+ declareAsNew();
+}
+
+/*!
+ * Idem DataArrayInt::computeOffsets method execpt that 'this' changes its number of tuples.
+ * After the call in case of success new number of tuples is equal to old number of tuples +1.
+ * The content in 'this' for the first old number of tuples is exactly the same than those given by
+ * DataArrayInt::computeOffsets method.
+ * For an array [3,5,1,2,0,8] it becomes [0,3,8,9,11,11,19].
+ */
+void DataArrayInt::computeOffsets2() throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets2 : only single component allowed !");
+ int nbOfTuples=getNumberOfTuples();
+ int *ret=new int[nbOfTuples+1];
+ if(nbOfTuples==0)
+ return ;
+ const int *work=getConstPointer();
+ ret[0]=0;
+ for(int i=0;i<nbOfTuples;i++)
+ ret[i+1]=work[i]+ret[i];
+ useArray(ret,true,CPP_DEALLOC,nbOfTuples+1,1);
+ declareAsNew();
+}
+
+/*!
+ * This method works on array with number of component equal to one and allocated. If not an exception is thrown.
+ * 'offsets' should be monotic ascendently. If not, an exception will be thrown.
+ * This method retrives a newly created DataArrayInt instance with 1 component and this->getNumberOfTuples()-1 tuples.
+ * If 'this' contains [0,2,3] and 'offsets' [0,3,6,10,14,20] the returned array will contain [0,1,2,6,7,8,9,10,11,12,13]
+ */
+DataArrayInt *DataArrayInt::buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : only single component allowed !");
+ offsets->checkAllocated();
+ if(offsets->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !");
+ int othNbTuples=offsets->getNumberOfTuples()-1;
+ int nbOfTuples=getNumberOfTuples();
+ int retNbOftuples=0;
+ const int *work=getConstPointer();
+ const int *offPtr=offsets->getConstPointer();
+ for(int i=0;i<nbOfTuples;i++)
+ {
+ int val=work[i];
+ if(val>=0 && val<othNbTuples)
+ {
+ int delta=offPtr[val+1]-offPtr[val];
+ if(delta>=0)
+ retNbOftuples+=delta;
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << val << " of offset array has a delta < 0 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << i << " in this contains " << val;
+ oss << " whereas offsets array is of size " << othNbTuples+1 << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ ret->alloc(retNbOftuples,1);
+ int *retPtr=ret->getPointer();
+ for(int i=0;i<nbOfTuples;i++)
+ {
+ int val=work[i];
+ int start=offPtr[val];
+ int off=offPtr[val+1]-start;
+ for(int j=0;j<off;j++,retPtr++)
+ *retPtr=start+j;
+ }
+ ret->incrRef();
+ return ret;
+}
+
/*!
* This method returns all different values found in 'this'.
*/
return ret;
}
+DataArrayInt *DataArrayInt::Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=a2->getNumberOfTuples();
+ int nbOfComp=a2->getNumberOfComponents();
+ a1->checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array Add !");
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(nbOfTuple,nbOfComp);
+ std::transform(a1->getConstPointer(),a1->getConstPointer()+nbOfTuple*nbOfComp,a2->getConstPointer(),ret->getPointer(),std::plus<int>());
+ ret->copyStringInfoFrom(*a1);
+ return ret;
+}
+
+void DataArrayInt::addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=other->getNumberOfTuples();
+ int nbOfComp=other->getNumberOfComponents();
+ checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array add equal !");
+ std::transform(getConstPointer(),getConstPointer()+nbOfTuple*nbOfComp,other->getConstPointer(),getPointer(),std::plus<int>());
+ declareAsNew();
+}
+
+DataArrayInt *DataArrayInt::Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=a2->getNumberOfTuples();
+ int nbOfComp=a2->getNumberOfComponents();
+ a1->checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array Substract !");
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(nbOfTuple,nbOfComp);
+ std::transform(a1->getConstPointer(),a1->getConstPointer()+nbOfTuple*nbOfComp,a2->getConstPointer(),ret->getPointer(),std::minus<int>());
+ ret->copyStringInfoFrom(*a1);
+ return ret;
+}
+
+void DataArrayInt::substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=other->getNumberOfTuples();
+ int nbOfComp=other->getNumberOfComponents();
+ checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array substract equal !");
+ std::transform(getConstPointer(),getConstPointer()+nbOfTuple*nbOfComp,other->getConstPointer(),getPointer(),std::minus<int>());
+ declareAsNew();
+}
+
+DataArrayInt *DataArrayInt::Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=a1->getNumberOfTuples();
+ int nbOfTuple2=a2->getNumberOfTuples();
+ int nbOfComp=a1->getNumberOfComponents();
+ int nbOfComp2=a2->getNumberOfComponents();
+ if(nbOfTuple!=nbOfTuple2)
+ throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Multiply !");
+ DataArrayInt *ret=0;
+ if(nbOfComp==nbOfComp2)
+ {
+ ret=DataArrayInt::New();
+ ret->alloc(nbOfTuple,nbOfComp);
+ std::transform(a1->getConstPointer(),a1->getConstPointer()+nbOfTuple*nbOfComp,a2->getConstPointer(),ret->getPointer(),std::multiplies<int>());
+ ret->copyStringInfoFrom(*a1);
+ }
+ else
+ {
+ int nbOfCompMin,nbOfCompMax;
+ const DataArrayInt *aMin, *aMax;
+ if(nbOfComp>nbOfComp2)
+ {
+ nbOfCompMin=nbOfComp2; nbOfCompMax=nbOfComp;
+ aMin=a2; aMax=a1;
+ }
+ else
+ {
+ nbOfCompMin=nbOfComp; nbOfCompMax=nbOfComp2;
+ aMin=a1; aMax=a2;
+ }
+ if(nbOfCompMin==1)
+ {
+ ret=DataArrayInt::New();
+ ret->alloc(nbOfTuple,nbOfCompMax);
+ const int *aMinPtr=aMin->getConstPointer();
+ const int *aMaxPtr=aMax->getConstPointer();
+ int *res=ret->getPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(std::multiplies<int>(),aMinPtr[i]));
+ ret->copyStringInfoFrom(*aMax);
+ }
+ else
+ throw INTERP_KERNEL::Exception("Nb of components mismatch for array Multiply !");
+ }
+ return ret;
+}
+
+void DataArrayInt::multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=getNumberOfTuples();
+ int nbOfTuple2=other->getNumberOfTuples();
+ int nbOfComp=getNumberOfComponents();
+ int nbOfComp2=other->getNumberOfComponents();
+ if(nbOfTuple!=nbOfTuple2)
+ throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array multiplyEqual !");
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(getConstPointer(),getConstPointer()+nbOfTuple*nbOfComp,other->getConstPointer(),getPointer(),std::multiplies<int>());
+ }
+ else
+ {
+ if(nbOfComp2==1)
+ {
+ const int *ptr=other->getConstPointer();
+ int *myPtr=getPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ myPtr=std::transform(myPtr,myPtr+nbOfComp,myPtr,std::bind2nd(std::multiplies<int>(),ptr[i]));
+ }
+ else
+ throw INTERP_KERNEL::Exception("Nb of components mismatch for array multiplyEqual !");
+ }
+ declareAsNew();
+}
+
+DataArrayInt *DataArrayInt::Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=a1->getNumberOfTuples();
+ int nbOfTuple2=a2->getNumberOfTuples();
+ int nbOfComp=a1->getNumberOfComponents();
+ int nbOfComp2=a2->getNumberOfComponents();
+ if(nbOfTuple!=nbOfTuple2)
+ throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Divide !");
+ DataArrayInt *ret=0;
+ if(nbOfComp==nbOfComp2)
+ {
+ ret=DataArrayInt::New();
+ ret->alloc(nbOfTuple,nbOfComp);
+ std::transform(a1->getConstPointer(),a1->getConstPointer()+nbOfTuple*nbOfComp,a2->getConstPointer(),ret->getPointer(),std::divides<int>());
+ ret->copyStringInfoFrom(*a1);
+ }
+ else
+ {
+ if(nbOfComp2==1)
+ {
+ ret=DataArrayInt::New();
+ ret->alloc(nbOfTuple,nbOfComp);
+ const int *a2Ptr=a2->getConstPointer();
+ const int *a1Ptr=a1->getConstPointer();
+ int *res=ret->getPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ res=std::transform(a1Ptr+i*nbOfComp,a1Ptr+(i+1)*nbOfComp,res,std::bind2nd(std::divides<int>(),a2Ptr[i]));
+ ret->copyStringInfoFrom(*a1);
+ }
+ else
+ throw INTERP_KERNEL::Exception("Nb of components mismatch for array Divide !");
+ }
+ return ret;
+}
+
+void DataArrayInt::divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=getNumberOfTuples();
+ int nbOfTuple2=other->getNumberOfTuples();
+ int nbOfComp=getNumberOfComponents();
+ int nbOfComp2=other->getNumberOfComponents();
+ if(nbOfTuple!=nbOfTuple2)
+ throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array divideEqual !");
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(getConstPointer(),getConstPointer()+nbOfTuple*nbOfComp,other->getConstPointer(),getPointer(),std::divides<int>());
+ }
+ else
+ {
+ if(nbOfComp2==1)
+ {
+ const int *ptr=other->getConstPointer();
+ int *myPtr=getPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ myPtr=std::transform(myPtr,myPtr+nbOfComp,myPtr,std::bind2nd(std::divides<int>(),ptr[i]));
+ }
+ else
+ throw INTERP_KERNEL::Exception("Nb of components mismatch for array divideEqual !");
+ }
+ declareAsNew();
+}
+
+DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=a2->getNumberOfTuples();
+ int nbOfComp=a2->getNumberOfComponents();
+ a1->checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array Modulus");
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(nbOfTuple,nbOfComp);
+ std::transform(a1->getConstPointer(),a1->getConstPointer()+nbOfTuple*nbOfComp,a2->getConstPointer(),ret->getPointer(),std::modulus<int>());
+ ret->copyStringInfoFrom(*a1);
+ return ret;
+}
+
+void DataArrayInt::modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuple=other->getNumberOfTuples();
+ int nbOfComp=other->getNumberOfComponents();
+ checkNbOfTuplesAndComp(nbOfTuple,nbOfComp,"Nb of components mismatch for array modulus equal");
+ std::transform(getConstPointer(),getConstPointer()+nbOfTuple*nbOfComp,other->getConstPointer(),getPointer(),std::modulus<int>());
+ declareAsNew();
+}
+
int *DataArrayInt::CheckAndPreparePermutation(const int *start, const int *end)
{
int sz=std::distance(start,end);
delete [] work;
return ret;
}
+
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * Server side.
+ */
+void DataArrayInt::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
+{
+ tinyInfo.resize(2);
+ if(isAllocated())
+ {
+ tinyInfo[0]=getNumberOfTuples();
+ tinyInfo[1]=getNumberOfComponents();
+ }
+ else
+ {
+ tinyInfo[0]=-1;
+ tinyInfo[1]=-1;
+ }
+}
+
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * Server side.
+ */
+void DataArrayInt::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
+{
+ if(isAllocated())
+ {
+ int nbOfCompo=getNumberOfComponents();
+ tinyInfo.resize(nbOfCompo+1);
+ tinyInfo[0]=getName();
+ for(int i=0;i<nbOfCompo;i++)
+ tinyInfo[i+1]=getInfoOnComponent(i);
+ }
+ else
+ {
+ tinyInfo.resize(1);
+ tinyInfo[0]=getName();
+ }
+}
+
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * This method returns if a feeding is needed.
+ */
+bool DataArrayInt::resizeForUnserialization(const std::vector<int>& tinyInfoI)
+{
+ int nbOfTuple=tinyInfoI[0];
+ int nbOfComp=tinyInfoI[1];
+ if(nbOfTuple!=-1 || nbOfComp!=-1)
+ {
+ alloc(nbOfTuple,nbOfComp);
+ return true;
+ }
+ return false;
+}
+
+/*!
+ * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
+ * This method returns if a feeding is needed.
+ */
+void DataArrayInt::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
+{
+ setName(tinyInfoS[0].c_str());
+ if(isAllocated())
+ {
+ int nbOfCompo=getNumberOfComponents();
+ for(int i=0;i<nbOfCompo;i++)
+ setInfoOnComponent(i,tinyInfoS[i+1].c_str());
+ }
+}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGMEMARRAY_HXX__
MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
MEDCOUPLING_EXPORT std::string getName() const { return _name; }
MEDCOUPLING_EXPORT const std::vector<std::string> &getInfoOnComponent() const { return _info_on_compo; }
+ MEDCOUPLING_EXPORT std::vector<std::string> getVarsOnComponent() const;
+ MEDCOUPLING_EXPORT std::vector<std::string> getUnitsOnComponent() const;
MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getNumberOfComponents() const { return _info_on_compo.size(); }
MEDCOUPLING_EXPORT int getNumberOfTuples() const { return _nb_of_tuples; }
MEDCOUPLING_EXPORT int getNbOfElems() const { return _info_on_compo.size()*_nb_of_tuples; }
+ MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void checkNbOfElems(int nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
protected:
DataArray():_nb_of_tuples(-1) { }
+ protected:
+ static void CheckValueInRange(int ref, int value, const char *msg) throw(INTERP_KERNEL::Exception);
+ static void CheckClosingParInRange(int ref, int value, const char *msg) throw(INTERP_KERNEL::Exception);
+ static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
protected:
int _nb_of_tuples;
std::string _name;
MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *deepCpy() const;
MEDCOUPLING_EXPORT DataArrayDouble *performCpy(bool deepCpy) const;
+ MEDCOUPLING_EXPORT void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo);
+ MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo);
MEDCOUPLING_EXPORT void fillWithZero() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void iota(double init=0.) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isUniform(double val, double eps) const;
MEDCOUPLING_EXPORT void sort() throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void checkMonotonic(double eps) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isMonotonic(double eps) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT std::string repr() const;
MEDCOUPLING_EXPORT std::string reprZip() const;
MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
MEDCOUPLING_EXPORT DataArrayDouble *renumberAndReduce(const int *old2New, int newNbOfTuple) const;
MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues2(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple2(double a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues3(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple3(double a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
MEDCOUPLING_EXPORT DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
//! nothing to do here because this class does not aggregate any TimeLabel instance.
- MEDCOUPLING_EXPORT void updateTime() { }
+ MEDCOUPLING_EXPORT void updateTime() const { }
+ public:
+ void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+ bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
+ void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
private:
DataArrayDouble() { }
private:
MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *deepCpy() const;
MEDCOUPLING_EXPORT DataArrayInt *performCpy(bool deepCpy) const;
+ MEDCOUPLING_EXPORT void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo);
+ MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo);
MEDCOUPLING_EXPORT bool isEqual(const DataArrayInt& other) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayInt& other) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArr);
+ MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd,
+ DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const;
MEDCOUPLING_EXPORT DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const;
//!alloc or useArray should have been called before.
MEDCOUPLING_EXPORT DataArrayInt *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const;
MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
MEDCOUPLING_EXPORT DataArrayInt *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isIdentity() const;
MEDCOUPLING_EXPORT bool isUniform(int val) const;
MEDCOUPLING_EXPORT DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayInt *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues2(const DataArrayInt *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple2(int a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValues3(const DataArrayInt *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void setPartOfValuesSimple3(int a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
MEDCOUPLING_EXPORT static void SetArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet);
MEDCOUPLING_EXPORT const int *getConstPointer() const { return _mem.getConstPointer(); }
MEDCOUPLING_EXPORT DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *getIdsEqualList(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqualList(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void applyModulus(int val) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2);
MEDCOUPLING_EXPORT static DataArrayInt *Aggregate(const std::vector<const DataArrayInt *>& a) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void computeOffsets() throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void computeOffsets2() throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT std::set<int> getDifferentValues() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void useArray(const int *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
MEDCOUPLING_EXPORT void writeOnPlace(int id, int element0, const int *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
+ MEDCOUPLING_EXPORT static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
//! nothing to do here because this class does not aggregate any TimeLabel instance.
- MEDCOUPLING_EXPORT void updateTime() { }
+ MEDCOUPLING_EXPORT void updateTime() const { }
public:
MEDCOUPLING_EXPORT static int *CheckAndPreparePermutation(const int *start, const int *end);
+ public:
+ void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
+ void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
+ bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
+ void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
private:
DataArrayInt() { }
private:
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGMEMARRAY_TXX__
#define __PARAMEDMEM_MEDCOUPLINGMEMARRAY_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingMesh.hxx"
#include "MEDCouplingAutoRefCountObjectPtr.hxx"
#include <set>
+#include <cmath>
#include <sstream>
#include <iterator>
using namespace ParaMEDMEM;
+MEDCouplingMesh::MEDCouplingMesh():_time(0.),_iteration(-1),_order(-1)
+{
+}
+
+MEDCouplingMesh::MEDCouplingMesh(const MEDCouplingMesh& other):_name(other._name),_description(other._description),
+ _time(other._time),_iteration(other._iteration),
+ _order(other._order),_time_unit(other._time_unit)
+{
+}
+
/*!
* This method is only for ParaMEDMEM in ParaFIELD constructor.
*/
bool MEDCouplingMesh::isEqual(const MEDCouplingMesh *other, double prec) const
{
- return _name==other->_name;
+ return _name==other->_name && _description==other->_description && _iteration==other->_iteration
+ && _order==other->_order && _time_unit==other->_time_unit && fabs(_time-other->_time)<1e-12;
}
/*!
void MEDCouplingMesh::copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception)
{
_name=other->_name;
+ _description=other->_description;
+ _time_unit=other->_time_unit;
+}
+
+/*!
+ * This method copies all attributes that are \b NOT arrays in this.
+ * All tiny attributes not usefully for state of 'this' are ignored.
+ */
+void MEDCouplingMesh::copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception)
+{
+ copyTinyStringsFrom(other);
+ _time=other->_time;
+ _iteration=other->_iteration;
+ _order=other->_order;
}
/*!
return ret;
}
+/*!
+ * This method builds a field lying on 'this' with 'nbOfComp' components.
+ * 'func' is a string that is the expression to evaluate.
+ * The return field will have type specified by 't'. 't' is also used to determine where values of field will be
+ * evaluate. This method is different than MEDCouplingMesh::fillFromAnalytic, because the info on components are used here to determine vars pos in 'func'.
+ *
+ * @param t type of field returned and specifies where the evaluation of func will be done.
+ * @param nbOfComp number of components of returned field.
+ * @param func expression.
+ * @return field with counter = 1.
+ */
+MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,NO_TIME);
+ ret->setMesh(this);
+ ret->fillFromAnalytic2(nbOfComp,func);
+ ret->incrRef();
+ return ret;
+}
+
+/*!
+ * This method builds a field lying on 'this' with 'nbOfComp' components.
+ * 'func' is a string that is the expression to evaluate.
+ * The return field will have type specified by 't'. 't' is also used to determine where values of field will be
+ * evaluate. This method is different than MEDCouplingMesh::fillFromAnalytic, because 'varsOrder' specifies the pos to assign of vars in 'func'.
+ *
+ * @param t type of field returned and specifies where the evaluation of func will be done.
+ * @param nbOfComp number of components of returned field.
+ * @param func expression.
+ * @return field with counter = 1.
+ */
+MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,NO_TIME);
+ ret->setMesh(this);
+ ret->fillFromAnalytic3(nbOfComp,varsOrder,func);
+ ret->incrRef();
+ return ret;
+}
+
/*!
* retruns a newly created mesh with counter=1
* that is the union of mesh1 and mesh2 if possible. The cells of mesh2 will appear after cells of 'mesh1'. Idem for nodes.
{
return mesh1->mergeMyselfWith(mesh2);
}
+
+void MEDCouplingMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
+{
+ int ret=getCellContainingPoint(pos,eps);
+ elts.push_back(ret);
+}
+
+void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, std::vector<int>& elts, std::vector<int>& eltsIndex) const
+{
+ eltsIndex.resize(nbOfPoints+1);
+ eltsIndex[0]=0;
+ elts.clear();
+ int spaceDim=getSpaceDimension();
+ const double *work=pos;
+ for(int i=0;i<nbOfPoints;i++,work+=spaceDim)
+ {
+ int ret=getCellContainingPoint(work,eps);
+ if(ret>=0)
+ {
+ elts.push_back(ret);
+ eltsIndex[i+1]=eltsIndex[i]+1;
+ }
+ else
+ eltsIndex[i+1]=eltsIndex[i];
+ }
+}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGMESH_HXX__
#include "NormalizedUnstructuredMesh.hxx"
#include "InterpKernelException.hxx"
+#include <set>
#include <vector>
namespace ParaMEDMEM
public:
void setName(const char *name) { _name=name; }
const char *getName() const { return _name.c_str(); }
+ void setDescription(const char *descr) { _description=descr; }
+ const char *getDescription() const { return _description.c_str(); }
+ double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; }
+ void setTime(double val, int iteration, int order) { _time=val; _iteration=iteration; _order=order; }
+ void setTimeUnit(const char *unit) { _time_unit=unit; }
+ const char *getTimeUnit() const { return _time_unit.c_str(); }
virtual MEDCouplingMesh *deepCpy() const = 0;
virtual MEDCouplingMeshType getType() const = 0;
bool isStructured() const;
virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
+ virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
// comparison methods
virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const = 0;
DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception);
//
virtual void checkCoherency() const throw(INTERP_KERNEL::Exception) = 0;
+ virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception) = 0;
+ virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception) = 0;
virtual int getNumberOfCells() const = 0;
virtual int getNumberOfNodes() const = 0;
virtual int getSpaceDimension() const = 0;
virtual DataArrayDouble *getBarycenterAndOwner() const = 0;
virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0;
virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const = 0;
+ virtual std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const = 0;
virtual void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const = 0;
virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const;
virtual void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const = 0;
virtual std::string simpleRepr() const = 0;
virtual std::string advancedRepr() const = 0;
// tools
+ virtual DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception) = 0;
+ virtual void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception) = 0;
virtual void getBoundingBox(double *bbox) const = 0;
virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const = 0;
virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const = 0;
virtual int getCellContainingPoint(const double *pos, double eps) const = 0;
+ virtual void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
+ virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, std::vector<int>& elts, std::vector<int>& eltsIndex) const;
virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const;
virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const;
+ virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const;
+ virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const;
virtual MEDCouplingFieldDouble *buildOrthogonalField() const = 0;
virtual void rotate(const double *center, const double *vector, double angle) = 0;
virtual void translate(const double *vector) = 0;
virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
//serialisation-unserialization
- virtual void getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const = 0;
+ virtual void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const = 0;
virtual void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const = 0;
virtual void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const = 0;
- virtual void unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings) = 0;
protected:
- MEDCouplingMesh() { }
- MEDCouplingMesh(const MEDCouplingMesh& other):_name(other._name) { }
+ MEDCouplingMesh();
+ MEDCouplingMesh(const MEDCouplingMesh& other);
virtual ~MEDCouplingMesh() { }
private:
std::string _name;
+ std::string _description;
+ double _time;
+ int _iteration;
+ int _order;
+ std::string _time_unit;
};
}
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "MEDCouplingMultiFields.hxx"
+#include "MEDCouplingFieldTemplate.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingMesh.hxx"
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+
+using namespace ParaMEDMEM;
+
+MEDCouplingMultiFields *MEDCouplingMultiFields::New(const std::vector<MEDCouplingFieldDouble *>& fs) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDCouplingMultiFields(fs);
+}
+
+MEDCouplingMultiFields *MEDCouplingMultiFields::New()
+{
+ return new MEDCouplingMultiFields;
+}
+
+MEDCouplingMultiFields *MEDCouplingMultiFields::deepCpy() const
+{
+ return new MEDCouplingMultiFields(*this);
+}
+
+bool MEDCouplingMultiFields::isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const
+{
+ std::size_t sz=_fs.size();
+ if(sz!=other->_fs.size())
+ return false;
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const MEDCouplingFieldDouble *f1=_fs[i];
+ const MEDCouplingFieldDouble *f2=other->_fs[i];
+ if(f1!=f2)
+ {
+ if(f1==0 || f2==0)
+ return false;
+ if(!_fs[i]->isEqual(other->_fs[i],meshPrec,valsPrec))
+ return false;
+ }
+ }
+ std::vector<int> refs1,refs2;
+ std::vector<MEDCouplingMesh *> ms1=getDifferentMeshes(refs1);
+ std::vector<MEDCouplingMesh *> ms2=other->getDifferentMeshes(refs2);
+ if(ms1.size()!=ms2.size())
+ return false;
+ if(refs1!=refs2)
+ return false;
+ std::vector< std::vector<int> > refs3,refs4;
+ std::vector<DataArrayDouble *> das1=getDifferentArrays(refs3);
+ std::vector<DataArrayDouble *> das2=getDifferentArrays(refs4);
+ if(das1.size()!=das2.size())
+ return false;
+ if(refs3!=refs4)
+ return false;
+ return true;
+}
+
+std::string MEDCouplingMultiFields::getName() const
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ for(;it!=_fs.end();it++)
+ if((const MEDCouplingFieldDouble *)(*it))
+ return (*it)->getName();
+ return std::string();
+}
+
+std::string MEDCouplingMultiFields::getDescription() const
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ for(;it!=_fs.end();it++)
+ if((const MEDCouplingFieldDouble *)(*it))
+ return (*it)->getDescription();
+ return std::string();
+}
+
+std::string MEDCouplingMultiFields::getTimeUnit() const
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ for(;it!=_fs.end();it++)
+ if((const MEDCouplingFieldDouble *)(*it))
+ return (*it)->getTimeUnit();
+ return std::string();
+}
+
+double MEDCouplingMultiFields::getTimeResolution() const throw(INTERP_KERNEL::Exception)
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ for(;it!=_fs.end();it++)
+ if((const MEDCouplingFieldDouble *)(*it))
+ return (*it)->getTimeTolerance();
+ throw INTERP_KERNEL::Exception("MEDCouplingMultiFields::getTimeResolution : no not null field !");
+}
+
+std::string MEDCouplingMultiFields::simpleRepr() const
+{
+ std::ostringstream ret;
+ ret << "MEDCouplingMultiFields with name : \"" << getName() << "\"\n";
+ ret << "Description of MEDCouplingMultiFields is : \"" << getDescription() << "\"\n";
+ ret << "Number of discretization : " << _fs.size() << "\n";
+ ret << "Number of different meshes : ";
+ std::vector<MEDCouplingMesh *> ms;
+ std::vector<int> refms;
+ try
+ {
+ ms=getDifferentMeshes(refms);
+ ret << ms.size() << "\n";
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ { ret << "Current instance is INVALID !\n"; }
+ return ret.str();
+}
+
+std::string MEDCouplingMultiFields::advancedRepr() const
+{
+ return simpleRepr();
+}
+
+bool MEDCouplingMultiFields::isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const
+{
+ std::size_t sz=_fs.size();
+ if(sz!=other->_fs.size())
+ return false;
+ for(std::size_t i=0;i<sz;i++)
+ if(!_fs[i]->isEqualWithoutConsideringStr(other->_fs[i],meshPrec,valsPrec))
+ return false;
+ return true;
+}
+
+const MEDCouplingFieldDouble *MEDCouplingMultiFields::getFieldWithId(int id) const throw(INTERP_KERNEL::Exception)
+{
+ if(id>=(int)_fs.size() || id < 0)
+ throw INTERP_KERNEL::Exception("MEDCouplingMultiFields::getFieldWithId : invalid id outside boundaries !");
+ return _fs[id];
+}
+
+std::vector<const MEDCouplingFieldDouble *> MEDCouplingMultiFields::getFields() const
+{
+ std::vector<const MEDCouplingFieldDouble *> ret(_fs.size());
+ std::copy(_fs.begin(),_fs.end(),ret.begin());
+ return ret;
+}
+
+int MEDCouplingMultiFields::getNumberOfFields() const
+{
+ return _fs.size();
+}
+
+const MEDCouplingFieldDouble *MEDCouplingMultiFields::getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception)
+{
+ if(id<0 || id>=(int)_fs.size())
+ {
+ std::ostringstream oss; oss << "MEDCouplingMultiFields::getFieldAtPos : Invalid given pos : should be >=0 and < " << _fs.size() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return _fs[id];
+}
+
+void MEDCouplingMultiFields::updateTime() const
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ for(;it!=_fs.end();it++)
+ if((const MEDCouplingFieldDouble *)(*it))
+ (*it)->updateTime();
+ it=_fs.begin();
+ for(;it!=_fs.end();it++)
+ if((const MEDCouplingFieldDouble *)(*it))
+ updateTimeWith(*(*it));
+}
+
+std::vector<MEDCouplingMesh *> MEDCouplingMultiFields::getMeshes() const throw(INTERP_KERNEL::Exception)
+{
+ std::vector<MEDCouplingMesh *> ms;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
+ {
+ const MEDCouplingMesh *m=0;
+ if((const MEDCouplingFieldDouble *)(*it))
+ m=(*it)->getMesh();
+ ms.push_back(const_cast<MEDCouplingMesh *>(m));
+ }
+ return ms;
+}
+
+std::vector<MEDCouplingMesh *> MEDCouplingMultiFields::getDifferentMeshes(std::vector<int>& refs) const throw(INTERP_KERNEL::Exception)
+{
+ refs.resize(_fs.size());
+ std::vector<MEDCouplingMesh *> ms;
+ int id=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++)
+ {
+ const MEDCouplingMesh *m=0;
+ if((const MEDCouplingFieldDouble *)(*it))
+ m=(*it)->getMesh();
+ if(m)
+ {
+ std::vector<MEDCouplingMesh *>::iterator it=std::find(ms.begin(),ms.end(),m);
+ if(it==ms.end())
+ {
+ ms.push_back(const_cast<MEDCouplingMesh *>(m));
+ refs[id]=ms.size()-1;
+ }
+ else
+ refs[id]=std::distance(ms.begin(),it);
+ }
+ else
+ refs[id]=-1;
+ }
+ return ms;
+}
+
+std::vector<DataArrayDouble *> MEDCouplingMultiFields::getArrays() const throw(INTERP_KERNEL::Exception)
+{
+ std::vector<DataArrayDouble *> tmp;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++)
+ {
+ std::vector<DataArrayDouble *> tmp2=(*it)->getArrays();
+ tmp.insert(tmp.end(),tmp2.begin(),tmp2.end());
+ }
+ return tmp;
+}
+
+std::vector<DataArrayDouble *> MEDCouplingMultiFields::getDifferentArrays(std::vector< std::vector<int> >& refs) const throw(INTERP_KERNEL::Exception)
+{
+ refs.resize(_fs.size());
+ int id=0;
+ std::vector<DataArrayDouble *> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();it!=_fs.end();it++,id++)
+ {
+ std::vector<DataArrayDouble *> tmp2;
+ if((const MEDCouplingFieldDouble *)(*it))
+ {
+ tmp2=(*it)->getArrays();
+ refs[id].resize(tmp2.size());
+ }
+ else
+ refs[id].clear();
+ int id2=0;
+ for(std::vector<DataArrayDouble *>::const_iterator it2=tmp2.begin();it2!=tmp2.end();it2++,id2++)
+ {
+ if(*it2)
+ {
+ std::vector<DataArrayDouble *>::iterator it3=std::find(ret.begin(),ret.end(),*it2);
+ if(it3==ret.end())
+ {
+ ret.push_back(*it2);
+ refs[id][id2]=ret.size()-1;
+ }
+ else
+ refs[id][id2]=std::distance(ret.begin(),it3);
+ }
+ else
+ refs[id][id2]=-1;
+ }
+ }
+ return ret;
+}
+
+void MEDCouplingMultiFields::checkCoherency() const throw(INTERP_KERNEL::Exception)
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> >::const_iterator it=_fs.begin();
+ for(;it!=_fs.end();it++)
+ {
+ if((const MEDCouplingFieldDouble *)(*it)==0)
+ throw INTERP_KERNEL::Exception("MEDCouplingMultiFields::checkCoherency : There is an empty Field in array...");
+ (*it)->checkCoherency();
+ }
+}
+
+MEDCouplingMultiFields::MEDCouplingMultiFields(const std::vector<MEDCouplingFieldDouble *>& fs) throw(INTERP_KERNEL::Exception):_fs(fs.size())
+{
+ int id=0;
+ for(std::vector< MEDCouplingFieldDouble * >::const_iterator it=fs.begin();it!=fs.end();it++,id++)
+ {
+ if(*it)
+ (*it)->incrRef();
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingMultiFields constructor : empty field found in vector !");
+ (*it)->checkCoherency();
+ _fs[id]=*it;
+ }
+}
+
+
+/*!
+ * Performs deepCpy.
+ */
+MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& other)
+{
+ int sz=other._fs.size();
+ _fs.resize(sz);
+ std::vector<int> refs;
+ std::vector< std::vector<int> > refs2;
+ std::vector<MEDCouplingMesh *> ms=other.getDifferentMeshes(refs);
+ int msLgh=ms.size();
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> > ms2(msLgh);
+ for(int i=0;i<msLgh;i++)
+ ms2[i]=ms[i]->deepCpy();
+ std::vector<DataArrayDouble *> das=other.getDifferentArrays(refs2);
+ int dasLgth=das.size();
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > das2(dasLgth);
+ for(int i=0;i<dasLgth;i++)
+ das2[i]=das[i]->deepCpy();
+ for(int i=0;i<sz;i++)
+ {
+ if((const MEDCouplingFieldDouble *)other._fs[i])
+ {
+ MEDCouplingFieldTemplate *tmp=MEDCouplingFieldTemplate::New(other._fs[i]);
+ _fs[i]=MEDCouplingFieldDouble::New(tmp,other._fs[i]->getTimeDiscretization());
+ tmp->decrRef();
+ if(refs[i]!=-1)
+ _fs[i]->setMesh(ms2[refs[i]]);
+ int nbOfArr=refs2[i].size();
+ std::vector<DataArrayDouble *> tmp2(nbOfArr);
+ for(int j=0;j<nbOfArr;j++)
+ {
+ if(refs2[i][j]!=-1)
+ tmp2[j]=das2[refs2[i][j]];
+ else
+ tmp2[j]=0;
+ }
+ _fs[i]->setArrays(tmp2);
+ std::vector<int> tinyInfo;
+ std::vector<double> tinyInfo2;
+ other._fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationIntInformation2(tinyInfo);
+ other._fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationDbleInformation2(tinyInfo2);
+ _fs[i]->getTimeDiscretizationUnderGround()->finishUnserialization2(tinyInfo,tinyInfo2);
+ }
+ }
+}
+
+MEDCouplingMultiFields::MEDCouplingMultiFields()
+{
+}
+
+void MEDCouplingMultiFields::getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<double>& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const
+{
+ std::vector<int> refs;
+ std::vector<MEDCouplingMesh *> ms=getDifferentMeshes(refs);
+ nbOfDiffMeshes=ms.size();
+ std::vector< std::vector<int> > refs2;
+ std::vector<DataArrayDouble *> fs=getDifferentArrays(refs2);
+ nbOfDiffArr=fs.size();
+ //
+ int sz=refs.size();//==_fs.size()
+ int sz2=0;
+ for(int i=0;i<sz;i++)
+ sz2+=refs2[i].size();
+ //
+ tinyInfo2.clear();
+ std::vector<int> doubleDaInd(sz);
+ std::vector<int> timeDiscrInt;
+ tinyInfo.resize(sz2+5*sz+3);
+ tinyInfo[0]=sz;
+ tinyInfo[1]=sz2;
+ for(int i=0;i<sz;i++)
+ {
+ std::vector<double> tmp;
+ std::vector<int> tmp2;
+ _fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationDbleInformation2(tmp);
+ _fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationIntInformation2(tmp2);
+ tinyInfo[3*sz+3+i]=tmp.size();
+ tinyInfo[4*sz+3+i]=tmp2.size();
+ tinyInfo2.insert(tinyInfo2.end(),tmp.begin(),tmp.end());
+ timeDiscrInt.insert(timeDiscrInt.end(),tmp2.begin(),tmp2.end());
+ }
+ int sz3=timeDiscrInt.size();
+ tinyInfo[2]=sz3;
+ //
+ for(int i=0;i<sz;i++)
+ tinyInfo[i+3]=refs[i];
+ for(int i=0;i<sz;i++)
+ tinyInfo[i+sz+3]=refs2[i].size();
+ for(int i=0;i<sz;i++)
+ tinyInfo[i+2*sz+3]=(int)_fs[i]->getTimeDiscretization();
+ int k=0;
+ for(int i=0;i<sz;i++)
+ for(std::vector<int>::const_iterator it=refs2[i].begin();it!=refs2[i].end();it++,k++)
+ tinyInfo[5*sz+k+3]=*it;
+ tinyInfo.insert(tinyInfo.end(),timeDiscrInt.begin(),timeDiscrInt.end());//tinyInfo has lgth==sz3+sz2+5*sz+3
+}
+
+void MEDCouplingMultiFields::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD,
+ const std::vector<MEDCouplingFieldTemplate *>& ft, const std::vector<MEDCouplingMesh *>& ms,
+ const std::vector<DataArrayDouble *>& das)
+{
+ int sz=tinyInfoI[0];
+ _fs.resize(sz);
+ int sz2=tinyInfoI[1];
+ // dealing with ft with no mesh set.
+ for(int i=0;i<sz;i++)
+ {
+ int meshId=tinyInfoI[3+i];
+ if(meshId!=-1)
+ ft[i]->setMesh(ms[meshId]);
+ }
+ // dealing with fieldtemplate->fielddouble
+ int k=0;
+ int offI=0;
+ int offD=0;
+ for(int i=0;i<sz;i++)
+ {
+ _fs[i]=MEDCouplingFieldDouble::New(ft[i],(TypeOfTimeDiscretization)tinyInfoI[2*sz+3+i]);
+ int sz3=tinyInfoI[sz+i+3];
+ std::vector<DataArrayDouble *> tmp(sz3);
+ for(int j=0;j<sz3;j++,k++)
+ {
+ int daId=tinyInfoI[5*sz+k+3];
+ if(daId!=-1)
+ tmp[j]=das[daId];
+ else
+ tmp[j]=0;
+ }
+ _fs[i]->setArrays(tmp);
+ // time discr tiny info
+ int lgthI=tinyInfoI[4*sz+3+i];
+ int lgthD=tinyInfoI[3*sz+3+i];
+ //
+ std::vector<int> tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI);
+ std::vector<double> tdInfoD(tinyInfoD.begin()+offD,tinyInfoD.begin()+offD+lgthD);
+ _fs[i]->getTimeDiscretizationUnderGround()->finishUnserialization2(tdInfoI,tdInfoD);
+ //
+ offI+=lgthI;
+ offD+=lgthD;
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#ifndef __PARAMEDMEM_MEDCOUPLINGMULTIFIELDS_HXX__
+#define __PARAMEDMEM_MEDCOUPLINGMULTIFIELDS_HXX__
+
+#include "MEDCouplingRefCountObject.hxx"
+#include "MEDCouplingTimeLabel.hxx"
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+
+#include "InterpKernelException.hxx"
+
+#include <vector>
+
+namespace ParaMEDMEM
+{
+ class MEDCouplingMesh;
+ class DataArrayDouble;
+ class MEDCouplingFieldDouble;
+ class MEDCouplingFieldTemplate;
+
+ class MEDCouplingMultiFields : public RefCountObject, public TimeLabel
+ {
+ public:
+ static MEDCouplingMultiFields *New(const std::vector<MEDCouplingFieldDouble *>& fs) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingMultiFields *New();
+ MEDCouplingMultiFields *deepCpy() const;
+ std::string getName() const;
+ std::string getDescription() const;
+ std::string getTimeUnit() const;
+ double getTimeResolution() const throw(INTERP_KERNEL::Exception);
+ virtual std::string simpleRepr() const;
+ virtual std::string advancedRepr() const;
+ virtual bool isEqual(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
+ virtual bool isEqualWithoutConsideringStr(const MEDCouplingMultiFields *other, double meshPrec, double valsPrec) const;
+ const MEDCouplingFieldDouble *getFieldWithId(int id) const throw(INTERP_KERNEL::Exception);
+ std::vector<const MEDCouplingFieldDouble *> getFields() const;
+ int getNumberOfFields() const;
+ const MEDCouplingFieldDouble *getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception);
+ virtual std::vector<MEDCouplingMesh *> getMeshes() const throw(INTERP_KERNEL::Exception);
+ virtual std::vector<MEDCouplingMesh *> getDifferentMeshes(std::vector<int>& refs) const throw(INTERP_KERNEL::Exception);
+ virtual std::vector<DataArrayDouble *> getArrays() const throw(INTERP_KERNEL::Exception);
+ virtual std::vector<DataArrayDouble *> getDifferentArrays(std::vector< std::vector<int> >& refs) const throw(INTERP_KERNEL::Exception);
+ void updateTime() const;
+ void getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<double>& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const;
+ void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD,
+ const std::vector<MEDCouplingFieldTemplate *>& ft, const std::vector<MEDCouplingMesh *>& ms,
+ const std::vector<DataArrayDouble *>& das);
+ virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
+ protected:
+ MEDCouplingMultiFields(const std::vector<MEDCouplingFieldDouble *>& fs) throw(INTERP_KERNEL::Exception);
+ MEDCouplingMultiFields(const MEDCouplingMultiFields& other);
+ MEDCouplingMultiFields();
+ protected:
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> > _fs;
+ };
+}
+
+#endif
+
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingNatureOfField.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGNATUREOFFIELD_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGNORMALIZEDCARTESIANMESH_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : MEDCouplingNormalizedCartesianMesh.txx
// Created : Mon Aug 17 12:00:38 2009
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_HXX__
typedef int MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
public:
- MEDCouplingNormalizedUnstructuredMesh(ParaMEDMEM::MEDCouplingUMesh *mesh);
+ MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingUMesh *mesh);
void getBoundingBox(double *boundingBox) const;
INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const;
unsigned char getNumberOfNodesOfElement(int eltId) const;
private:
void prepare();
private:
- ParaMEDMEM::MEDCouplingUMesh *_mesh;
+ const ParaMEDMEM::MEDCouplingUMesh *_mesh;
int *_conn_for_interp;
int *_conn_index_for_interp;
};
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_TXX__
#define __MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_TXX__
#include <limits>
template<int SPACEDIM,int MESHDIM>
-MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::MEDCouplingNormalizedUnstructuredMesh(ParaMEDMEM::MEDCouplingUMesh *mesh):_mesh(mesh)
+MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingUMesh *mesh):_mesh(mesh)
{
if(_mesh)
_mesh->incrRef();
boundingBox[i]=std::numeric_limits<double>::max();
boundingBox[SPACEDIM+i]=-std::numeric_limits<double>::max();
}
- ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords();
+ const ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords();
const double *ptr=array->getConstPointer();
int nbOfPts=array->getNbOfElems()/SPACEDIM;
for(int j=0;j<SPACEDIM;j++)
template<int SPACEDIM,int MESHDIM>
const double *MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getCoordinatesPtr() const
{
- ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords();
+ const ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords();
return array->getConstPointer();
}
MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::~MEDCouplingNormalizedUnstructuredMesh()
{
if(_mesh)
- _mesh->decrRef();
+ ((ParaMEDMEM::MEDCouplingUMesh *)_mesh)->decrRef();
releaseTempArrays();
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingPointSet.hxx"
throw INTERP_KERNEL::Exception("Unable to get space dimension because no coordinates specified !");
}
-void MEDCouplingPointSet::updateTime()
+void MEDCouplingPointSet::updateTime() const
{
if(_coords)
{
}
}
-void MEDCouplingPointSet::setCoords(DataArrayDouble *coords)
+void MEDCouplingPointSet::setCoords(const DataArrayDouble *coords)
{
if( coords != _coords )
{
if (_coords)
_coords->decrRef();
- _coords=coords;
+ _coords=const_cast<DataArrayDouble *>(coords);
if(_coords)
_coords->incrRef();
declareAsNew();
/*!
* This methods searches for each node n1 nodes in _coords that are less far than 'prec' from n1. if any these nodes are stored in params
* comm and commIndex.
- * @param limitNodeId is the limit node id. All nodes which id is strictly lower than 'limitNodeId' will not be merged.
+ * @param limitNodeId is the limit node id. All nodes which id is strictly lower than 'limitNodeId' will not be merged each other.
* @param comm out parameter (not inout)
* @param commIndex out parameter (not inout)
*/
/*!
* Given a point given by its position 'pos' this method finds the set of node ids that are a a distance lower than eps.
- * Position 'pos' is expected to be of size getSpaceDimension(). If not the behabiour is not warranted.
+ * Position 'pos' is expected to be of size getSpaceDimension()*nbOfNodes. If not the behabiour is not warranted.
* This method throws an exception if no coordiantes are set.
*/
void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, int nbOfNodes, double eps, std::vector<int>& c, std::vector<int>& cI) const throw(INTERP_KERNEL::Exception)
* This method renumber 'this' using 'newNodeNumbers' array of size this->getNumberOfNodes.
* newNbOfNodes specifies the *std::max_element(newNodeNumbers,newNodeNumbers+this->getNumberOfNodes())
* This value is asked because often known by the caller of this method.
- * @param newNodeNumbers array specifying the new numbering.
+ * @param newNodeNumbers array specifying the new numbering in old2New convention..
* @param newNbOfNodes the new number of nodes.
*/
void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNodes)
/*!
* First step of serialization process. Used by ParaMEDMEM and MEDCouplingCorba to transfert data between process.
*/
-void MEDCouplingPointSet::getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingPointSet::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
{
+ int it,order;
+ double time=getTime(it,order);
if(_coords)
{
int spaceDim=getSpaceDimension();
- littleStrings.resize(spaceDim+1);
+ littleStrings.resize(spaceDim+4);
littleStrings[0]=getName();
+ littleStrings[1]=getDescription();
+ littleStrings[2]=_coords->getName();
+ littleStrings[3]=getTimeUnit();
for(int i=0;i<spaceDim;i++)
- littleStrings[i+1]=getCoords()->getInfoOnComponent(i);
+ littleStrings[i+4]=getCoords()->getInfoOnComponent(i);
tinyInfo.clear();
tinyInfo.push_back(getType());
tinyInfo.push_back(spaceDim);
tinyInfo.push_back(getNumberOfNodes());
+ tinyInfo.push_back(it);
+ tinyInfo.push_back(order);
+ tinyInfoD.push_back(time);
}
else
{
- littleStrings.resize(1);
+ littleStrings.resize(3);
littleStrings[0]=getName();
+ littleStrings[1]=getDescription();
+ littleStrings[2]=getTimeUnit();
tinyInfo.clear();
tinyInfo.push_back(getType());
tinyInfo.push_back(-1);
tinyInfo.push_back(-1);
+ tinyInfo.push_back(it);
+ tinyInfo.push_back(order);
+ tinyInfoD.push_back(time);
}
}
{
if(_coords)
{
- a2=getCoords();
+ a2=const_cast<DataArrayDouble *>(getCoords());
a2->incrRef();
}
else
if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
{
a2->alloc(tinyInfo[2],tinyInfo[1]);
- littleStrings.resize(tinyInfo[1]+1);
+ littleStrings.resize(tinyInfo[1]+4);
}
else
{
- littleStrings.resize(1);
+ littleStrings.resize(3);
}
}
* Second and final unserialization process.
* @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
*/
-void MEDCouplingPointSet::unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
+void MEDCouplingPointSet::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
{
setCoords(a2);
setName(littleStrings[0].c_str());
+ setDescription(littleStrings[1].c_str());
+ a2->setName(littleStrings[2].c_str());
+ setTimeUnit(littleStrings[3].c_str());
for(int i=0;i<tinyInfo[1];i++)
- getCoords()->setInfoOnComponent(i,littleStrings[i+1].c_str());
+ getCoords()->setInfoOnComponent(i,littleStrings[i+4].c_str());
+ setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
}
else
- setName(littleStrings[0].c_str());
+ {
+ setName(littleStrings[0].c_str());
+ setDescription(littleStrings[1].c_str());
+ setTimeUnit(littleStrings[2].c_str());
+ setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
+ }
}
/*!
*/
MEDCouplingMesh *MEDCouplingPointSet::buildPart(const int *start, const int *end) const
{
- return buildPartOfMySelf(start,end,false);
+ return buildPartOfMySelf(start,end,true);
}
/*!
* behind returned mesh. This cause an overhead but it is lesser in memory.
* This method returns an array too. This array allows to the caller to know the mapping between nodeids in 'this' and nodeids in
* returned mesh. This is quite usefull for MEDCouplingFieldDouble on nodes for example...
+ * 'arr' is in old2New format of size ret->getNumberOfCells like MEDCouplingUMesh::zipCoordsTraducer is.
* The returned mesh has to be managed by the caller.
*/
MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGPOINTSET_HXX__
{
class DataArrayInt;
class DataArrayDouble;
-
+
+ /*!
+ * This class is abstract and not instanciable.
+ * ParaMEDMEM::MEDCouplingUMesh class inherits from this class.
+ * This class aggregates an array '_coords' containing nodes coordinates.
+ * So all operations on coordinates are managed by this class.
+ * This is the case for example for following methods :
+ * rotation, translation, scaling, getNodeIdsNearPoint, boundingbox...
+ */
class MEDCOUPLING_EXPORT MEDCouplingPointSet : public MEDCouplingMesh
{
protected:
MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy);
~MEDCouplingPointSet();
public:
- void updateTime();
+ void updateTime() const;
int getNumberOfNodes() const;
int getSpaceDimension() const;
- void setCoords(DataArrayDouble *coords);
- DataArrayDouble *getCoords() const { return _coords; }
+ void setCoords(const DataArrayDouble *coords);
+ const DataArrayDouble *getCoords() const { return _coords; }
+ DataArrayDouble *getCoords() { return _coords; }
DataArrayDouble *getCoordinatesAndOwner() const;
void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
bool isEqual(const MEDCouplingMesh *other, double prec) const;
virtual void renumberNodes2(const int *newNodeNumbers, int newNbOfNodes);
virtual bool isEmptyMesh(const std::vector<int>& tinyInfo) const = 0;
//! size of returned tinyInfo must be always the same.
- void getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- void unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+ void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings);
- virtual void giveElemsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems) = 0;
- virtual void giveElemsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems) = 0;
+ virtual void getCellsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems) = 0;
+ virtual void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems) = 0;
virtual DataArrayInt *zipCoordsTraducer() = 0;
protected:
virtual void checkFullyDefined() const throw(INTERP_KERNEL::Exception) = 0;
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGPOINTSET_TXX__
#define __PARAMEDMEM_MEDCOUPLINGPOINTSET_TXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingRefCountObject.hxx"
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGREFCOUNTOBJECT_HXX__
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingRemapper.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
#include "MEDCouplingExtrudedMesh.hxx"
#include "MEDCouplingNormalizedUnstructuredMesh.txx"
#include "Interpolation1D.txx"
-#include "Interpolation2DCurve.txx"
+#include "Interpolation2DCurve.hxx"
#include "Interpolation2D.txx"
#include "Interpolation3D.txx"
-#include "Interpolation3DSurf.txx"
+#include "Interpolation3DSurf.hxx"
using namespace ParaMEDMEM;
int MEDCouplingRemapper::prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception)
{
releaseData(true);
- _src_mesh=(MEDCouplingMesh *)srcMesh; _target_mesh=(MEDCouplingMesh *)targetMesh;
+ _src_mesh=const_cast<MEDCouplingMesh *>(srcMesh); _target_mesh=const_cast<MEDCouplingMesh *>(targetMesh);
_src_mesh->incrRef(); _target_mesh->incrRef();
int meshInterpType=((int)_src_mesh->getType()*16)+(int)_target_mesh->getType();
switch(meshInterpType)
}
}
+int MEDCouplingRemapper::prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception)
+{
+ std::string meth(src->getDiscretization()->getStringRepr());
+ meth+=target->getDiscretization()->getStringRepr();
+ return prepare(src->getMesh(),target->getMesh(),meth.c_str());
+}
+
void MEDCouplingRemapper::transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception)
{
if(_src_method!=srcField->getDiscretization()->getStringRepr())
return 1;
}
-void MEDCouplingRemapper::updateTime()
+void MEDCouplingRemapper::updateTime() const
{
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGREMAPPER_HXX__
class MEDCouplingMesh;
class MEDCouplingUMesh;
class MEDCouplingFieldDouble;
+ class MEDCouplingFieldTemplate;
}
namespace ParaMEDMEM
MEDCOUPLINGREMAPPER_EXPORT MEDCouplingRemapper();
MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper();
MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLINGREMAPPER_EXPORT int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception);
MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
MEDCOUPLINGREMAPPER_EXPORT void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue) throw(INTERP_KERNEL::Exception);
private:
int prepareUU(const char *method) throw(INTERP_KERNEL::Exception);
int prepareEE(const char *method) throw(INTERP_KERNEL::Exception);
- void updateTime();
+ void updateTime() const;
void releaseData(bool matrixSuppression);
void computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField);
void computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) throw(INTERP_KERNEL::Exception);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingTimeDiscretization.hxx"
void MEDCouplingTimeDiscretization::copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other)
{
_time_tolerance=other._time_tolerance;
+ _time_unit=other._time_unit;
}
void MEDCouplingTimeDiscretization::copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other)
{
+ _time_unit=other._time_unit;
if(_array && other._array)
_array->copyStringInfoFrom(*other._array);
}
throw INTERP_KERNEL::Exception("time tolerance is expected to be greater than 0. !");
}
-void MEDCouplingTimeDiscretization::updateTime()
+void MEDCouplingTimeDiscretization::updateTime() const
{
if(_array)
updateTimeWith(*_array);
bool MEDCouplingTimeDiscretization::areStrictlyCompatible(const MEDCouplingTimeDiscretization *other) const
{
+ if(_time_unit!=other->_time_unit)
+ return false;
if(std::fabs(_time_tolerance-other->_time_tolerance)>1.e-16)
return false;
if(_array==0 && other->_array==0)
return _array->isEqualWithoutConsideringStr(*other->_array,prec);
}
-MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(const MEDCouplingTimeDiscretization *other,
- TypeOfTimeDiscretization type, bool deepCpy) const
+MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const
{
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(type);
- DataArrayDouble *arrSrc=getArray();
+ ret->setTimeUnit(getTimeUnit());
+ const DataArrayDouble *arrSrc=getArray();
DataArrayDouble *arr=0;
if(arrSrc)
arr=arrSrc->performCpy(deepCpy);
{
}
-MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy):_time_tolerance(other._time_tolerance)
+MEDCouplingTimeDiscretization::MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy):_time_unit(other._time_unit),_time_tolerance(other._time_tolerance)
{
if(other._array)
_array=other._array->performCpy(deepCpy);
}
}
-DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray() const
+const DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray() const
+{
+ throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
+}
+
+DataArrayDouble *MEDCouplingTimeDiscretization::getEndArray()
{
throw INTERP_KERNEL::Exception("getEndArray not available for this type of time discretization !");
}
MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::doublyContractedProduct() const throw(INTERP_KERNEL::Exception)
{
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
for(int j=0;j<(int)arrays.size();j++)
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
ret->setArrays(arrays3,0);
return ret;
}
for(int j=0;j<(int)arrays.size();j++)
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
ret->setArrays(arrays3,0);
return ret;
}
for(int j=0;j<(int)arrays.size();j++)
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
ret->setArrays(arrays3,0);
return ret;
}
for(int j=0;j<(int)arrays.size();j++)
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
ret->setArrays(arrays3,0);
return ret;
}
for(int j=0;j<(int)arrays.size();j++)
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
ret->setArrays(arrays3,0);
return ret;
}
for(int j=0;j<(int)arrays.size();j++)
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
ret->setArrays(arrays3,0);
return ret;
}
for(int j=0;j<(int)arrays.size();j++)
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
ret->setArrays(arrays3,0);
return ret;
}
for(int j=0;j<(int)arrays.size();j++)
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
ret->setArrays(arrays3,0);
return ret;
}
for(int j=0;j<(int)arrays.size();j++)
arrays3[j]=arrays2[j];
MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+ ret->setTimeUnit(getTimeUnit());
ret->setArrays(arrays3,0);
return ret;
}
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector<DataArrayDouble *> arrays2(arrays.size());
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
for(int j=0;j<(int)arrays.size();j++)
{
if(arrays[j])
else
arrays2[j]=0;
}
- setArrays(arrays2,0);
+ std::vector<DataArrayDouble *> arrays3(arrays.size());
for(int j=0;j<(int)arrays.size();j++)
- if(arrays2[j])
- arrays2[j]->decrRef();
+ arrays3[j]=arrays2[j];
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector<DataArrayDouble *> arrays2(arrays.size());
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
for(int j=0;j<(int)arrays.size();j++)
{
if(arrays[j])
else
arrays2[j]=0;
}
- setArrays(arrays2,0);
+ std::vector<DataArrayDouble *> arrays3(arrays.size());
+ for(int j=0;j<(int)arrays.size();j++)
+ arrays3[j]=arrays2[j];
+ setArrays(arrays3,0);
+}
+
+void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func)
+{
+ std::vector<DataArrayDouble *> arrays;
+ getArrays(arrays);
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ for(int j=0;j<(int)arrays.size();j++)
+ {
+ if(arrays[j])
+ arrays2[j]=arrays[j]->applyFunc2(nbOfComp,func);
+ else
+ arrays2[j]=0;
+ }
+ std::vector<DataArrayDouble *> arrays3(arrays.size());
+ for(int j=0;j<(int)arrays.size();j++)
+ arrays3[j]=arrays2[j];
+ setArrays(arrays3,0);
+}
+
+void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+{
+ std::vector<DataArrayDouble *> arrays;
+ getArrays(arrays);
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ for(int j=0;j<(int)arrays.size();j++)
+ {
+ if(arrays[j])
+ arrays2[j]=arrays[j]->applyFunc3(nbOfComp,varsOrder,func);
+ else
+ arrays2[j]=0;
+ }
+ std::vector<DataArrayDouble *> arrays3(arrays.size());
for(int j=0;j<(int)arrays.size();j++)
- if(arrays2[j])
- arrays2[j]->decrRef();
+ arrays3[j]=arrays2[j];
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::applyFunc(const char *func)
{
std::vector<DataArrayDouble *> arrays;
getArrays(arrays);
- std::vector<DataArrayDouble *> arrays2(arrays.size());
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
for(int j=0;j<(int)arrays.size();j++)
{
if(arrays[j])
else
arrays2[j]=0;
}
- setArrays(arrays2,0);
+ std::vector<DataArrayDouble *> arrays3(arrays.size());
for(int j=0;j<(int)arrays.size();j++)
- if(arrays2[j])
- arrays2[j]->decrRef();
+ arrays3[j]=arrays2[j];
+ setArrays(arrays3,0);
}
void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func)
setArrays(arrays3,0);
}
+void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception)
+{
+ std::vector<DataArrayDouble *> arrays;
+ getArrays(arrays);
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ for(int j=0;j<(int)arrays.size();j++)
+ arrays2[j]=loc->applyFunc2(nbOfComp,func);
+ std::vector<DataArrayDouble *> arrays3(arrays.size());
+ for(int j=0;j<(int)arrays.size();j++)
+ arrays3[j]=arrays2[j];
+ setArrays(arrays3,0);
+}
+
+void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception)
+{
+ std::vector<DataArrayDouble *> arrays;
+ getArrays(arrays);
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+ for(int j=0;j<(int)arrays.size();j++)
+ arrays2[j]=loc->applyFunc3(nbOfComp,varsOrder,func);
+ std::vector<DataArrayDouble *> arrays3(arrays.size());
+ for(int j=0;j<(int)arrays.size();j++)
+ arrays3[j]=arrays2[j];
+ setArrays(arrays3,0);
+}
+
MEDCouplingNoTimeLabel::MEDCouplingNoTimeLabel()
{
}
{
std::ostringstream stream;
stream << REPR;
+ stream << "\nTime unit is : \"" << _time_unit << "\"";
return stream.str();
}
throw INTERP_KERNEL::Exception(EXCEPTION_MSG);
}
+/*!
+ * idem getTinySerializationIntInformation except that it is for multi field fetch
+ */
+void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+{
+ tinyInfo.clear();
+}
+
+/*!
+ * idem getTinySerializationDbleInformation except that it is for multi field fetch
+ */
+void MEDCouplingNoTimeLabel::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
+{
+ tinyInfo.resize(1);
+ tinyInfo[0]=_time_tolerance;
+}
+
+/*!
+ * idem finishUnserialization except that it is for multi field fetch
+ */
+void MEDCouplingNoTimeLabel::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+{
+ _time_tolerance=tinyInfoD[0];
+}
+
MEDCouplingWithTimeStep::MEDCouplingWithTimeStep(const MEDCouplingWithTimeStep& other, bool deepCpy):MEDCouplingTimeDiscretization(other,deepCpy),
_time(other._time),_iteration(other._iteration),_order(other._order)
{
{
std::ostringstream stream;
stream << REPR << " Time is defined by iteration=" << _iteration << " order=" << _order << " and time=" << _time << ".";
+ stream << "\nTime unit is : \"" << _time_unit << "\"";
return stream.str();
}
_order=tinyInfoI[3];
}
+/*!
+ * idem getTinySerializationIntInformation except that it is for multi field fetch
+ */
+void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+{
+ tinyInfo.resize(2);
+ tinyInfo[0]=_iteration;
+ tinyInfo[1]=_order;
+}
+
+/*!
+ * idem getTinySerializationDbleInformation except that it is for multi field fetch
+ */
+void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
+{
+ tinyInfo.resize(2);
+ tinyInfo[0]=_time_tolerance;
+ tinyInfo[1]=_time;
+}
+
+/*!
+ * idem finishUnserialization except that it is for multi field fetch
+ */
+void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+{
+ _iteration=tinyInfoI[0];
+ _order=tinyInfoI[1];
+ _time_tolerance=tinyInfoD[0];
+ _time=tinyInfoD[1];
+}
+
bool MEDCouplingWithTimeStep::areCompatible(const MEDCouplingTimeDiscretization *other) const
{
if(!MEDCouplingTimeDiscretization::areCompatible(other))
_end_order=tinyInfoI[5];
}
+/*!
+ * idem getTinySerializationIntInformation except that it is for multi field fetch
+ */
+void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+{
+ tinyInfo.resize(4);
+ tinyInfo[0]=_start_iteration;
+ tinyInfo[1]=_start_order;
+ tinyInfo[2]=_end_iteration;
+ tinyInfo[3]=_end_order;
+}
+
+/*!
+ * idem getTinySerializationDbleInformation except that it is for multi field fetch
+ */
+void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
+{
+ tinyInfo.resize(3);
+ tinyInfo[0]=_time_tolerance;
+ tinyInfo[1]=_start_time;
+ tinyInfo[2]=_end_time;
+}
+
+/*!
+ * idem finishUnserialization except that it is for multi field fetch
+ */
+void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+{
+ _start_iteration=tinyInfoI[0];
+ _start_order=tinyInfoI[1];
+ _end_iteration=tinyInfoI[2];
+ _end_order=tinyInfoI[3];
+ _time_tolerance=tinyInfoD[0];
+ _start_time=tinyInfoD[1];
+ _end_time=tinyInfoD[2];
+}
+
MEDCouplingConstOnTimeInterval::MEDCouplingConstOnTimeInterval(const MEDCouplingConstOnTimeInterval& other, bool deepCpy):
MEDCouplingTimeDiscretization(other,deepCpy),_start_time(other._start_time),_end_time(other._end_time),_start_iteration(other._start_iteration),
_end_iteration(other._end_iteration),_start_order(other._start_order),_end_order(other._end_order)
std::ostringstream stream;
stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
stream << "iteration_end=" << _end_iteration << " order_end=" << _end_order << " and end_time=" << _end_time << "\n";
+ stream << "\nTime unit is : \"" << _time_unit << "\"";
return stream.str();
}
_end_array=0;
}
-void MEDCouplingTwoTimeSteps::updateTime()
+void MEDCouplingTwoTimeSteps::updateTime() const
{
MEDCouplingTimeDiscretization::updateTime();
if(_end_array)
_end_array->copyStringInfoFrom(*otherC->_end_array);
}
-DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() const
+const DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray() const
+{
+ return _end_array;
+}
+
+DataArrayDouble *MEDCouplingTwoTimeSteps::getEndArray()
{
return _end_array;
}
_end_order=tinyInfoI[5];
}
+/*!
+ * idem getTinySerializationIntInformation except that it is for multi field fetch
+ */
+void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const
+{
+ tinyInfo.resize(4);
+ tinyInfo[0]=_start_iteration;
+ tinyInfo[1]=_start_order;
+ tinyInfo[2]=_end_iteration;
+ tinyInfo[3]=_end_order;
+}
+
+/*!
+ * idem getTinySerializationDbleInformation except that it is for multi field fetch
+ */
+void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const
+{
+ tinyInfo.resize(3);
+ tinyInfo[0]=_time_tolerance;
+ tinyInfo[1]=_start_time;
+ tinyInfo[2]=_end_time;
+}
+
+/*!
+ * idem finishUnserialization except that it is for multi field fetch
+ */
+void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD)
+{
+ _start_iteration=tinyInfoI[0];
+ _start_order=tinyInfoI[1];
+ _end_iteration=tinyInfoI[2];
+ _end_order=tinyInfoI[3];
+ _time_tolerance=tinyInfoD[0];
+ _start_time=tinyInfoD[1];
+ _end_time=tinyInfoD[2];
+}
+
std::vector< const DataArrayDouble *> MEDCouplingTwoTimeSteps::getArraysForTime(double time) const throw(INTERP_KERNEL::Exception)
{
if(time>_start_time-_time_tolerance && time<_end_time+_time_tolerance)
std::ostringstream stream;
stream << REPR << " Time interval is defined by :\niteration_start=" << _start_iteration << " order_start=" << _start_order << " and time_start=" << _start_time << "\n";
stream << "iteration_end=" << _end_iteration << " order_end=" << _end_order << " and end_time=" << _end_time << "\n";
+ stream << "Time unit is : \"" << _time_unit << "\"";
return stream.str();
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGTIMEDISCRETIZATION_HXX__
MEDCouplingTimeDiscretization();
MEDCouplingTimeDiscretization(const MEDCouplingTimeDiscretization& other, bool deepCpy);
public:
- void updateTime();
+ void updateTime() const;
static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
+ void setTimeUnit(const char *unit) { _time_unit=unit; }
+ const char *getTimeUnit() const { return _time_unit.c_str(); }
virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other);
virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
virtual void checkCoherency() const throw(INTERP_KERNEL::Exception);
virtual bool areCompatibleForMeld(const MEDCouplingTimeDiscretization *other) const;
virtual bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
virtual bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
- virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(const MEDCouplingTimeDiscretization *other,
- TypeOfTimeDiscretization type, bool deepCpy) const;
+ virtual MEDCouplingTimeDiscretization *buildNewTimeReprFromThis(TypeOfTimeDiscretization type, bool deepCpy) const;
virtual std::string getStringRepr() const = 0;
virtual TypeOfTimeDiscretization getEnum() const = 0;
virtual MEDCouplingTimeDiscretization *aggregate(const MEDCouplingTimeDiscretization *other) const = 0;
virtual void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
virtual void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
virtual void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ virtual void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const = 0;
+ virtual void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const = 0;
+ virtual void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD) = 0;
virtual MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const = 0;
void setTimeTolerance(double val) { _time_tolerance=val; }
double getTimeTolerance() const { return _time_tolerance; }
virtual void setArray(DataArrayDouble *array, TimeLabel *owner);
virtual void setEndArray(DataArrayDouble *array, TimeLabel *owner);
virtual void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
- DataArrayDouble *getArray() const { return _array; }
- virtual DataArrayDouble *getEndArray() const;
+ DataArrayDouble *getArray() { return _array; }
+ const DataArrayDouble *getArray() const { return _array; }
+ virtual const DataArrayDouble *getEndArray() const;
+ virtual DataArrayDouble *getEndArray();
virtual std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception) = 0;
virtual void getValueForTime(double time, const std::vector<double>& vals, double *res) const = 0;
virtual void getArrays(std::vector<DataArrayDouble *>& arrays) const;
virtual void applyLin(double a, double b, int compoId);
virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
virtual void applyFunc(int nbOfComp, const char *func);
+ virtual void applyFunc2(int nbOfComp, const char *func);
+ virtual void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func);
virtual void applyFunc(const char *func);
virtual void applyFuncFast32(const char *func);
virtual void applyFuncFast64(const char *func);
virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+ virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+ virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
//
virtual ~MEDCouplingTimeDiscretization();
protected:
+ std::string _time_unit;
double _time_tolerance;
DataArrayDouble *_array;
protected:
void setEndTime(double time, int iteration, int order) throw(INTERP_KERNEL::Exception);
void getValueOnTime(int eltId, double time, double *value) const throw(INTERP_KERNEL::Exception);
void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const throw(INTERP_KERNEL::Exception);
+ void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
+ void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
+ void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
public:
static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME;
static const char REPR[];
void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
+ void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
+ void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
void checkNoTimePresence() const throw(INTERP_KERNEL::Exception);
void checkTimePresence(double time) const throw(INTERP_KERNEL::Exception);
void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
void getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const;
void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
+ void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
+ void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
MEDCouplingTimeDiscretization *performCpy(bool deepCpy) const;
bool areCompatible(const MEDCouplingTimeDiscretization *other) const;
bool areStrictlyCompatible(const MEDCouplingTimeDiscretization *other) const;
MEDCouplingTwoTimeSteps();
~MEDCouplingTwoTimeSteps();
public:
- void updateTime();
+ void updateTime() const;
void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other);
void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
- DataArrayDouble *getEndArray() const;
+ const DataArrayDouble *getEndArray() const;
+ DataArrayDouble *getEndArray();
void checkCoherency() const throw(INTERP_KERNEL::Exception);
bool isEqual(const MEDCouplingTimeDiscretization *other, double prec) const;
bool isEqualWithoutConsideringStr(const MEDCouplingTimeDiscretization *other, double prec) const;
void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
void resizeForUnserialization(const std::vector<int>& tinyInfoI, std::vector<DataArrayDouble *>& arrays);
void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS);
+ void getTinySerializationIntInformation2(std::vector<int>& tinyInfo) const;
+ void getTinySerializationDbleInformation2(std::vector<double>& tinyInfo) const;
+ void finishUnserialization2(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD);
std::vector< const DataArrayDouble *> getArraysForTime(double time) const throw(INTERP_KERNEL::Exception);
void setArrays(const std::vector<DataArrayDouble *>& arrays, TimeLabel *owner) throw(INTERP_KERNEL::Exception);
protected:
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingTimeLabel.hxx"
{
}
- TimeLabel& TimeLabel::operator=(const TimeLabel& other)
+TimeLabel& TimeLabel::operator=(const TimeLabel& other)
{
_time=GLOBAL_TIME++;
return *this;
}
-void TimeLabel::declareAsNew()
+void TimeLabel::declareAsNew() const
{
_time=GLOBAL_TIME++;
}
-void TimeLabel::updateTimeWith(const TimeLabel& other)
+void TimeLabel::updateTimeWith(const TimeLabel& other) const
{
if(_time<other._time)
_time=other._time;
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_TIMELABEL_HXX__
public:
TimeLabel& operator=(const TimeLabel& other);
//! This method should be called when write access has been done on this.
- void declareAsNew();
+ void declareAsNew() const;
//! This method should be called on high level classes as Field or Mesh to take into acount modifications done in aggragates objects.
- virtual void updateTime() = 0;
+ virtual void updateTime() const = 0;
unsigned int getTimeOfThis() const { return _time; }
protected:
TimeLabel();
virtual ~TimeLabel();
- void updateTimeWith(const TimeLabel& other);
+ void updateTimeWith(const TimeLabel& other) const;
private:
static unsigned int GLOBAL_TIME;
- unsigned int _time;
+ mutable unsigned int _time;
};
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingUMesh.hxx"
#include "InterpKernelCellSimplify.hxx"
#include "InterpKernelGeo2DEdgeArcCircle.hxx"
#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "InterpKernelAutoPtr.hxx"
#include <sstream>
return new MEDCouplingUMesh(*this,recDeepCpy);
}
-void MEDCouplingUMesh::updateTime()
+void MEDCouplingUMesh::updateTime() const
{
MEDCouplingPointSet::updateTime();
if(_nodal_connec)
throw INTERP_KERNEL::Exception("No mesh dimension specified !");
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=_types.begin();iter!=_types.end();iter++)
{
- if((int)INTERP_KERNEL::CellModel::getCellModel(*iter).getDimension()!=_mesh_dim)
+ if((int)INTERP_KERNEL::CellModel::GetCellModel(*iter).getDimension()!=_mesh_dim)
{
std::ostringstream message;
message << "Mesh invalid because dimension is " << _mesh_dim << " and there is presence of cell(s) with type " << (*iter);
}
}
+/*!
+ * This method performs deeper checking in 'this' than MEDCouplingUMesh::checkCoherency does.
+ * So this method is more time-consuming. This method checks that nodal connectivity points to valid node ids.
+ * No geometrical aspects are checked here. These aspects are done in MEDCouplingUMesh::checkCoherency2.
+ */
+void MEDCouplingUMesh::checkCoherency1(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency();
+ if(_mesh_dim==-1)
+ return ;
+ int meshDim=getMeshDimension();
+ int nbOfNodes=getNumberOfNodes();
+ int nbOfCells=getNumberOfCells();
+ const int *ptr=_nodal_connec->getConstPointer();
+ const int *ptrI=_nodal_connec_index->getConstPointer();
+ for(int i=0;i<nbOfCells;i++)
+ {
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)ptr[ptrI[i]]);
+ if((int)cm.getDimension()!=meshDim)
+ {
+ std::ostringstream oss;
+ oss << "MEDCouplingUMesh::checkCoherency1 : cell << #" << i<< " with type Type " << cm.getRepr() << " in 'this' whereas meshdim == " << meshDim << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ int nbOfNodesInCell=ptrI[i+1]-ptrI[i]-1;
+ if(!cm.isDynamic())
+ if(nbOfNodesInCell!=(int)cm.getNumberOfNodes())
+ {
+ std::ostringstream oss;
+ oss << "MEDCouplingUMesh::checkCoherency1 : cell #" << i << " with static Type '" << cm.getRepr() << "' has " << cm.getNumberOfNodes();
+ oss << " nodes whereas in connectivity there is " << nbOfNodesInCell << " nodes ! Looks very bad !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ for(const int *w=ptr+ptrI[i]+1;w!=ptr+ptrI[i+1];w++)
+ {
+ int nodeId=*w;
+ if(nodeId>=0)
+ {
+ if(nodeId>=nbOfNodes)
+ {
+ std::ostringstream oss; oss << "Cell #" << i << " is consituted of node #" << nodeId << " whereas there are only " << nbOfNodes << " nodes !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ else if(nodeId<-1)
+ {
+ std::ostringstream oss; oss << "Cell #" << i << " is consituted of node #" << nodeId << " in connectivity ! sounds bad !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ else
+ {
+ if((INTERP_KERNEL::NormalizedCellType)(ptr[ptrI[i]])!=INTERP_KERNEL::NORM_POLYHED)
+ {
+ std::ostringstream oss; oss << "Cell #" << i << " is consituted of node #-1 in connectivity ! sounds bad !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ }
+ }
+}
+
+void MEDCouplingUMesh::checkCoherency2(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency1(eps);
+}
+
void MEDCouplingUMesh::setMeshDimension(int meshDim)
{
if(meshDim<-1)
*/
void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell) throw(INTERP_KERNEL::Exception)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(_nodal_connec_index==0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::insertNextCell : nodal connectivity not set ! invoke allocateCells before calling insertNextCell !");
if((int)cm.getDimension()==_mesh_dim)
updateTime();
}
+std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingUMesh::getAllGeoTypes() const
+{
+ return _types;
+}
+
/*!
* This method is a method that compares 'this' and 'other'.
* This method compares \b all attributes, even names and component names.
* This method looks if 'this' and 'other' are geometrically equivalent that is to say if each cell in 'other' correspond to one cell and only one
* in 'this' is found regarding 'prec' parameter and 'cellCompPol' parameter. The difference with MEDCouplingUMesh::checkDeepEquivalWith method is that
* coordinates of 'this' and 'other' are expected to be the same. If not an exception will be thrown.
+ * This method is close to MEDCouplingUMesh::areCellsIncludedIn except that this method throws exception !
*
* In case of success cellCor are informed both.
* @param cellCompPol values are described in MEDCouplingUMesh::zipConnectivityTraducer method.
{
int pos=connIndex[eltId];
int posP1=connIndex[eltId+1];
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel((INTERP_KERNEL::NormalizedCellType)conn[pos]);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[pos]);
unsigned nbOfSons=cm.getNumberOfSons2(conn+pos+1,posP1-pos-1);
int *tmp=new int[posP1-pos];
for(unsigned i=0;i<nbOfSons;i++)
{
INTERP_KERNEL::NormalizedCellType cmsId;
unsigned nbOfNodesSon=cm.fillSonCellNodalConnectivity2(i,conn+pos+1,posP1-pos-1,tmp,cmsId);
- const INTERP_KERNEL::CellModel& cms=INTERP_KERNEL::CellModel::getCellModel(cmsId);
+ const INTERP_KERNEL::CellModel& cms=INTERP_KERNEL::CellModel::GetCellModel(cmsId);
std::set<int> shareableCells(revNodalB[tmp[0]].begin(),revNodalB[tmp[0]].end());
for(unsigned j=1;j<nbOfNodesSon && !shareableCells.empty();j++)
{
int pos=connIndex[*iter];
int posP1=connIndex[(*iter)+1];
int lgthOld=posP1-pos-1;
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel((INTERP_KERNEL::NormalizedCellType)connNew[pos]);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)connNew[pos]);
connNew[pos]=INTERP_KERNEL::NORM_POLYHED;
unsigned nbOfFaces=cm.getNumberOfSons2(&connNew[pos+1],lgthOld);
int *tmp=new int[nbOfFaces*lgthOld];
computeTypes();
}
+/*!
+ * This method converts all cells into poly type if possible.
+ * This method is purely for userfriendliness.
+ * As this method can be costly in Memory, no optimization is done to avoid construction of useless vector.
+ */
+void MEDCouplingUMesh::convertAllToPoly()
+{
+ int nbOfCells=getNumberOfCells();
+ std::vector<int> cellIds(nbOfCells);
+ for(int i=0;i<nbOfCells;i++)
+ cellIds[i]=i;
+ convertToPolyTypes(cellIds);
+}
+
/*!
* This method is the opposite of ParaMEDMEM::MEDCouplingUMesh::convertToPolyTypes method.
* The aim is to take all polygons or polyhedrons cell and to try to traduce them into classical cells.
{
lgthOfCurCell=index[i+1]-posOfCurCell;
INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)conn[posOfCurCell];
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
INTERP_KERNEL::NormalizedCellType newType=INTERP_KERNEL::NORM_ERROR;
int newLgth;
if(cm.isDynamic())
{
if(cm.getDimension()==2)
{
- int *tmp=new int[lgthOfCurCell-1];
- std::copy(conn+posOfCurCell+1,conn+posOfCurCell+lgthOfCurCell,tmp);
+ INTERP_KERNEL::AutoPtr<int> tmp=new int[lgthOfCurCell-1];
+ std::copy(conn+posOfCurCell+1,conn+posOfCurCell+lgthOfCurCell,(int *)tmp);
newType=INTERP_KERNEL::CellSimplify::tryToUnPoly2D(tmp,lgthOfCurCell-1,conn+newPos+1,newLgth);
- delete [] tmp;
}
if(cm.getDimension()==3)
{
int nbOfFaces,lgthOfPolyhConn;
- int *zipFullReprOfPolyh=INTERP_KERNEL::CellSimplify::getFullPolyh3DCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,nbOfFaces,lgthOfPolyhConn);
+ INTERP_KERNEL::AutoPtr<int> zipFullReprOfPolyh=INTERP_KERNEL::CellSimplify::getFullPolyh3DCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,nbOfFaces,lgthOfPolyhConn);
newType=INTERP_KERNEL::CellSimplify::tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,conn+newPos+1,newLgth);
- delete [] zipFullReprOfPolyh;
}
conn[newPos]=newType;
newPos+=newLgth+1;
posOfCurCell=index[i+1];
index[i+1]=newPos;
}
+ else
+ {
+ std::copy(conn+posOfCurCell,conn+posOfCurCell+lgthOfCurCell,conn+newPos);
+ newPos+=lgthOfCurCell;
+ posOfCurCell+=lgthOfCurCell;
+ index[i+1]=newPos;
+ }
}
if(newPos!=initMeshLgth)
_nodal_connec->reAlloc(newPos);
}
/*!
- * Array returned is the correspondance new to old.
+ * Array returned is the correspondance old to new.
* The maximum value stored in returned array is the number of nodes of 'this' minus 1 after call of this method.
* The size of returned array is the number of nodes of the old (previous to the call of this method) number of nodes.
* -1 values in returned array means that the corresponding old node is no more used.
/*!
* This method makes the assumption that 'this' and 'other' share the same coords. If not an exception will be thrown !
* This method tries to determine if 'other' is fully included in 'this'. To compute that, this method works with connectivity as MEDCouplingUMesh::zipConnectivityTraducer method does.
+ * This method is close to MEDCouplingUMesh::checkDeepEquivalOnSameNodesWith or MEDCouplingMesh::checkGeoEquivalWith with policy 20,21,or 22.
+ * The main difference is that this method is not expected to throw exception.
* This method has two outputs :
*
* @param compType is the comparison type. The possible values of this parameter are described in ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer method
*/
void MEDCouplingUMesh::tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception)
{
- DataArrayDouble *coords=other.getCoords();
+ const DataArrayDouble *coords=other.getCoords();
if(!coords)
throw INTERP_KERNEL::Exception("tryToShareSameCoordsPermute : No coords specified in other !");
if(!_coords)
}
}
+/*!
+ * This method is very close too MEDCouplingUMesh::buildPartOfMySelfNode. The difference is that it returns directly ids.
+ */
+DataArrayInt *MEDCouplingUMesh::getCellIdsLyingOnNodes(const int *begin, const int *end, bool fullyIn) const
+{
+ std::vector<int> cellIdsKept;
+ fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(cellIdsKept.size(),1);
+ std::copy(cellIdsKept.begin(),cellIdsKept.end(),ret->getPointer());
+ ret->setName(getName());
+ return ret;
+}
+
/*!
* Keeps from 'this' only cells which constituing point id are in the ids specified by ['begin','end').
* The return newly allocated mesh will share the same coordinates as 'this'.
return ret;
}
+/*!
+ * This method returns a newly created DataArrayInt instance containing ids of cells located in boundary.
+ * A cell is detected to be on boundary if it contains one or more than one face having only one father.
+ * This method makes the assumption that 'this' is fully defined (coords,connectivity). If not an exception will be thrown.
+ */
+DataArrayInt *MEDCouplingUMesh::findCellsIdsOnBoundary() const throw(INTERP_KERNEL::Exception)
+{
+ checkFullyDefined();
+ DataArrayInt *desc=DataArrayInt::New();
+ DataArrayInt *descIndx=DataArrayInt::New();
+ DataArrayInt *revDesc=DataArrayInt::New();
+ DataArrayInt *revDescIndx=DataArrayInt::New();
+ //
+ MEDCouplingUMesh *meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
+ meshDM1->decrRef();
+ desc->decrRef();
+ descIndx->decrRef();
+ //
+ DataArrayInt *tmp=revDescIndx->deltaShiftIndex();
+ DataArrayInt *faceIds=tmp->getIdsEqual(1);
+ tmp->decrRef();
+ int nbOfFaces=faceIds->getNumberOfTuples();
+ const int *faces=faceIds->getConstPointer();
+ std::set<int> ret;
+ for(const int *w=faces;w!=faces+nbOfFaces;w++)
+ ret.insert(revDesc->getIJ(revDescIndx->getIJ(*w,0),0));
+ faceIds->decrRef();
+ //
+ revDescIndx->decrRef();
+ revDesc->decrRef();
+ //
+ DataArrayInt *ret2=DataArrayInt::New();
+ ret2->alloc(ret.size(),1);
+ std::copy(ret.begin(),ret.end(),ret2->getPointer());
+ ret2->setName("BoundaryCells");
+ return ret2;
+}
+
/*!
* This methods returns set of nodes lying on the boundary of this.
*/
* This value is asked because often known by the caller of this method.
* This method, contrary to MEDCouplingMesh::renumberCells does NOT conserve the number of nodes before and after.
*
- * @param newNodeNumbers array specifying the new numbering.
+ * @param newNodeNumbers array specifying the new numbering in old2New convention.
* @param newNbOfNodes the new number of nodes.
*/
void MEDCouplingUMesh::renumberNodes(const int *newNodeNumbers, int newNbOfNodes)
/*!
* This method renumbers nodes in connectivity only without any reference with coords.
* Use it with care !
+ * @param 'newNodeNumbers' in old2New convention
*/
void MEDCouplingUMesh::renumberNodesInConn(const int *newNodeNumbers)
{
*/
void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
{
+ checkConnectivityFullyDefined();
int nbCells=getNumberOfCells();
const int *array=old2NewBg;
if(check)
* Warning 'elems' is incremented during the call so if elems is not empty before call returned elements will be
* added in 'elems' parameter.
*/
-void MEDCouplingUMesh::giveElemsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems)
+void MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems)
{
if(getMeshDimension()==-1)
{
}
/*!
- * Given a boundary box 'bbox' returns elements 'elems' contained in this 'bbox'.
+ * Given a boundary box 'bbox' returns elements 'elems' contained in this 'bbox' or touching 'bbox' (within 'eps' distance).
* Warning 'elems' is incremented during the call so if elems is not empty before call returned elements will be
* added in 'elems' parameter.
*/
-void MEDCouplingUMesh::giveElemsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems)
+void MEDCouplingUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems)
{
if(getMeshDimension()==-1)
{
static const char msg0[]="No coordinates specified !";
std::ostringstream ret;
ret << "Unstructured mesh with name : \"" << getName() << "\"\n";
+ ret << "Description of mesh : \"" << getDescription() << "\"\n";
+ int tmpp1,tmpp2;
+ double tt=getTime(tmpp1,tmpp2);
+ ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
+ ret << "Iteration : " << tmpp1 << " Order : " << tmpp2 << "\n";
ret << "Mesh dimension : " << _mesh_dim << "\nSpace dimension : ";
if(_coords!=0)
{
ret << "Cell types present : ";
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=_types.begin();iter!=_types.end();iter++)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(*iter);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(*iter);
ret << cm.getRepr() << " ";
}
ret << "\n";
const int *ci=_nodal_connec_index->getConstPointer();
for(int i=0;i<nbOfCells;i++)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[i]]);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[i]]);
stream << "Cell #" << i << " " << cm.getRepr() << " : ";
std::copy(c+ci[i]+1,c+ci[i+1],std::ostream_iterator<int>(stream," "));
stream << "\n";
throw INTERP_KERNEL::Exception("Reverse nodal connectivity computation requires full connectivity and coordinates set in unstructured mesh.");
}
+/*!
+ * This method checks that all connectivity arrays are set. If yes nothing done if no an exception is thrown.
+ */
+void MEDCouplingUMesh::checkConnectivityFullyDefined() const throw(INTERP_KERNEL::Exception)
+{
+ if(!_nodal_connec_index || !_nodal_connec)
+ throw INTERP_KERNEL::Exception("Reverse nodal connectivity computation requires full connectivity set in unstructured mesh.");
+}
+
int MEDCouplingUMesh::getNumberOfCells() const
{
if(_nodal_connec_index)
/*!
* First step of serialization process. Used by ParaMEDMEM and MEDCouplingCorba to transfert data between process.
*/
-void MEDCouplingUMesh::getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingUMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
{
- MEDCouplingPointSet::getTinySerializationInformation(tinyInfo,littleStrings);
+ MEDCouplingPointSet::getTinySerializationInformation(tinyInfoD,tinyInfo,littleStrings);
tinyInfo.push_back(getMeshDimension());
tinyInfo.push_back(getNumberOfCells());
if(_nodal_connec)
*/
bool MEDCouplingUMesh::isEmptyMesh(const std::vector<int>& tinyInfo) const
{
- return tinyInfo[4]<=0;
+ return tinyInfo[6]<=0;
}
/*!
{
MEDCouplingPointSet::resizeForUnserialization(tinyInfo,a1,a2,littleStrings);
if(tinyInfo[5]!=-1)
- a1->alloc(tinyInfo[5]+tinyInfo[4]+1,1);
+ a1->alloc(tinyInfo[7]+tinyInfo[6]+1,1);
}
/*!
* Second and final unserialization process.
* @param tinyInfo must be equal to the result given by getTinySerializationInformation method.
*/
-void MEDCouplingUMesh::unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
+void MEDCouplingUMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
- MEDCouplingPointSet::unserialization(tinyInfo,a1,a2,littleStrings);
- setMeshDimension(tinyInfo[3]);
- if(tinyInfo[5]!=-1)
+ MEDCouplingPointSet::unserialization(tinyInfoD,tinyInfo,a1,a2,littleStrings);
+ setMeshDimension(tinyInfo[5]);
+ if(tinyInfo[7]!=-1)
{
// Connectivity
const int *recvBuffer=a1->getConstPointer();
DataArrayInt* myConnecIndex=DataArrayInt::New();
- myConnecIndex->alloc(tinyInfo[4]+1,1);
- std::copy(recvBuffer,recvBuffer+tinyInfo[4]+1,myConnecIndex->getPointer());
+ myConnecIndex->alloc(tinyInfo[6]+1,1);
+ std::copy(recvBuffer,recvBuffer+tinyInfo[6]+1,myConnecIndex->getPointer());
DataArrayInt* myConnec=DataArrayInt::New();
- myConnec->alloc(tinyInfo[5],1);
- std::copy(recvBuffer+tinyInfo[4]+1,recvBuffer+tinyInfo[4]+1+tinyInfo[5],myConnec->getPointer());
+ myConnec->alloc(tinyInfo[7],1);
+ std::copy(recvBuffer+tinyInfo[6]+1,recvBuffer+tinyInfo[6]+1+tinyInfo[7],myConnec->getPointer());
setConnectivity(myConnec, myConnecIndex) ;
myConnec->decrRef();
myConnecIndex->decrRef();
{
checkFullyDefined();
MEDCouplingUMesh *ret=MEDCouplingUMesh::New();
- std::string name(getName());
- int sz=strlen(PART_OF_NAME);
- if((int)name.length()>=sz)
- name=name.substr(0,sz);
- if(name!=PART_OF_NAME)
- {
- std::ostringstream stream; stream << PART_OF_NAME << getName();
- ret->setName(stream.str().c_str());
- }
- else
- ret->setName(getName());
ret->_mesh_dim=_mesh_dim;
ret->setCoords(_coords);
int nbOfElemsRet=end-begin;
ret->_types=types;
connRetArr->decrRef();
connIndexRetArr->decrRef();
+ ret->copyTinyInfoFrom(this);
+ std::string name(getName());
+ int sz=strlen(PART_OF_NAME);
+ if((int)name.length()>=sz)
+ name=name.substr(0,sz);
+ if(name!=PART_OF_NAME)
+ {
+ std::ostringstream stream; stream << PART_OF_NAME << getName();
+ ret->setName(stream.str().c_str());
+ }
+ else
+ ret->setName(getName());
return ret;
}
* This method is equivalent to MEDCouplingUMesh::getMeasureField except that only part defined by [begin,end) is returned !
* This method avoids to build explicitely part of this to perform the work.
*/
-MEDCouplingFieldDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *begin, const int *end) const
+DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *begin, const int *end) const
{
std::string name="PartMeasureOfMesh_";
name+=getName();
int nbelem=std::distance(begin,end);
- MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS);
- field->setName(name.c_str());
DataArrayDouble* array=DataArrayDouble::New();
+ array->setName(name.c_str());
array->alloc(nbelem,1);
double *area_vol=array->getPointer();
- field->setArray(array) ;
- array->decrRef();
- field->setMesh(const_cast<MEDCouplingUMesh *>(this));
if(getMeshDimension()!=-1)
{
int ipt;
{
area_vol[0]=std::numeric_limits<double>::max();
}
- return field;
+ return array;
}
/*!
/*!
* Returns a cell if any that contains the point located on 'pos' with precison eps.
* If 'pos' is outside 'this' -1 is returned. If several cells contain this point the cell with the smallest id is returned.
+ * \b Warning this method is good if the caller intends to evaluate only one point. But if more than one point is requested on 'this'
+ * it is better to use MEDCouplingUMesh::getCellsContainingPoints method because in this case, the acceleration structure will be computed only once.
*/
int MEDCouplingUMesh::getCellContainingPoint(const double *pos, double eps) const
{
/*!
* Returns all cellIds in 'elts' of point 'pos' with eps accuracy.
+ * \b Warning this method is good if the caller intends to evaluate only one point. But if more than one point is requested on 'this'
+ * it is better to use MEDCouplingUMesh::getCellsContainingPoints method because in this case, the acceleration structure will be computed only once.
*/
void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
{
const int *conn=_nodal_connec->getConstPointer();
const int *connI=_nodal_connec_index->getConstPointer();
double bb[2*SPACEDIM];
- for(int j=0;j<SPACEDIM;j++)
- { bb[2*j]=std::numeric_limits<double>::max(); bb[2*j+1]=-std::numeric_limits<double>::max(); }
BBTree<SPACEDIM,int> myTree(&bbox[0],0,0,nbOfCells,-eps);
for(int i=0;i<nbOfPoints;i++)
{
eltsIndex[i+1]=eltsIndex[i];
for(int j=0;j<SPACEDIM;j++)
{
- bb[2*j]=std::min(bb[2*j],pos[SPACEDIM*i+j]);
- bb[2*j+1]=std::max(bb[2*j+1],pos[SPACEDIM*i+j]);
+ bb[2*j]=pos[SPACEDIM*i+j];
+ bb[2*j+1]=pos[SPACEDIM*i+j];
}
std::vector<int> candidates;
myTree.getIntersectingElems(bb,candidates);
}
}
+/*!
+ * This method is an extension of MEDCouplingUMesh::getCellContainingPoint and MEDCouplingUMesh::getCellsContainingPoint.
+ * This method performs 'nbOfPoints' time the getCellsContainingPoint request. This method is recommended rather than the 2 others
+ * in case of multi points searching.
+ * This method returns 2 arrays 'elts' and 'eltsIndex'. 'eltsIndex' is of size 'nbOfPoints+1' and 'elts' is of size 'eltsIndex[nbOfPoints-1]'.
+ * For point j in [0,nbOfPoints), (eltsIndex[j+1]-eltsIndex[j]) cells contain this point. These cells are : [elts.begin()+eltsIndex[j],elts.begin():eltsIndex[j+1]).
+ *
+ * \param pos input parameter that points to an array of size 'getSpaceDim()*nbOfPoints' points stored in full interlace mode : X0,Y0,Z0,X1,Y1,Z1...
+ */
void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps,
std::vector<int>& elts, std::vector<int>& eltsIndex) const
{
int nbOfNodesForCell=connI[i+1]-offset-1;
if(nbOfNodesForCell<=3)
continue;
- bool isQuad=INTERP_KERNEL::CellModel::getCellModel((INTERP_KERNEL::NormalizedCellType)conn[offset]).isQuadratic();
+ bool isQuad=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[offset]).isQuadratic();
project2DCellOnXY(conn+offset+1,conn+connI[i+1],cell2DinS2);
if(isButterfly2DCell(cell2DinS2,isQuad))
cells.push_back(i);
for(int i=0;i<nbOfCells && ret;i++)
{
INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
ret=cm.isQuadratic();
}
return ret;
for(int i=0;i<nbOfCells && !ret;i++)
{
INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
ret=cm.isQuadratic();
}
return ret;
for(int i=0;i<nbOfCells;i++)
{
INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(cm.isQuadratic())
{
INTERP_KERNEL::NormalizedCellType typel=cm.getLinearType();
- const INTERP_KERNEL::CellModel& cml=INTERP_KERNEL::CellModel::getCellModel(typel);
+ const INTERP_KERNEL::CellModel& cml=INTERP_KERNEL::CellModel::GetCellModel(typel);
delta+=cm.getNumberOfNodes()-cml.getNumberOfNodes();
}
}
for(int i=0;i<nbOfCells;i++,ociptr++)
{
INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
if(!cm.isQuadratic())
{
_types.insert(type);
{
INTERP_KERNEL::NormalizedCellType typel=cm.getLinearType();
_types.insert(typel);
- const INTERP_KERNEL::CellModel& cml=INTERP_KERNEL::CellModel::getCellModel(typel);
+ const INTERP_KERNEL::CellModel& cml=INTERP_KERNEL::CellModel::GetCellModel(typel);
int newNbOfNodes=cml.getNumberOfNodes();
*ocptr++=(int)typel;
ocptr=std::copy(icptr+iciptr[i]+1,icptr+iciptr[i]+newNbOfNodes+1,ocptr);
const int *connI=_nodal_connec_index->getConstPointer();
for(int i=0;i<nbCells;i++)
{
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
if(!cm.isSimplex())
return false;
}
const int *_conn;
int _val;
};
+
+ class ConnReader2
+ {
+ public:
+ ConnReader2(const int *c, int val):_conn(c),_val(val) { }
+ bool operator() (const int& pos) { return _conn[pos]==_val; }
+ private:
+ const int *_conn;
+ int _val;
+ };
+}
+
+/*!
+ * This method is used to check that this has contiguous cell type in same order than described in 'code'.
+ * Format of 'code' is the following. 'code' should be of size 3*n and non empty. If not an exception is thrown.
+ * foreach k in [0,n) on 3*k pos represent the geometric type and 3*k+1 number of elements of type 3*k.
+ * 3*k+2 refers if different from -1 the pos in 'idsPerType' to get the corresponding array.
+ * If 2 or more same geometric type is in 'code' and exception is thrown too.
+ *
+ * This method fistly checks
+ * If it exists k so that 3*k geometric type is not in geometric types of this an exception will be thrown.
+ * If it exists k so that 3*k geometric type exists but the number of consecutive cell types does not match,
+ * an exception is thrown too.
+ *
+ * If all geometric types in 'code' are exactly those in 'this' null pointer is returned.
+ * If it exists a geometric type in 'this' \b not in 'code' \b no exception is thrown and a DataArrayInt instance is returned that the user has the responsability
+ * to deallocate.
+ */
+DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+{
+ if(code.empty())
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code is empty, should not !");
+ int sz=code.size();
+ std::size_t n=sz/3;
+ if(sz%3!=0)
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code size is NOT %3 !");
+ std::vector<INTERP_KERNEL::NormalizedCellType> types;
+ int nb=0;
+ for(std::size_t i=0;i<n;i++)
+ if(std::find(types.begin(),types.end(),(INTERP_KERNEL::NormalizedCellType)code[3*i])==types.end())
+ {
+ types.push_back((INTERP_KERNEL::NormalizedCellType)code[3*i]);
+ nb+=code[3*i+1];
+ if(_types.find((INTERP_KERNEL::NormalizedCellType)code[3*i])==_types.end())
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : expected geo types not in this !");
+ }
+ if(types.size()!=n)
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code contains duplication of types in unstructured mesh !");
+ if(idsPerType.empty())
+ {
+ if(!checkConsecutiveCellTypesAndOrder(&types[0],&types[0]+types.size()))
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : non contiguous type !");
+ if(types.size()==_types.size())
+ return 0;
+ }
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->alloc(nb,1);
+ int *retPtr=ret->getPointer();
+ const int *connI=_nodal_connec_index->getConstPointer();
+ const int *conn=_nodal_connec->getConstPointer();
+ int nbOfCells=getNumberOfCells();
+ const int *i=connI;
+ int kk=0;
+ for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++,kk++)
+ {
+ i=std::find_if(i,connI+nbOfCells,ParaMEDMEMImpl::ConnReader2(conn,(int)(*it)));
+ int offset=std::distance(connI,i);
+ if(code[3*kk+2]==-1)
+ {
+ const int *j=std::find_if(i+1,connI+nbOfCells,ParaMEDMEMImpl::ConnReader(conn,(int)(*it)));
+ int pos2=std::distance(i,j);
+ for(int k=0;k<pos2;k++)
+ *retPtr++=k+offset;
+ i=j;
+ }
+ else
+ {
+ retPtr=std::transform(idsPerType[code[3*kk+2]]->getConstPointer(),idsPerType[code[3*kk+2]]->getConstPointer()+idsPerType[code[3*kk+2]]->getNbOfElems(),
+ retPtr,std::bind2nd(std::plus<int>(),offset));
+ }
+ }
+ return ret;
+}
+
+/*!
+ * This method makes the hypothesis that 'this' is sorted by type. If not an exception will be thrown.
+ * This method is the opposite of MEDCouplingUMesh::checkTypeConsistencyAndContig method. Given a list of cells in 'profile' it returns a list of profiles sorted by geo type.
+ * This method has 1 input 'profile' and 2 outputs 'code' and 'idsPerType'.
+ * @throw if 'profile' has not exactly one component. It throws too, if 'profile' contains some values not in [0,getNumberOfCells()) or if 'this' is not fully defined
+ */
+void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+{
+ if(profile->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : input profile should have exactly one component !");
+ checkConnectivityFullyDefined();
+ const int *conn=_nodal_connec->getConstPointer();
+ const int *connI=_nodal_connec_index->getConstPointer();
+ int nbOfCells=getNumberOfCells();
+ std::vector<INTERP_KERNEL::NormalizedCellType> types;
+ std::vector<int> typeRangeVals(1);
+ for(const int *i=connI;i!=connI+nbOfCells;)
+ {
+ INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
+ if(std::find(types.begin(),types.end(),curType)!=types.end())
+ {
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : current mesh is not sorted by type !");
+ }
+ types.push_back(curType);
+ i=std::find_if(i+1,connI+nbOfCells,ParaMEDMEMImpl::ConnReader(conn,(int)curType));
+ typeRangeVals.push_back(std::distance(connI,i));
+ }
+ //
+ DataArrayInt *castArr=0,*rankInsideCast=0,*castsPresent=0;
+ profile->splitByValueRange(&typeRangeVals[0],&typeRangeVals[0]+typeRangeVals.size(),castArr,rankInsideCast,castsPresent);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp0=castArr;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1=rankInsideCast;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp2=castsPresent;
+ //
+ int nbOfCastsFinal=castsPresent->getNumberOfTuples();
+ code.resize(3*nbOfCastsFinal);
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsInPflPerType2;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsPerType2;
+ for(int i=0;i<nbOfCastsFinal;i++)
+ {
+ int castId=castsPresent->getIJ(i,0);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp3=castArr->getIdsEqual(castId);
+ idsInPflPerType2.push_back(tmp3);
+ code[3*i]=(int)types[castId];
+ code[3*i+1]=tmp3->getNumberOfTuples();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp4=rankInsideCast->selectByTupleId(tmp3->getConstPointer(),tmp3->getConstPointer()+tmp3->getNumberOfTuples());
+ if(tmp4->getNumberOfTuples()!=typeRangeVals[castId+1]-typeRangeVals[castId] || !tmp4->isIdentity())
+ {
+ tmp4->copyStringInfoFrom(*profile);
+ idsPerType2.push_back(tmp4);
+ code[3*i+2]=(int)idsPerType2.size()-1;
+ }
+ else
+ {
+ code[3*i+2]=-1;
+ }
+ }
+ int sz2=idsInPflPerType2.size();
+ idsInPflPerType.resize(sz2);
+ for(int i=0;i<sz2;i++)
+ {
+ DataArrayInt *locDa=idsInPflPerType2[i];
+ locDa->incrRef();
+ idsInPflPerType[i]=locDa;
+ }
+ int sz=idsPerType2.size();
+ idsPerType.resize(sz);
+ for(int i=0;i<sz;i++)
+ {
+ DataArrayInt *locDa=idsPerType2[i];
+ locDa->incrRef();
+ idsPerType[i]=locDa;
+ }
+}
+
+/*!
+ * This method is here too emulate the MEDMEM behaviour on BDC (buildDescendingConnectivity). Hoping this method becomes deprecated very soon.
+ * This method make the assumption that 'this' and 'nM1LevMesh' mesh lyies on same coords (same pointer) as MED and MEDMEM does.
+ * The following equality should be verified 'nM1LevMesh->getMeshDimension()==this->getMeshDimension()-1'
+ * This method returns 5+2 elements. 'desc', 'descIndx', 'revDesc', 'revDescIndx' and 'meshnM1' behaves exactly as ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity except the content as described after. The returned array specifies the n-1 mesh reordered by type as MEDMEM does. 'nM1LevMeshIds' contains the ids in returned 'meshnM1'. Finally 'meshnM1Old2New' contains numbering old2new that is to say the cell #k in coarse 'nM1LevMesh' will have the number ret[k] in returned mesh 'nM1LevMesh' MEDMEM reordered.
+ */
+MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *&revDesc, DataArrayInt *&revDescIndx, DataArrayInt *& nM1LevMeshIds, DataArrayInt *&meshnM1Old2New) const throw(INTERP_KERNEL::Exception)
+{
+ checkFullyDefined();
+ nM1LevMesh->checkFullyDefined();
+ if(getMeshDimension()-1!=nM1LevMesh->getMeshDimension())
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::emulateMEDMEMBDC : The mesh passed as first argument should have a meshDim equal to this->getMeshDimension()-1 !" );
+ if(_coords!=nM1LevMesh->getCoords())
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::emulateMEDMEMBDC : 'this' and mesh in first argument should share the same coords : Use tryToShareSameCoords method !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp0=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret1=buildDescendingConnectivity(desc,descIndx,tmp0,tmp1);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret0=ret1->sortCellsInMEDFileFrmt();
+ desc->transformWithIndArr(ret0->getConstPointer(),ret0->getConstPointer()+ret0->getNbOfElems());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
+ tmp->setConnectivity(tmp0,tmp1);
+ tmp->renumberCells(ret0->getConstPointer(),false);
+ revDesc=tmp->getNodalConnectivity();
+ revDescIndx=tmp->getNodalConnectivityIndex();
+ DataArrayInt *ret=0;
+ if(!ret1->areCellsIncludedIn(nM1LevMesh,2,ret))
+ {
+ int tmp;
+ ret->getMaxValue(tmp);
+ ret->decrRef();
+ std::ostringstream oss; oss << "MEDCouplingUMesh::emulateMEDMEMBDC : input N-1 mesh present a cell not in descending mesh ... Id of cell is " << tmp << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ nM1LevMeshIds=ret;
+ //
+ revDesc->incrRef();
+ revDescIndx->incrRef();
+ ret1->incrRef();
+ ret0->incrRef();
+ meshnM1Old2New=ret0;
+ return ret1;
+}
+
+/*!
+ * This method sorts cell in this so that cells are sorted by cell type specified by MEDMEM and so for MED file.
+ * It avoids to deal with renum in MEDLoader so it is usefull for MED file R/W with multi types.
+ * This method returns a newly allocated array old2New.
+ * This method expects that connectivity of this is set. If not an exception will be thrown. Coordinates are not taken into account.
+ */
+DataArrayInt *MEDCouplingUMesh::sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception)
+{
+ static const int N=18;
+ static const INTERP_KERNEL::NormalizedCellType MEDMEM_ORDER[N] = { INTERP_KERNEL::NORM_POINT1, INTERP_KERNEL::NORM_SEG2, INTERP_KERNEL::NORM_SEG3, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_TRI6, INTERP_KERNEL::NORM_QUAD8, INTERP_KERNEL::NORM_TETRA4, INTERP_KERNEL::NORM_PYRA5, INTERP_KERNEL::NORM_PENTA6, INTERP_KERNEL::NORM_HEXA8, INTERP_KERNEL::NORM_HEXGP12, INTERP_KERNEL::NORM_TETRA10, INTERP_KERNEL::NORM_PYRA13, INTERP_KERNEL::NORM_PENTA15, INTERP_KERNEL::NORM_HEXA20, INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_POLYHED };
+ checkConnectivityFullyDefined();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=getRenumArrForConsecutiveCellTypesSpec(MEDMEM_ORDER,MEDMEM_ORDER+N);
+ renumberCells(ret->getConstPointer(),false);
+ ret->incrRef();
+ return ret;
}
/*!
{
INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i];
if(types.find(curType)!=types.end())
- return false;
+ return false;
types.insert(curType);
i=std::find_if(i+1,connI+nbOfCells,ParaMEDMEMImpl::ConnReader(conn,(int)curType));
}
}
/*!
- * This method is similar to method MEDCouplingUMesh::rearrange2ConsecutiveCellTypes except that the type order is specfied by [orderBg,orderEnd) (as MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder method) and that this method is \b const and performs \b NO permutation is 'this'.
- * This method returns an array of size getNumberOfCells() that gives a renumber array old2New that can be used as input of MEDCouplingMesh::renumberCells.
- * The mesh after this call will pass the test of MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder with the same inputs.
- * The returned array minimizes the permutations that is to say the order of cells inside same geometric type remains the same.
+ * This method returns 2 newly allocated DataArrayInt instances. The first is an array of size 'this->getNumberOfCells()' with one component,
+ * that tells for each cell the pos of its type in the array on type given in input parameter. The 2nd output parameter is an array with the same
+ * number of tuples than input type array and with one component. This 2nd output array gives type by type the number of occurence of type in 'this'.
*/
-DataArrayInt *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const
+DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const throw(INTERP_KERNEL::Exception)
{
- checkFullyDefined();
+ checkConnectivityFullyDefined();
int nbOfCells=getNumberOfCells();
const int *conn=_nodal_connec->getConstPointer();
const int *connI=_nodal_connec_index->getConstPointer();
- int *tmp=new int[nbOfCells];
- int minPos=std::numeric_limits<int>::max();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpa=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpb=DataArrayInt::New();
+ tmpa->alloc(nbOfCells,1);
+ tmpb->alloc(std::distance(orderBg,orderEnd),1);
+ tmpb->fillWithZero();
+ int *tmp=tmpa->getPointer();
+ int *tmp2=tmpb->getPointer();
for(const int *i=connI;i!=connI+nbOfCells;i++)
{
- int pos=std::distance(orderBg,std::find(orderBg,orderEnd,(INTERP_KERNEL::NormalizedCellType)conn[*i]));
- tmp[std::distance(connI,i)]=pos;
- minPos=std::min(minPos,pos);
- }
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc(nbOfCells,1);
- int *optr=ret->getPointer();
- int k=0;
- while(minPos!=std::numeric_limits<int>::max())
- {
- int nextMinPos=std::numeric_limits<int>::max();
- for(int j=0;j<nbOfCells;j++)
+ const INTERP_KERNEL::NormalizedCellType *where=std::find(orderBg,orderEnd,(INTERP_KERNEL::NormalizedCellType)conn[*i]);
+ if(where!=orderEnd)
{
- if(tmp[j]==minPos)
- {
- optr[j]=k++;
- tmp[j]=std::numeric_limits<int>::max();
- }
- else
- nextMinPos=std::min(nextMinPos,tmp[j]);
+ int pos=std::distance(orderBg,where);
+ tmp2[pos]++;
+ tmp[std::distance(connI,i)]=pos;
+ }
+ else
+ {
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*i]);
+ std::ostringstream oss; oss << "MEDCouplingUMesh::getLevArrPerCellTypes : Cell #" << std::distance(connI,i);
+ oss << " has a type " << cm.getRepr() << " not in input array of type !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- minPos=nextMinPos;
}
- delete [] tmp;
- return ret;
+ nbPerType=tmpb;
+ tmpa->incrRef();
+ tmpb->incrRef();
+ return tmpa;
+}
+
+/*!
+ * This method is similar to method MEDCouplingUMesh::rearrange2ConsecutiveCellTypes except that the type order is specfied by [orderBg,orderEnd) (as MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder method) and that this method is \b const and performs \b NO permutation in 'this'.
+ * This method returns an array of size getNumberOfCells() that gives a renumber array old2New that can be used as input of MEDCouplingMesh::renumberCells.
+ * The mesh after this call to MEDCouplingMesh::renumberCells will pass the test of MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder with the same inputs.
+ * The returned array minimizes the permutations that is to say the order of cells inside same geometric type remains the same.
+ */
+DataArrayInt *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const throw(INTERP_KERNEL::Exception)
+{
+ DataArrayInt *nbPerType=0;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType);
+ nbPerType->decrRef();
+ return tmpa->buildPermArrPerLevel();
}
/*!
* cells whose ids is in 'idsPerGeoType' array.
* This method conserves coords and name of mesh.
*/
-MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const std::vector<int>& idsPerGeoType) const
+MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const int *idsPerGeoTypeBg, const int *idsPerGeoTypeEnd) const
{
std::vector<int> idsTokeep;
int nbOfCells=getNumberOfCells();
idsTokeep.push_back(i);
else
{
- if(std::find(idsPerGeoType.begin(),idsPerGeoType.end(),j)!=idsPerGeoType.end())
+ if(std::find(idsPerGeoTypeBg,idsPerGeoTypeEnd,j)!=idsPerGeoTypeEnd)
idsTokeep.push_back(i);
j++;
}
ret->decrRef();
return 0;
}
- ret2->setName(getName());
+ ret2->copyTinyInfoFrom(this);
return ret2;
}
int spaceDim=getSpaceDimension();
int nbOfCells=getNumberOfCells();
ret->alloc(nbOfCells,spaceDim);
+ ret->copyStringInfoFrom(*getCoords());
double *ptToFill=ret->getPointer();
double *tmp=new double[spaceDim];
const int *nodal=_nodal_connec->getConstPointer();
return ret;
}
+/*!
+ * This method expects as input a DataArrayDouble non nul instance 'da' that should be allocated. If not an exception is thrown.
+ *
+ */
+MEDCouplingUMesh *MEDCouplingUMesh::Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception)
+{
+ if(!da)
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Build0DMeshFromCoords : instance of DataArrayDouble must be not null !");
+ da->checkAllocated();
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(da->getName().c_str(),0);
+ ret->setCoords(da);
+ int nbOfTuples=da->getNumberOfTuples();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cI=DataArrayInt::New();
+ c->alloc(2*nbOfTuples,1);
+ cI->alloc(nbOfTuples+1,1);
+ int *cp=c->getPointer();
+ int *cip=cI->getPointer();
+ *cip++=0;
+ for(int i=0;i<nbOfTuples;i++)
+ {
+ *cp++=INTERP_KERNEL::NORM_POINT1;
+ *cp++=i;
+ *cip++=2*(i+1);
+ }
+ ret->setConnectivity(c,cI,true);
+ ret->incrRef();
+ return ret;
+}
+
/*!
* Returns a newly created mesh (with ref count ==1) that contains merge of 'mesh1' and 'other'.
* The coords of 'mesh2' are added at the end of coords of 'mesh1'.
*cPtr=-1;
}
}
- offset=*(cIPtr-1);
+ offset+=curCI[curNbOfCell];
offset2+=(*it)->getNumberOfNodes();
}
//
{
if(meshes.empty())
throw INTERP_KERNEL::Exception("meshes input parameter is expected to be non empty.");
- DataArrayDouble *coords=meshes.front()->getCoords();
+ const DataArrayDouble *coords=meshes.front()->getCoords();
int meshDim=meshes.front()->getMeshDimension();
std::vector<const MEDCouplingUMesh *>::const_iterator iter=meshes.begin();
int meshLgth=0;
void MEDCouplingUMesh::appendExtrudedCell(const int *connBg, const int *connEnd, int nbOfNodesPerLev, bool isQuad, std::vector<int>& ret)
{
INTERP_KERNEL::NormalizedCellType flatType=(INTERP_KERNEL::NormalizedCellType)connBg[0];
- const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::getCellModel(flatType);
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(flatType);
ret.push_back(cm.getExtrudedType());
int deltaz=isQuad?2*nbOfNodesPerLev:nbOfNodesPerLev;
switch(flatType)
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGUMESH_HXX__
MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const char *meshName, int meshDim);
MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const;
- MEDCOUPLING_EXPORT void updateTime();
+ MEDCOUPLING_EXPORT void updateTime() const;
MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED; }
MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingMesh *other, double prec) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkCoherency() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setMeshDimension(int meshDim);
MEDCOUPLING_EXPORT void allocateCells(int nbOfCells);
MEDCOUPLING_EXPORT void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void finishInsertingCells();
MEDCOUPLING_EXPORT const std::set<INTERP_KERNEL::NormalizedCellType>& getAllTypes() const { return _types; }
+ MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getTypesOfPart(const int *begin, const int *end) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true);
- MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() const { return _nodal_connec; }
- MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivityIndex() const { return _nodal_connec_index; }
+ MEDCOUPLING_EXPORT const DataArrayInt *getNodalConnectivity() const { return _nodal_connec; }
+ MEDCOUPLING_EXPORT const DataArrayInt *getNodalConnectivityIndex() const { return _nodal_connec_index; }
+ MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() { return _nodal_connec; }
+ MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivityIndex() { return _nodal_connec_index; }
MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
MEDCOUPLING_EXPORT int getMeshLength() const;
MEDCOUPLING_EXPORT void computeTypes();
//! size of returned tinyInfo must be always the same.
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
//tools
MEDCOUPLING_EXPORT bool areCellsEqual(int cell1, int cell2, int compType) const;
MEDCOUPLING_EXPORT bool areCellsEqual0(int cell1, int cell2) const;
MEDCOUPLING_EXPORT bool areCellsEqual2(int cell1, int cell2) const;
MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingUMesh *other, int cellId, double prec) const;
MEDCOUPLING_EXPORT void convertToPolyTypes(const std::vector<int>& cellIdsToConvert);
+ MEDCOUPLING_EXPORT void convertAllToPoly();
MEDCOUPLING_EXPORT void unPolyze();
MEDCOUPLING_EXPORT DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *zipConnectivityTraducer(int compType) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelf(const int *begin, const int *end, bool keepCoords) const;
MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const;
+ MEDCOUPLING_EXPORT DataArrayInt *getCellIdsLyingOnNodes(const int *begin, const int *end, bool fullyIn) const;
MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void findBoundaryNodes(std::vector<int>& nodes) const;
MEDCOUPLING_EXPORT MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
+ MEDCOUPLING_EXPORT DataArrayInt *findCellsIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void renumberNodes(const int *newNodeNumbers, int newNbOfNodes);
MEDCOUPLING_EXPORT void renumberNodes2(const int *newNodeNumbers, int newNbOfNodes);
MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void giveElemsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems);
- MEDCOUPLING_EXPORT void giveElemsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems);
+ MEDCOUPLING_EXPORT void getCellsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems);
+ MEDCOUPLING_EXPORT void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
- MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getPartMeasureField(bool isAbs, const int *begin, const int *end) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *getPartMeasureField(bool isAbs, const int *begin, const int *end) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildPartOrthogonalField(const int *begin, const int *end) const;
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getWarpField() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
//utilities for MED File RW
+ MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *&revDesc, DataArrayInt *&revDescIndx, DataArrayInt *& nM1LevMeshIds, DataArrayInt *&meshnM1Old2New) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool checkConsecutiveCellTypes() const;
MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const;
- MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const;
+ MEDCOUPLING_EXPORT DataArrayInt *getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *rearrange2ConsecutiveCellTypes();
MEDCOUPLING_EXPORT std::vector<MEDCouplingUMesh *> splitByType() const;
MEDCOUPLING_EXPORT DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const int *begin, const int *end) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT MEDCouplingUMesh *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const std::vector<int>& idsPerGeoType) const;
+ MEDCOUPLING_EXPORT MEDCouplingUMesh *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const int *idsPerGeoTypeBg, const int *idsPerGeoTypeEnd) const;
//
MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const;
MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const int *begin, const int *end) const;
+ MEDCOUPLING_EXPORT static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(std::vector<const MEDCouplingUMesh *>& a) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy);
~MEDCouplingUMesh();
void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
+ void checkConnectivityFullyDefined() const throw(INTERP_KERNEL::Exception);
void reprConnectivityOfThisLL(std::ostringstream& stream) const;
//tools
DataArrayInt *simplexizePol0() throw(INTERP_KERNEL::Exception);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingUMeshDesc.hxx"
using namespace ParaMEDMEM;
-MEDCouplingUMeshDesc::MEDCouplingUMeshDesc():_mesh_dim(-1),_desc_connec(0),_desc_connec_index(0),
+MEDCouplingUMeshDesc::MEDCouplingUMeshDesc():_mesh_dim(-2),_desc_connec(0),_desc_connec_index(0),
_nodal_connec_face(0),_nodal_connec_face_index(0)
{
}
{
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=_types.begin();iter!=_types.end();iter++)
{
- if(INTERP_KERNEL::CellModel::getCellModel(*iter).getDimension()!=_mesh_dim)
+ if((int)INTERP_KERNEL::CellModel::GetCellModel(*iter).getDimension()!=_mesh_dim)
{
std::ostringstream message;
message << "MeshDesc invalid because dimension is " << _mesh_dim << " and there is presence of cell(s) with type " << (*iter);
}
}
+void MEDCouplingUMeshDesc::checkCoherency1(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency();
+}
+
+void MEDCouplingUMeshDesc::checkCoherency2(double eps) const throw(INTERP_KERNEL::Exception)
+{
+ checkCoherency1(eps);
+}
+
void MEDCouplingUMeshDesc::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception)
{
return (INTERP_KERNEL::NormalizedCellType)desc_connec[desc_connec_index[cellId]+1];
}
+std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingUMeshDesc::getAllGeoTypes() const
+{
+ return _types;
+}
+
int MEDCouplingUMeshDesc::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
const int *desc_connec=_desc_connec->getConstPointer();
computeTypes();
}
-void MEDCouplingUMeshDesc::getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+DataArrayInt *MEDCouplingUMeshDesc::checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
{
- MEDCouplingPointSet::getTinySerializationInformation(tinyInfo,littleStrings);
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
+}
+
+void MEDCouplingUMeshDesc::splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
+}
+
+void MEDCouplingUMeshDesc::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+{
+ MEDCouplingPointSet::getTinySerializationInformation(tinyInfoD,tinyInfo,littleStrings);
tinyInfo.push_back(getMeshDimension());
tinyInfo.push_back(getNumberOfNodes());
tinyInfo.push_back(getNumberOfCells());
return tinyInfo[5]<=0;
}
-void MEDCouplingUMeshDesc::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings)
+void MEDCouplingUMeshDesc::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
{
std::vector<int> tinyInfoTmp(tinyInfo.begin()+1,tinyInfo.end());
MEDCouplingPointSet::resizeForUnserialization(tinyInfoTmp,a1,a2,littleStrings);
std::copy(faceConnIndex,faceConnIndex+getNumberOfFaces()+1,ptA1);
}
-void MEDCouplingUMeshDesc::unserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
+void MEDCouplingUMeshDesc::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
{
std::vector<int> tinyInfoTmp(tinyInfo.begin()+1,tinyInfo.end());
- MEDCouplingPointSet::unserialization(tinyInfoTmp,a1,a2,littleStrings);
+ MEDCouplingPointSet::unserialization(tinyInfoD,tinyInfoTmp,a1,a2,littleStrings);
//
const int *recvBuffer=a1->getConstPointer();
DataArrayInt *descConn=DataArrayInt::New();
setMeshDimension(tinyInfo[2]);
}
-void MEDCouplingUMeshDesc::giveElemsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems)
+void MEDCouplingUMeshDesc::getCellsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems)
{
int dim=getSpaceDimension();
double* elem_bb=new double[2*dim];
delete [] elem_bb;
}
-void MEDCouplingUMeshDesc::giveElemsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox &bbox, double eps, std::vector<int>& elems)
+void MEDCouplingUMeshDesc::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox &bbox, double eps, std::vector<int>& elems)
{
int dim=getSpaceDimension();
double* elem_bb=new double[2*dim];
int MEDCouplingUMeshDesc::getCellContainingPoint(const double *pos, double eps) const
{
- //not implemented yet.
- return -1;
+ throw INTERP_KERNEL::Exception("MEDCouplingUMeshDesc::getCellContainingPoint : not implemented yet !");
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __PARAMEDMEM_MEDCOUPLINGUMESHDESC_HXX__
MEDCOUPLING_EXPORT static MEDCouplingUMeshDesc *New(const char *meshName, int meshDim);
MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const;
MEDCOUPLING_EXPORT void checkCoherency() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
MEDCOUPLING_EXPORT int getFaceMeshLength() const;
MEDCOUPLING_EXPORT int getMeshDimension() const { return _mesh_dim; }
MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
+ MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED_DESC; }
MEDCOUPLING_EXPORT void setConnectivity(DataArrayInt *descConn, DataArrayInt *descConnIndex, DataArrayInt *nodalFaceConn, DataArrayInt *nodalFaceConnIndx);
//tools to overload
- MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
+ MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
- MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
- MEDCOUPLING_EXPORT void unserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
- MEDCOUPLING_EXPORT void giveElemsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems);
- MEDCOUPLING_EXPORT void giveElemsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox &bbox, double eps, std::vector<int>& elems);
+ MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
+ MEDCOUPLING_EXPORT void getCellsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems);
+ MEDCOUPLING_EXPORT void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox &bbox, double eps, std::vector<int>& elems);
MEDCOUPLING_EXPORT DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes);
MEDCOUPLING_EXPORT DataArrayInt *mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes);
MEDCOUPLING_EXPORT void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
void computeTypes();
void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
private:
- unsigned _mesh_dim;
+ int _mesh_dim;
DataArrayInt *_desc_connec;
DataArrayInt *_desc_connec_index;
DataArrayInt *_nodal_connec_face;
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
MEDCouplingNormalizedUnstructuredMesh.txx MEDCouplingMemArray.txx MEDCouplingRefCountObject.hxx \
MEDCouplingCMesh.hxx MEDCouplingTimeDiscretization.hxx \
MEDCouplingFieldDiscretization.hxx MEDCouplingPointSet.hxx MEDCouplingPointSet.txx \
-MEDCouplingUMeshDesc.hxx MEDCouplingNatureOfField.hxx \
+MEDCouplingUMeshDesc.hxx MEDCouplingNatureOfField.hxx MEDCouplingFieldTemplate.hxx \
MEDCouplingNormalizedCartesianMesh.hxx MEDCouplingNormalizedCartesianMesh.txx \
MEDCouplingRemapper.hxx MEDCouplingExtrudedMesh.hxx MEDCouplingGaussLocalization.hxx \
-MEDCouplingAutoRefCountObjectPtr.hxx
+MEDCouplingAutoRefCountObjectPtr.hxx MEDCouplingMultiFields.hxx MEDCouplingDefinitionTime.hxx \
+MEDCouplingFieldOverTime.hxx
# Libraries targets
MEDCouplingUMesh.cxx MEDCouplingMemArray.cxx MEDCouplingTimeLabel.cxx \
MEDCouplingCMesh.cxx MEDCouplingTimeDiscretization.cxx \
MEDCouplingFieldDiscretization.cxx MEDCouplingRefCountObject.cxx \
- MEDCouplingPointSet.cxx MEDCouplingUMeshDesc.cxx \
+ MEDCouplingPointSet.cxx MEDCouplingUMeshDesc.cxx MEDCouplingFieldTemplate.cxx \
MEDCouplingExtrudedMesh.cxx MEDCouplingMesh.cxx MEDCouplingGaussLocalization.cxx \
- MEDCouplingNatureOfField.cxx
+ MEDCouplingNatureOfField.cxx MEDCouplingMultiFields.cxx \
+ MEDCouplingDefinitionTime.cxx MEDCouplingFieldOverTime.cxx
libmedcoupling_la_LDFLAGS=
libmedcoupling_la_CPPFLAGS= @CXXTMPDPTHFLAGS@ \
-I$(srcdir) -I$(srcdir)/../INTERP_KERNEL/Bases \
-I$(srcdir)/../INTERP_KERNEL -I$(srcdir)/../INTERP_KERNEL/Geometric2D \
- -I$(srcdir)/../INTERP_KERNEL/ExprEval
+ -I$(srcdir)/../INTERP_KERNEL/ExprEval -I$(srcdir)/../INTERP_KERNEL/GaussPoints
# the geom2D library is included in the interpkernel one
libmedcoupling_la_LIBADD= ../INTERP_KERNEL/libinterpkernel.la
MEDCouplingNatureOfField.hxx \
MEDCouplingRemapper.hxx \
MEDCouplingExtrudedMesh.hxx \
- MEDCouplingGaussLocalization.hxx
+ MEDCouplingGaussLocalization.hxx \
+ MEDCouplingMultiFields.hxx \
+ MEDCouplingFieldTemplate.hxx \
+ MEDCouplingDefinitionTime.hxx \
+ MEDCouplingFieldOverTime.hxx
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MEDCOUPLINGBASICSTEST_HXX__
namespace ParaMEDMEM
{
+ class DataArrayDouble;
class MEDCouplingUMesh;
+ class MEDCouplingFieldDouble;
+ class MEDCouplingMultiFields;
class MEDCouplingBasicsTest : public CppUnit::TestFixture
{
CPPUNIT_TEST( testFillFromAnalytic3 );
CPPUNIT_TEST( testFieldDoubleOpEqual1 );
CPPUNIT_TEST( testAreaBary3D2 );
+ //MEDCouplingBasicsTest3.cxx
CPPUNIT_TEST( testGetMeasureFieldCMesh1 );
CPPUNIT_TEST( testFieldDoubleZipCoords1 );
CPPUNIT_TEST( testFieldDoubleZipConnectivity1 );
CPPUNIT_TEST( testUMeshGetTypesOfPart1 );
CPPUNIT_TEST( testUMeshKeepCellIdsByType1 );
CPPUNIT_TEST( testDAIAggregateMulti1 );
+ CPPUNIT_TEST( testMergeUMeshes2 );
+ CPPUNIT_TEST( testBuild0DMeshFromCoords1 );
+ //MEDCouplingBasicsTest4.cxx
+ CPPUNIT_TEST( testDescriptionInMeshTimeUnit1 );
+ CPPUNIT_TEST( testMultiFields1 );
+ CPPUNIT_TEST( testFieldOverTime1 );
+ CPPUNIT_TEST( testDAICheckAndPreparePermutation1 );
+ CPPUNIT_TEST( testDAIChangeSurjectiveFormat1 );
+ CPPUNIT_TEST( testUMeshGetCellIdsLyingOnNodes1 );
+ CPPUNIT_TEST( testUMeshFindCellsIdsOnBoundary1 );
+ CPPUNIT_TEST( testMeshSetTime1 );
+ CPPUNIT_TEST( testApplyFuncTwo1 );
+ CPPUNIT_TEST( testApplyFuncThree1 );
+ CPPUNIT_TEST( testFillFromAnalyticTwo1 );
+ CPPUNIT_TEST( testFillFromAnalyticThree1 );
+ CPPUNIT_TEST( testDAUnitVar1 );
+ CPPUNIT_TEST( testGaussCoordinates1 );
+ CPPUNIT_TEST( testP2Localization1 );
+ CPPUNIT_TEST( testP2Localization2 );
+ CPPUNIT_TEST( testGetValueOn2 );
+ CPPUNIT_TEST( testDAIGetIdsNotEqual1 );
+ CPPUNIT_TEST( testDAIComputeOffsets1 );
+ CPPUNIT_TEST( testUMeshHexagonPrism1 );
+ CPPUNIT_TEST( testDADCheckIsMonotonic );
+ CPPUNIT_TEST( testCheckCoherencyDeeper1 );
+ CPPUNIT_TEST( testUnPolyze2 );
+ CPPUNIT_TEST( testDACpyFrom1 );
+ CPPUNIT_TEST( testDAITransformWithIndArr1 );
+ CPPUNIT_TEST( testDAIBuildPermArrPerLevel1 );
+ CPPUNIT_TEST( testDAIOperations1 );
+ CPPUNIT_TEST( testEmulateMEDMEMBDC1 );
+ CPPUNIT_TEST( testGetLevArrPerCellTypes1 );
+ CPPUNIT_TEST( testSortCellsInMEDFileFrmt1 );
+ CPPUNIT_TEST( testBuildPartAndReduceNodes1 );
+ CPPUNIT_TEST( testDAITransformWithIndArrR1 );
+ CPPUNIT_TEST( testDAISplitByValueRange1 );
+ CPPUNIT_TEST( testUMeshSplitProfilePerType1 );
+ CPPUNIT_TEST( testDAIBuildExplicitArrByRanges1 );
+ CPPUNIT_TEST( testDAIComputeOffsets2 );
//MEDCouplingBasicsTestInterp.cxx
CPPUNIT_TEST( test2DInterpP0P0_1 );
CPPUNIT_TEST( test2DInterpP0P0PL_1 );
void testFillFromAnalytic3();
void testFieldDoubleOpEqual1();
void testAreaBary3D2();
+ //MEDCouplingBasicsTest3.cxx
void testGetMeasureFieldCMesh1();
void testFieldDoubleZipCoords1();
void testFieldDoubleZipConnectivity1();
void testUMeshGetTypesOfPart1();
void testUMeshKeepCellIdsByType1();
void testDAIAggregateMulti1();
+ void testMergeUMeshes2();
+ void testBuild0DMeshFromCoords1();
+ //MEDCouplingBasicsTest4.cxx
+ void testDescriptionInMeshTimeUnit1();
+ void testMultiFields1();
+ void testFieldOverTime1();
+ void testDAICheckAndPreparePermutation1();
+ void testDAIChangeSurjectiveFormat1();
+ void testUMeshGetCellIdsLyingOnNodes1();
+ void testUMeshFindCellsIdsOnBoundary1();
+ void testMeshSetTime1();
+ void testApplyFuncTwo1();
+ void testApplyFuncThree1();
+ void testFillFromAnalyticTwo1();
+ void testFillFromAnalyticThree1();
+ void testDAUnitVar1();
+ void testGaussCoordinates1();
+ void testQ1Localization1();
+ void testP2Localization1();
+ void testP2Localization2();
+ void testGetValueOn2();
+ void testDAIGetIdsNotEqual1();
+ void testDAIComputeOffsets1();
+ void testUMeshHexagonPrism1();
+ void testDADCheckIsMonotonic();
+ void testCheckCoherencyDeeper1();
+ void testUnPolyze2();
+ void testDACpyFrom1();
+ void testDAITransformWithIndArr1();
+ void testDAIBuildPermArrPerLevel1();
+ void testDAIOperations1();
+ void testEmulateMEDMEMBDC1();
+ void testGetLevArrPerCellTypes1();
+ void testSortCellsInMEDFileFrmt1();
+ void testBuildPartAndReduceNodes1();
+ void testDAITransformWithIndArrR1();
+ void testDAISplitByValueRange1();
+ void testUMeshSplitProfilePerType1();
+ void testDAIBuildExplicitArrByRanges1();
+ void testDAIComputeOffsets2();
//MEDCouplingBasicsTestInterp.cxx
void test2DInterpP0P0_1();
void test2DInterpP0P0PL_1();
static MEDCouplingUMesh *build2DTargetMesh_3();
static MEDCouplingUMesh *build3DTargetMesh_3();
static MEDCouplingUMesh *build2DTargetMesh_4();
+ static MEDCouplingUMesh *build1DMultiTypes_1();
+ static MEDCouplingUMesh *build2DMultiTypes_1();
+ static MEDCouplingUMesh *build3DMultiTypes_1();
+ static MEDCouplingUMesh *buildHexa8Mesh_1();
+ static MEDCouplingUMesh *buildPointe_1(MEDCouplingUMesh *&m1);
+ static DataArrayDouble *buildCoordsForMultiTypes_1();
+ static MEDCouplingMultiFields *buildMultiFields_1();
+ static std::vector<MEDCouplingFieldDouble *> buildMultiFields_2();
static double sumAll(const std::vector< std::map<int,double> >& matrix);
};
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingBasicsTest.hxx"
#include "MEDCouplingExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMultiFields.hxx"
#include "MEDCouplingBasicsTestData1.hxx"
MEDCouplingUMesh *MEDCouplingBasicsTest::build3DExtrudedUMesh_1(MEDCouplingUMesh *&mesh2D)
{
double coords[180]={
- 0.,0.,0., 1.,1.,0., 1.,1.25,0., 0.,1.,0., 1.,1.5,0., 2.,0.,0., 2.,1.,0., 1.,2.,0., 0.,2.,0., 3.,1.,0.,
+ 0.,0.,0., 1.,1.,0., 1.,1.25,0., 1.,0.,0., 1.,1.5,0., 2.,0.,0., 2.,1.,0., 1.,2.,0., 0.,2.,0., 3.,1.,0.,
3.,2.,0., 0.,1.,0., 1.,3.,0., 2.,2.,0., 2.,3.,0.,
- 0.,0.,1., 1.,1.,1., 1.,1.25,1., 0.,1.,1., 1.,1.5,1., 2.,0.,1., 2.,1.,1., 1.,2.,1., 0.,2.,1., 3.,1.,1.,
+ 0.,0.,1., 1.,1.,1., 1.,1.25,1., 1.,0.,1., 1.,1.5,1., 2.,0.,1., 2.,1.,1., 1.,2.,1., 0.,2.,1., 3.,1.,1.,
3.,2.,1., 0.,1.,1., 1.,3.,1., 2.,2.,1., 2.,3.,1.,
- 0.,0.,2., 1.,1.,2., 1.,1.25,2., 0.,1.,2., 1.,1.5,2., 2.,0.,2., 2.,1.,2., 1.,2.,2., 0.,2.,2., 3.,1.,2.,
+ 0.,0.,2., 1.,1.,2., 1.,1.25,2., 1.,0.,2., 1.,1.5,2., 2.,0.,2., 2.,1.,2., 1.,2.,2., 0.,2.,2., 3.,1.,2.,
3.,2.,2., 0.,1.,2., 1.,3.,2., 2.,2.,2., 2.,3.,2.,
- 0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
+ 0.,0.,3., 1.,1.,3., 1.,1.25,3., 1.,0.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.};
int conn[354]={
return 0;
}
+MEDCouplingMultiFields *MEDCouplingBasicsTest::buildMultiFields_1()
+{
+ ParaMEDMEM::MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ m1->setName("m1");
+ ParaMEDMEM::MEDCouplingUMesh *m2=build2DTargetMesh_1();
+ m2->setName("m2");
+ const double vals0[]={-0.7,-1.,-2.,-3.,-4.};
+ const double vals1[]={0.,1.,2.,3.,4.,0.1,0.2,0.3,0.4};
+ const double vals1_1[]={170.,171.,172.,173.,174.,170.1,170.2,170.3,170.4};
+ const double vals2[]={5.,6.,7.,8.,9.};
+ const double vals4[]={15.,16.,17.,18.,19.};
+ //
+ ParaMEDMEM::DataArrayDouble *d0=ParaMEDMEM::DataArrayDouble::New(); d0->alloc(5,1); std::copy(vals0,vals0+5,d0->getPointer());
+ ParaMEDMEM::DataArrayDouble *d1=ParaMEDMEM::DataArrayDouble::New(); d1->alloc(9,1); std::copy(vals1,vals1+9,d1->getPointer());
+ ParaMEDMEM::DataArrayDouble *d1_1=ParaMEDMEM::DataArrayDouble::New(); d1_1->alloc(9,1); std::copy(vals1_1,vals1_1+9,d1_1->getPointer());
+ ParaMEDMEM::DataArrayDouble *d2=ParaMEDMEM::DataArrayDouble::New(); d2->alloc(5,1); std::copy(vals2,vals2+5,d2->getPointer());
+ ParaMEDMEM::DataArrayDouble *d4=ParaMEDMEM::DataArrayDouble::New(); d4->alloc(5,1); std::copy(vals4,vals4+5,d4->getPointer());
+ //
+ d0->setName("d0"); d1->setName("d1"); d1_1->setName("d1_1"); d2->setName("d2"); d4->setName("d4");
+ d0->setInfoOnComponent(0,"c1");
+ d1->setInfoOnComponent(0,"c6");
+ d1_1->setInfoOnComponent(0,"c9");
+ d2->setInfoOnComponent(0,"c5");
+ d4->setInfoOnComponent(0,"c7");
+ //
+ ParaMEDMEM::MEDCouplingFieldDouble *f0=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME);
+ f0->setMesh(m1);
+ f0->setArray(d0);
+ f0->setTime(0.2,5,6);
+ f0->setName("f0");
+ ParaMEDMEM::MEDCouplingFieldDouble *f1=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_NODES,ParaMEDMEM::LINEAR_TIME);
+ f1->setMesh(m1);
+ std::vector<ParaMEDMEM::DataArrayDouble *> d1s(2); d1s[0]=d1; d1s[1]=d1_1;
+ f1->setArrays(d1s);
+ f1->setStartTime(0.7,7,8);
+ f1->setEndTime(1.2,9,10);
+ f1->setName("f1");
+ ParaMEDMEM::MEDCouplingFieldDouble *f2=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::CONST_ON_TIME_INTERVAL);
+ f2->setMesh(m2);
+ f2->setArray(d2);
+ f2->setTime(1.2,11,12);
+ f2->setEndTime(1.5,13,14);
+ f2->setName("f2");
+ ParaMEDMEM::MEDCouplingFieldDouble *f3=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME);
+ f3->setMesh(m1);
+ f3->setArray(d2);
+ f3->setTime(1.7,15,16);
+ f3->setName("f3");
+ ParaMEDMEM::MEDCouplingFieldDouble *f4=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::NO_TIME);
+ f4->setMesh(m2);
+ f4->setArray(d4);
+ f4->setName("f4");
+ //
+ std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> fs(5);
+ fs[0]=f0; fs[1]=f1; fs[2]=f2; fs[3]=f3; fs[4]=f4;
+ ParaMEDMEM::MEDCouplingMultiFields *ret=ParaMEDMEM::MEDCouplingMultiFields::New(fs);
+ //
+ m1->decrRef();
+ m2->decrRef();
+ d0->decrRef();
+ d1->decrRef();
+ d1_1->decrRef();
+ d2->decrRef();
+ d4->decrRef();
+ f0->decrRef();
+ f1->decrRef();
+ f2->decrRef();
+ f3->decrRef();
+ f4->decrRef();
+ //
+ return ret;
+}
+
+std::vector<MEDCouplingFieldDouble *> MEDCouplingBasicsTest::buildMultiFields_2()
+{
+ ParaMEDMEM::MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ m1->setName("m1");
+ ParaMEDMEM::MEDCouplingUMesh *m2=build2DTargetMesh_1();
+ m2->setName("m2");
+ const double vals0[]={-0.7,-1.,-2.,-3.,-4.};
+ const double vals1[]={0.,1.,2.,3.,4.};
+ const double vals1_1[]={170.,171.,172.,173.,174.};
+ const double vals2[]={5.,6.,7.,8.,9.};
+ const double vals4[]={15.,16.,17.,18.,19.};
+ //
+ ParaMEDMEM::DataArrayDouble *d0=ParaMEDMEM::DataArrayDouble::New(); d0->alloc(5,1); std::copy(vals0,vals0+5,d0->getPointer());
+ ParaMEDMEM::DataArrayDouble *d1=ParaMEDMEM::DataArrayDouble::New(); d1->alloc(5,1); std::copy(vals1,vals1+5,d1->getPointer());
+ ParaMEDMEM::DataArrayDouble *d1_1=ParaMEDMEM::DataArrayDouble::New(); d1_1->alloc(5,1); std::copy(vals1_1,vals1_1+5,d1_1->getPointer());
+ ParaMEDMEM::DataArrayDouble *d2=ParaMEDMEM::DataArrayDouble::New(); d2->alloc(5,1); std::copy(vals2,vals2+5,d2->getPointer());
+ ParaMEDMEM::DataArrayDouble *d4=ParaMEDMEM::DataArrayDouble::New(); d4->alloc(5,1); std::copy(vals4,vals4+5,d4->getPointer());
+ //
+ d0->setName("d0"); d1->setName("d1"); d1_1->setName("d1_1"); d2->setName("d2"); d4->setName("d4");
+ d0->setInfoOnComponent(0,"c1");
+ d1->setInfoOnComponent(0,"c6");
+ d1_1->setInfoOnComponent(0,"c9");
+ d2->setInfoOnComponent(0,"c5");
+ d4->setInfoOnComponent(0,"c7");
+ //
+ ParaMEDMEM::MEDCouplingFieldDouble *f0=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME);
+ f0->setMesh(m1);
+ f0->setArray(d0);
+ f0->setTime(0.2,5,6);
+ f0->setName("f0");
+ ParaMEDMEM::MEDCouplingFieldDouble *f1=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::LINEAR_TIME);
+ f1->setMesh(m1);
+ std::vector<ParaMEDMEM::DataArrayDouble *> d1s(2); d1s[0]=d1; d1s[1]=d1_1;
+ f1->setArrays(d1s);
+ f1->setStartTime(0.7,7,8);
+ f1->setEndTime(1.2,9,10);
+ f1->setName("f1");
+ ParaMEDMEM::MEDCouplingFieldDouble *f2=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::CONST_ON_TIME_INTERVAL);
+ f2->setMesh(m2);
+ f2->setArray(d2);
+ f2->setTime(1.2,11,12);
+ f2->setEndTime(1.5,13,14);
+ f2->setName("f2");
+ ParaMEDMEM::MEDCouplingFieldDouble *f3=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::ONE_TIME);
+ f3->setMesh(m1);
+ f3->setArray(d2);
+ f3->setTime(1.7,15,16);
+ f3->setName("f3");
+ ParaMEDMEM::MEDCouplingFieldDouble *f4=ParaMEDMEM::MEDCouplingFieldDouble::New(ParaMEDMEM::ON_CELLS,ParaMEDMEM::NO_TIME);
+ f4->setMesh(m2);
+ f4->setArray(d4);
+ f4->setName("f4");
+ //
+ std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> fs(5);
+ fs[0]=f0; fs[1]=f1; fs[2]=f2; fs[3]=f3; fs[4]=f4;
+ m1->decrRef();
+ m2->decrRef();
+ d0->decrRef();
+ d1->decrRef();
+ d1_1->decrRef();
+ d2->decrRef();
+ d4->decrRef();
+ //
+ return fs;
+}
+
+MEDCouplingUMesh *MEDCouplingBasicsTest::build1DMultiTypes_1()
+{
+ MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Multi1DMesh",1);
+ DataArrayDouble *coo=buildCoordsForMultiTypes_1();
+ const int conn[5]={0,2, 0,2,1};
+ mesh->allocateCells(2);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn+2);
+ mesh->finishInsertingCells();
+ mesh->setCoords(coo);
+ coo->decrRef();
+ return mesh;
+}
+
+MEDCouplingUMesh *MEDCouplingBasicsTest::build2DMultiTypes_1()
+{
+ MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Multi2DMesh",2);
+ DataArrayDouble *coo=buildCoordsForMultiTypes_1();
+ const int conn[21]={3,4,5, 3,4,5,6,7,8, 0,9,10,11, 0,9,10,11,12,13,14,15};
+ mesh->allocateCells(4);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_TRI6,6,conn+3);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+9);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD8,8,conn+13);
+ mesh->finishInsertingCells();
+ mesh->setCoords(coo);
+ coo->decrRef();
+ return mesh;
+}
+
+MEDCouplingUMesh *MEDCouplingBasicsTest::build3DMultiTypes_1()
+{
+ MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Multi3DMesh",3);
+ DataArrayDouble *coo=buildCoordsForMultiTypes_1();
+ const int conn[81]={0,16,17,18,
+ 0,16,17,18,19,20,21,22,23,24,
+ 0,11,10,9,25,
+ 0,11,10,9,25,15,14,13,12,26,27,28,29,
+ 0,30,31,32,33,34,
+ 0,30,31,32,33,34,35,36,37,38,39,40,41,42,43,
+ 0,9,10,11,44,45,46,47,
+ 0,9,10,11,44,45,46,47,12,13,14,15,48,49,50,51,52,53,54,55 };
+ mesh->allocateCells(8);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_TETRA10,10,conn+4);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_PYRA5,5,conn+14);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_PYRA13,13,conn+19);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_PENTA6,6,conn+32);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_PENTA15,15,conn+38);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+53);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA20,20,conn+61);
+ mesh->finishInsertingCells();
+ mesh->setCoords(coo);
+ coo->decrRef();
+ return mesh;
+}
+
+DataArrayDouble *MEDCouplingBasicsTest::buildCoordsForMultiTypes_1()
+{
+ DataArrayDouble *coords=DataArrayDouble::New();
+ coords->alloc(56,3);
+ coords->setInfoOnComponent(0,"X (cm)");
+ coords->setInfoOnComponent(1,"Y (cm)");
+ coords->setInfoOnComponent(2,"Z (cm)");
+ const double data[168]={
+ 0.0, 0.0, 0.0, //#0
+ 0.5, 0.5, 0.5, //#1
+ 1.0, 1.0, 1.0, //#2
+ 1.0, 1.0, 0.0, //#3
+ 2.0, 2.5, 0.0, //#4
+ 6.0, 1.5, 0.0, //#5
+ 1.0, 2.0, 0.0, //#6
+ 4.5, 2.5, 0.0, //#7
+ 4.0, 0.5, 0.0, //#8
+ 0.0, 4.0, 0.0, //#9
+ 4.0, 4.0, 0.0, //#10
+ 4.0, 0.0, 0.0, //#11
+ 0.0, 2.0, 0.0, //#12
+ 2.0, 4.0, 0.0, //#13
+ 4.0, 2.0, 0.0, //#14
+ 2.0, 0.0, 0.0, //#15
+ 0.0, 6.0, 0.0, //#16
+ 3.0, 3.0, 0.0, //#17
+ 1.3, 3.0, 3.0, //#18
+ 0.0, 3.0, 0.0, //#19
+ 1.5, 4.5, 0.0, //#20
+ 1.5, 1.5, 0.0, //#21
+ 0.65, 1.5, 1.5, //#22
+ 0.65, 4.5, 1.5, //#23
+ 2.15, 3.0, 1.5, //#24
+ 2.0, 2.0, 2.0, //#25
+ 3.0, 1.0, 1.0, //#26
+ 3.0, 3.0, 1.0, //#27
+ 1.0, 3.0, 1.0, //#28
+ 1.0, 1.0, 1.0, //#29
+ 0.0, 3.0, 0.0, //#30
+ 2.0, 0.0, 0.0, //#31
+ 0.0, 0.0, 6.0, //#32
+ 0.0, 3.0, 6.0, //#33
+ 3.0, 0.0, 6.0, //#34
+ 0.0, 1.5, 0.0, //#35
+ 1.5, 1.5, 0.0, //#36
+ 1.5, 0.0, 0.0, //#37
+ 0.0, 1.5, 6.0, //#38
+ 1.5, 1.5, 6.0, //#39
+ 1.5, 0.0, 6.0, //#40
+ 0.0, 0.0, 3.0, //#41
+ 0.0, 3.0, 3.0, //#42
+ 3.0, 0.0, 3.0, //#43
+ 0.0, 0.0, 4.0, //#44
+ 0.0, 4.0, 4.0, //#45
+ 4.0, 4.0, 4.0, //#46
+ 4.0, 0.0, 4.0, //#47
+ 0.0, 2.0, 4.0, //#48
+ 2.0, 4.0, 4.0, //#49
+ 4.0, 2.0, 4.0, //#50
+ 2.0, 0.0, 4.0, //#51
+ 0.0, 0.0, 2.0, //#52
+ 0.0, 4.0, 2.0, //#53
+ 4.0, 4.0, 2.0, //#54
+ 4.0, 0.0, 2.0 //#55
+ };
+ std::copy(data,data+168,coords->getPointer());
+ return coords;
+}
+
+MEDCouplingUMesh *MEDCouplingBasicsTest::buildHexa8Mesh_1()
+{
+ MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Hexa8Only",3);
+ DataArrayDouble *coo=DataArrayDouble::New();
+ const double coords[81]={0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.5, 1.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 0.5, 0.5, 1.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.5, 1.0, 0.5, 1.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.5, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.5, 0.5, 1.0, 1.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0};
+ coo->alloc(27,3);
+ std::copy(coords,coords+81,coo->getPointer());
+ const int conn[64]={3,12,13,4,0,9,10,1,
+ 4,13,14,5,1,10,11,2,
+ 6,15,16,7,3,12,13,4,
+ 7,16,17,8,4,13,14,5,
+ 12,21,22,13,9,18,19,10,
+ 13,22,23,14,10,19,20,11,
+ 15,24,25,16,12,21,22,13,
+ 16,25,26,17,13,22,23,14};
+ mesh->allocateCells(8);
+ for(int i=0;i<8;i++)
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+8*i);
+ mesh->finishInsertingCells();
+ mesh->setCoords(coo);
+ coo->decrRef();
+ return mesh;
+}
+
+MEDCouplingUMesh *MEDCouplingBasicsTest::buildPointe_1(MEDCouplingUMesh *& m1)
+{
+ MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Pointe.med",3);
+ MEDCouplingUMesh *mesh2=MEDCouplingUMesh::New("Pointe.med",2);
+ const double coords[57]={0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 1.0, 0.0, 2.0, 1.0, -2.0, 0.0, 1.0, 0.0, -2.0, 1.0, 1.0, 1.0, 2.0, -1.0, 1.0, 2.0, -1.0, -1.0, 2.0, 1.0, -1.0, 2.0, 1.0, 1.0, 3.0, -1.0, 1.0, 3.0, -1.0, -1.0, 3.0, 1.0, -1.0, 3.0, 1.0, 1.0, 4.0, -1.0, 1.0, 4.0, -1.0, -1.0, 4.0, 1.0, -1.0, 4.0, 0.0, 0.0, 5.0};
+ const int conn[74]={0,1,2,5,0,1,3,2,0,1,4,3,0,1,5,4,1,6,3,2,1,7,4,3,1,8,5,4,1,9,2,5,1,6,2,9,1,7,3,6,1,8,4,7,1,9,5,8, 6,7,8,9,1,14,17,16,15,18, 10,11,12,13,6,7,8,9,14,15,16,17,10,11,12,13};
+ DataArrayDouble *coo=DataArrayDouble::New();
+ coo->alloc(19,3);
+ std::copy(coords,coords+57,coo->getPointer());
+ mesh->setCoords(coo);
+ mesh2->setCoords(coo);
+ coo->decrRef();
+ mesh->allocateCells(16);
+ for(int i=0;i<12;i++)
+ mesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn+4*i);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_PYRA5,5,conn+48);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_PYRA5,5,conn+53);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+58);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+66);
+ mesh->finishInsertingCells();
+ //[1,34,29,23,41,32]
+ const int conn2[20]={0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9};
+ mesh2->allocateCells(6);
+ for(int i=0;i<4;i++)
+ mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn2+3*i);
+ mesh2->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn2+12);
+ mesh2->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn2+16);
+ mesh2->finishInsertingCells();
+ m1=mesh2;
+ //
+ return mesh;
+}
+
double MEDCouplingBasicsTest::sumAll(const std::vector< std::map<int,double> >& matrix)
{
double ret=0.;
- // Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingBasicsTest.hxx"
DataArrayInt *di;
MEDCouplingMesh *ret1=fieldCells->buildSubMeshData(elts,elts+3,di);
CPPUNIT_ASSERT_EQUAL(3,ret1->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(6,ret1->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(9,ret1->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(3,di->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(1,di->getNumberOfComponents());
const int *toCheck=di->getConstPointer();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingBasicsTest.hxx"
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_GAUSS_PT,NO_TIME);
f->setMesh(m);
+ CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization());
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1);
CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo1,_gsCoo1,_wg1),INTERP_KERNEL::Exception);
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_GAUSS_NE,NO_TIME);
f->setMesh(m);
+ CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
f->setName("MyFirstFieldOnNE");
f->setDescription("MyDescriptionNE");
DataArrayDouble *array=DataArrayDouble::New();
MEDCouplingUMesh *m=build2DTargetMesh_1();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
f->setMesh(m);
+ CPPUNIT_ASSERT_EQUAL(9,f->getNumberOfMeshPlacesExpected());
DataArrayDouble *arr=DataArrayDouble::New();
int nbOfNodes=m->getNumberOfNodes();
arr->alloc(nbOfNodes,3);
int nbOfCells=m->getNumberOfCells();
MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
f->setMesh(m);
+ CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected());
f->setName("a");
f->setDescription("b");
DataArrayDouble *a1=DataArrayDouble::New();
CPPUNIT_ASSERT(f1->getMesh()==mesh1);
f1->changeUnderlyingMesh(mesh2,10,1e-12);
CPPUNIT_ASSERT(f1->getMesh()==mesh2);
- const double expected2[22]={7.,107.,9.,109.,17.,117.,10.,110.,11.,111.,12.,112.,13.,113.,15.,115.,14.,114.,16.,116.,8.,108.};
+ const double expected2[22]={7.,107.,17.,117.,8.,108.,10.,110.,11.,111.,12.,112.,13.,113.,15.,115.,14.,114.,16.,116.,9.,109.};
for(int i=0;i<22;i++)
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f1->getArray()->getIJ(0,i),1e-12);
f1->decrRef();
CPPUNIT_ASSERT_EQUAL(2,f1->getNumberOfComponents());
CPPUNIT_ASSERT_EQUAL(20,f1->getNumberOfValues());
//
- const int renum[]={0,2,1,3,4,5,6,8,7,9};
+ const int renum[]={0,2,3,1,4,5,6,8,7,9};
mesh2->renumberCells(renum,false);
//
MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
f2->setMesh(mesh2);
array=DataArrayDouble::New();
array->alloc(mesh2->getNumberOfCells(),2);
- const double arr2[20]={7.1,107.1,9.1,109.1,8.1,108.1,10.1,110.1,11.1,111.1,12.1,112.1,13.1,113.1,15.1,115.1,14.1,114.1,16.1,116.1};
+ const double arr2[20]={7.1,107.1,10.1,110.1,8.1,108.1,9.1,109.1,11.1,111.1,12.1,112.1,13.1,113.1,15.1,115.1,14.1,114.1,16.1,116.1};
std::copy(arr2,arr2+20,array->getPointer());
f2->setArray(array);
array->decrRef();
//
const int part1[3]={2,1,4};
MEDCouplingFieldDouble *f2=f1->buildSubPart(part1,part1+3);
+ f2->zipCoords();
CPPUNIT_ASSERT_EQUAL(3,f2->getNumberOfTuples());
CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
const double expected1[6]={5.,105.,4.,104.,7.,107.};
//
mesh->decrRef();
}
-
-void MEDCouplingBasicsTest::testGetMeasureFieldCMesh1()
-{
- MEDCouplingCMesh *m=MEDCouplingCMesh::New();
- DataArrayDouble *da=DataArrayDouble::New();
- const double discX[4]={2.3,3.4,5.8,10.2};
- const double discY[3]={12.3,23.4,45.8};
- const double discZ[5]={-0.7,1.2,1.25,2.13,2.67};
- da->alloc(4,1);
- std::copy(discX,discX+4,da->getPointer());
- m->setCoordsAt(0,da);
- da->decrRef();
- m->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(3,m->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(1,m->getSpaceDimension());
- MEDCouplingFieldDouble *f=m->getMeasureField(true);
- CPPUNIT_ASSERT_EQUAL(3,f->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f->getNumberOfComponents());
- const double expected1[3]={1.1,2.4,4.4};
- for(int i=0;i<3;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f->getIJ(i,0),1e-12);
- f->decrRef();
- DataArrayDouble *coords=m->getCoordinatesAndOwner();
- CPPUNIT_ASSERT_EQUAL(4,coords->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,coords->getNumberOfComponents());
- for(int i=0;i<4;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(discX[i],coords->getIJ(i,0),1e-12);
- coords->decrRef();
- coords=m->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(3,coords->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,coords->getNumberOfComponents());
- const double expected1_3[3]={2.85,4.6,8.};
- for(int i=0;i<3;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1_3[i],coords->getIJ(i,0),1e-12);
- coords->decrRef();
- //
- da=DataArrayDouble::New();
- da->alloc(3,1);
- std::copy(discY,discY+3,da->getPointer());
- m->setCoordsAt(1,da);
- da->decrRef();
- m->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(12,m->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(6,m->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(2,m->getSpaceDimension());
- f=m->getMeasureField(true);
- CPPUNIT_ASSERT_EQUAL(6,f->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f->getNumberOfComponents());
- const double expected2[6]={12.21,26.64,48.84,24.64,53.76,98.56};
- for(int i=0;i<6;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(i,0),1e-12);
- f->decrRef();
- coords=m->getCoordinatesAndOwner();
- CPPUNIT_ASSERT_EQUAL(12,coords->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,coords->getNumberOfComponents());
- const double expected2_2[24]={2.3,12.3,3.4,12.3,5.8,12.3,10.2,12.3, 2.3,23.4,3.4,23.4,5.8,23.4,10.2,23.4, 2.3,45.8,3.4,45.8,5.8,45.8,10.2,45.8};
- for(int i=0;i<24;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2_2[i],coords->getIJ(0,i),1e-12);
- coords->decrRef();
- coords=m->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(6,coords->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,coords->getNumberOfComponents());
- const double expected2_3[12]={2.85,17.85,4.6,17.85,8.,17.85, 2.85,34.6,4.6,34.6,8.,34.6};
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2_3[i],coords->getIJ(0,i),1e-12);
- coords->decrRef();
- //
- da=DataArrayDouble::New();
- da->alloc(5,1);
- std::copy(discZ,discZ+5,da->getPointer());
- m->setCoordsAt(2,da);
- da->decrRef();
- m->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(60,m->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(24,m->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension());
- f=m->getMeasureField(true);
- CPPUNIT_ASSERT_EQUAL(24,f->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,f->getNumberOfComponents());
- const double expected3[24]={23.199, 50.616, 92.796, 46.816, 102.144, 187.264, 0.6105, 1.332, 2.442, 1.232, 2.688, 4.928, 10.7448, 23.4432, 42.9792, 21.6832, 47.3088, 86.7328, 6.5934, 14.3856, 26.3736, 13.3056, 29.0304, 53.2224};
- for(int i=0;i<24;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],f->getIJ(i,0),1e-12);
- f->decrRef();
- coords=m->getCoordinatesAndOwner();
- CPPUNIT_ASSERT_EQUAL(60,coords->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,coords->getNumberOfComponents());
- const double expected3_2[180]={
- 2.3,12.3,-0.7, 3.4,12.3,-0.7, 5.8,12.3,-0.7, 10.2,12.3,-0.7, 2.3,23.4,-0.7, 3.4,23.4,-0.7, 5.8,23.4,-0.7, 10.2,23.4,-0.7, 2.3,45.8,-0.7, 3.4,45.8,-0.7, 5.8,45.8,-0.7, 10.2,45.8,-0.7,
- 2.3,12.3,1.2, 3.4,12.3,1.2, 5.8,12.3,1.2, 10.2,12.3,1.2, 2.3,23.4,1.2, 3.4,23.4,1.2, 5.8,23.4,1.2, 10.2,23.4,1.2, 2.3,45.8,1.2, 3.4,45.8,1.2, 5.8,45.8,1.2, 10.2,45.8,1.2,
- 2.3,12.3,1.25, 3.4,12.3,1.25, 5.8,12.3,1.25, 10.2,12.3,1.25, 2.3,23.4,1.25, 3.4,23.4,1.25, 5.8,23.4,1.25, 10.2,23.4,1.25, 2.3,45.8,1.25, 3.4,45.8,1.25, 5.8,45.8,1.25, 10.2,45.8,1.25,
- 2.3,12.3,2.13, 3.4,12.3,2.13, 5.8,12.3,2.13, 10.2,12.3,2.13, 2.3,23.4,2.13, 3.4,23.4,2.13, 5.8,23.4,2.13, 10.2,23.4,2.13, 2.3,45.8,2.13, 3.4,45.8,2.13, 5.8,45.8,2.13, 10.2,45.8,2.13,
- 2.3,12.3,2.67, 3.4,12.3,2.67, 5.8,12.3,2.67, 10.2,12.3,2.67, 2.3,23.4,2.67, 3.4,23.4,2.67, 5.8,23.4,2.67, 10.2,23.4,2.67, 2.3,45.8,2.67, 3.4,45.8,2.67, 5.8,45.8,2.67, 10.2,45.8,2.67
- };
- for(int i=0;i<180;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3_2[i],coords->getIJ(0,i),1e-12);
- coords->decrRef();
- coords=m->getBarycenterAndOwner();
- CPPUNIT_ASSERT_EQUAL(24,coords->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,coords->getNumberOfComponents());
- const double expected3_3[72]={
- 2.85,17.85,0.25,4.6,17.85,0.25,8.,17.85,0.25, 2.85,34.6,0.25,4.6,34.6,0.25,8.,34.6,0.25,
- 2.85,17.85,1.225,4.6,17.85,1.225,8.,17.85,1.225, 2.85,34.6,1.225,4.6,34.6,1.225,8.,34.6,1.225,
- 2.85,17.85,1.69,4.6,17.85,1.69,8.,17.85,1.69, 2.85,34.6,1.69,4.6,34.6,1.69,8.,34.6,1.69,
- 2.85,17.85,2.4,4.6,17.85,2.4,8.,17.85,2.4, 2.85,34.6,2.4,4.6,34.6,2.4,8.,34.6,2.4
- };
- for(int i=0;i<72;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3_3[i],coords->getIJ(0,i),1e-12);
- coords->decrRef();
- //
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testFieldDoubleZipCoords1()
-{
- MEDCouplingUMesh *m=build2DTargetMeshMergeNode_1();
- MEDCouplingFieldDouble *f=m->fillFromAnalytic(ON_NODES,2,"x*2.");
- f->getArray()->setInfoOnComponent(0,"titi");
- f->getArray()->setInfoOnComponent(1,"tutu");
- f->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(18,f->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f->getNumberOfComponents());
- const double expected1[36]={-0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4};
- for(int i=0;i<36;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f->getIJ(0,i),1e-12);
- CPPUNIT_ASSERT(f->zipCoords());
- f->checkCoherency();
- const double expected2[30]={-0.6, -0.6, 1.4, 1.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4};
- for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(0,i),1e-12);
- CPPUNIT_ASSERT(!f->zipCoords());
- f->checkCoherency();
- for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(0,i),1e-12);
- CPPUNIT_ASSERT(std::string(f->getArray()->getInfoOnComponent(0))=="titi");
- CPPUNIT_ASSERT(std::string(f->getArray()->getInfoOnComponent(1))=="tutu");
- f->decrRef();
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testFieldDoubleZipConnectivity1()
-{
- MEDCouplingUMesh *m1=build2DTargetMesh_1();
- MEDCouplingUMesh *m2=build2DTargetMesh_1();
- const int cells1[3]={2,3,4};
- MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true);
- MEDCouplingUMesh *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
- CPPUNIT_ASSERT(m3);
- m2->decrRef();
- MEDCouplingUMesh *m4=build2DSourceMesh_1();
- MEDCouplingUMesh *m5=MEDCouplingUMesh::MergeUMeshes(m1,m3);
- m1->decrRef();
- m3->decrRef();
- MEDCouplingUMesh *m6=MEDCouplingUMesh::MergeUMeshes(m5,m4);
- m4->decrRef();
- m5->decrRef();
- //
- CPPUNIT_ASSERT_EQUAL(10,m6->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(22,m6->getNumberOfNodes());
- bool areNodesMerged;
- int newNbOfNodes;
- DataArrayInt *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL(9,m6->getNumberOfNodes());
- arr->decrRef();
- MEDCouplingFieldDouble *f=m6->fillFromAnalytic(ON_CELLS,2,"x");
- MEDCouplingFieldDouble *f2=m6->fillFromAnalytic(ON_NODES,2,"x");
- CPPUNIT_ASSERT_EQUAL(10,f->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f->getNumberOfComponents());
- const double expected1[20]={-0.05, -0.05, 0.3666666666666667, 0.3666666666666667, 0.53333333333333321, 0.53333333333333321,
- -0.05, -0.05, 0.45, 0.45, 0.53333333333333321, 0.53333333333333321, -0.05, -0.05, 0.45, 0.45,
- 0.36666666666666659, 0.36666666666666659, 0.033333333333333326, 0.033333333333333326};
- for(int i=0;i<20;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f->getIJ(0,i),1e-12);
- f->getArray()->setInfoOnComponent(0,"titi");
- f->getArray()->setInfoOnComponent(1,"tutu");
- f->checkCoherency();
- CPPUNIT_ASSERT(f->zipConnectivity(0));
- const double expected2[14]={-0.05, -0.05, 0.3666666666666667, 0.3666666666666667, 0.53333333333333321, 0.53333333333333321,
- -0.05, -0.05, 0.45, 0.45, 0.36666666666666659, 0.36666666666666659, 0.033333333333333326, 0.033333333333333326};
- CPPUNIT_ASSERT_EQUAL(7,f->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f->getNumberOfComponents());
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(0,i),1e-12);
- CPPUNIT_ASSERT(std::string(f->getArray()->getInfoOnComponent(0))=="titi");
- CPPUNIT_ASSERT(std::string(f->getArray()->getInfoOnComponent(1))=="tutu");
- CPPUNIT_ASSERT(!f->zipConnectivity(0));
- f->decrRef();
- //
- const double expected3[18]={-0.3, -0.3, 0.2, 0.2, 0.7, 0.7, -0.3, -0.3, 0.2, 0.2, 0.7, 0.7,
- -0.3, -0.3, 0.2, 0.2, 0.7, 0.7};
- CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
- for(int i=0;i<18;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],f2->getIJ(0,i),1e-12);
- CPPUNIT_ASSERT(f2->zipConnectivity(0));
- CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
- for(int i=0;i<18;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],f2->getIJ(0,i),1e-12);
- f2->decrRef();
- //
- m6->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDaDoubleRenumber1()
-{
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(7,2);
- a->setInfoOnComponent(0,"toto");
- a->setInfoOnComponent(1,"tata");
- const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
- std::copy(arr1,arr1+14,a->getPointer());
- //
- const int arr2[7]={3,1,0,6,5,4,2};
- DataArrayDouble *b=a->renumber(arr2);
- CPPUNIT_ASSERT_EQUAL(7,b->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
- const double expected1[14]={3.1, 13.1, 2.1, 12.1, 7.1, 17.1, 1.1, 11.1, 6.1, 16.1, 5.1, 15.1, 4.1, 14.1};
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
- b->decrRef();
- a->decrRef();
- //
- DataArrayInt *c=DataArrayInt::New();
- c->alloc(7,2);
- c->setInfoOnComponent(0,"toto");
- c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
- std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->renumber(arr2);
- CPPUNIT_ASSERT_EQUAL(7,d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14};
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
- c->decrRef();
- d->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDaDoubleRenumberAndReduce1()
-{
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(7,2);
- a->setInfoOnComponent(0,"toto");
- a->setInfoOnComponent(1,"tata");
- const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
- std::copy(arr1,arr1+14,a->getPointer());
- //
- const int arr2[7]={2,-1,1,-1,0,4,3};
- DataArrayDouble *b=a->renumberAndReduce(arr2,5);
- CPPUNIT_ASSERT_EQUAL(5,b->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
- const double expected1[10]={5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1};
- for(int i=0;i<10;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
- b->decrRef();
- a->decrRef();
- //
- DataArrayInt *c=DataArrayInt::New();
- c->alloc(7,2);
- c->setInfoOnComponent(0,"toto");
- c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
- std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->renumberAndReduce(arr2,5);
- CPPUNIT_ASSERT_EQUAL(5,d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[10]={5,15,3,13,1,11,7,17,6,16};
- for(int i=0;i<10;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
- c->decrRef();
- d->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDaDoubleRenumberInPlace1()
-{
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(7,2);
- const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
- std::copy(arr1,arr1+14,a->getPointer());
- //
- const int arr2[7]={3,1,0,6,5,4,2};
- a->renumberInPlace(arr2);
- CPPUNIT_ASSERT_EQUAL(7,a->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,a->getNumberOfComponents());
- const double expected1[14]={3.1, 13.1, 2.1, 12.1, 7.1, 17.1, 1.1, 11.1, 6.1, 16.1, 5.1, 15.1, 4.1, 14.1};
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a->getIJ(0,i),1e-14);
- a->decrRef();
- //
- DataArrayInt *c=DataArrayInt::New();
- c->alloc(7,2);
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
- std::copy(arr3,arr3+14,c->getPointer());
- c->renumberInPlace(arr2);
- CPPUNIT_ASSERT_EQUAL(7,c->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,c->getNumberOfComponents());
- const int expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14};
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],c->getIJ(0,i));
- c->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDaDoubleRenumberR1()
-{
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(7,2);
- a->setInfoOnComponent(0,"toto");
- a->setInfoOnComponent(1,"tata");
- const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
- std::copy(arr1,arr1+14,a->getPointer());
- //
- const int arr2[7]={3,1,0,6,5,4,2};
- DataArrayDouble *b=a->renumberR(arr2);
- CPPUNIT_ASSERT_EQUAL(7,b->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
- const double expected1[14]={4.1, 14.1, 2.1, 12.1, 1.1, 11.1, 7.1, 17.1, 6.1, 16.1, 5.1, 15.1, 3.1, 13.1};
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
- b->decrRef();
- a->decrRef();
- //
- DataArrayInt *c=DataArrayInt::New();
- c->alloc(7,2);
- c->setInfoOnComponent(0,"toto");
- c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
- std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->renumberR(arr2);
- CPPUNIT_ASSERT_EQUAL(7,d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13};
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
- c->decrRef();
- d->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDaDoubleRenumberInPlaceR1()
-{
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(7,2);
- const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
- std::copy(arr1,arr1+14,a->getPointer());
- //
- const int arr2[7]={3,1,0,6,5,4,2};
- a->renumberInPlaceR(arr2);
- CPPUNIT_ASSERT_EQUAL(7,a->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,a->getNumberOfComponents());
- const double expected1[14]={4.1, 14.1, 2.1, 12.1, 1.1, 11.1, 7.1, 17.1, 6.1, 16.1, 5.1, 15.1, 3.1, 13.1};
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a->getIJ(0,i),1e-14);
- a->decrRef();
- //
- DataArrayInt *c=DataArrayInt::New();
- c->alloc(7,2);
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
- std::copy(arr3,arr3+14,c->getPointer());
- c->renumberInPlaceR(arr2);
- CPPUNIT_ASSERT_EQUAL(7,c->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,c->getNumberOfComponents());
- const int expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13};
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],c->getIJ(0,i));
- c->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDaDoubleSelectByTupleId1()
-{
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(7,2);
- a->setInfoOnComponent(0,"toto");
- a->setInfoOnComponent(1,"tata");
- const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
- std::copy(arr1,arr1+14,a->getPointer());
- //
- const int arr2[7]={4,2,0,6,5};
- DataArrayDouble *b=a->selectByTupleId(arr2,arr2+5);
- CPPUNIT_ASSERT_EQUAL(5,b->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
- const double expected1[10]={5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1};
- for(int i=0;i<10;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
- b->decrRef();
- a->decrRef();
- //
- DataArrayInt *c=DataArrayInt::New();
- c->alloc(7,2);
- c->setInfoOnComponent(0,"toto");
- c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
- std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->selectByTupleId(arr2,arr2+5);
- CPPUNIT_ASSERT_EQUAL(5,d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[10]={5,15,3,13,1,11,7,17,6,16};
- for(int i=0;i<10;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
- c->decrRef();
- d->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDaDoubleGetMinMaxValues1()
-{
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(9,1);
- const double arr1[9]={2.34,4.56,-6.77,4.55,4.56,2.24,2.34,1.02,4.56};
- std::copy(arr1,arr1+9,a->getPointer());
- int where;
- double m=a->getMaxValue(where);
- CPPUNIT_ASSERT_EQUAL(1,where);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(4.56,m,1e-12);
- DataArrayInt *ws;
- m=a->getMaxValue2(ws);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(4.56,m,1e-12);
- CPPUNIT_ASSERT_EQUAL(3,ws->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,ws->getNumberOfComponents());
- const int expected1[3]={1,4,8};
- for(int i=0;i<3;i++)
- CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
- ws->decrRef();
- a->decrRef();
- a=DataArrayDouble::New();
- const double arr2[9]={-2.34,-4.56,6.77,-4.55,-4.56,-2.24,-2.34,-1.02,-4.56};
- a->alloc(9,1);
- std::copy(arr2,arr2+9,a->getPointer());
- where=-2;
- m=a->getMinValue(where);
- CPPUNIT_ASSERT_EQUAL(1,where);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(-4.56,m,1e-12);
- m=a->getMinValue2(ws);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(-4.56,m,1e-12);
- CPPUNIT_ASSERT_EQUAL(3,ws->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,ws->getNumberOfComponents());
- for(int i=0;i<3;i++)
- CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
- ws->decrRef();
- a->decrRef();
-}
-
-void MEDCouplingBasicsTest::testFieldDoubleGetMinMaxValues2()
-{
- MEDCouplingUMesh *m1=0;
- MEDCouplingUMesh *m2=build3DExtrudedUMesh_1(m1);
- m1->decrRef();
- CPPUNIT_ASSERT_EQUAL(18,m2->getNumberOfCells());
- const double arr1[18]={8.71,4.53,-12.41,8.71,-8.71,8.7099,4.55,8.71,5.55,6.77,-1e-200,4.55,8.7099,0.,1.23,0.,2.22,8.71};
- MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(18,1);
- std::copy(arr1,arr1+18,a->getPointer());
- f->setArray(a);
- a->decrRef();
- f->setMesh(m2);
- //
- f->checkCoherency();
- double m=f->getMaxValue();
- CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12);
- DataArrayInt *ws;
- m=f->getMaxValue2(ws);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12);
- CPPUNIT_ASSERT_EQUAL(4,ws->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,ws->getNumberOfComponents());
- const int expected1[4]={0,3,7,17};
- for(int i=0;i<4;i++)
- CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
- ws->decrRef();
- //
- const double arr2[18]={-8.71,-4.53,12.41,-8.71,8.71,-8.7099,-4.55,-8.71,-5.55,-6.77,1e-200,-4.55,-8.7099,0.,-1.23,0.,-2.22,-8.71};
- std::copy(arr2,arr2+18,a->getPointer());
- f->checkCoherency();
- m=f->getMinValue();
- CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.71,m,1e-12);
- m=f->getMinValue2(ws);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.71,m,1e-12);
- CPPUNIT_ASSERT_EQUAL(4,ws->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,ws->getNumberOfComponents());
- for(int i=0;i<4;i++)
- CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
- ws->decrRef();
- //
- f->decrRef();
- m2->decrRef();
-}
-
-void MEDCouplingBasicsTest::testBuildUnstructuredCMesh1()
-{
- MEDCouplingCMesh *m=MEDCouplingCMesh::New();
- DataArrayDouble *da=DataArrayDouble::New();
- const double discX[4]={2.3,3.4,5.8,10.2};
- const double discY[3]={12.3,23.4,45.8};
- const double discZ[5]={-0.7,1.2,1.25,2.13,2.67};
- da->alloc(4,1);
- std::copy(discX,discX+4,da->getPointer());
- m->setCoordsAt(0,da);
- da->decrRef();
- m->checkCoherency();
- double pos=2.4;
- CPPUNIT_ASSERT_EQUAL(0,m->getCellContainingPoint(&pos,1e-12));
- pos=3.7;
- CPPUNIT_ASSERT_EQUAL(1,m->getCellContainingPoint(&pos,1e-12));
- pos=5.9;
- CPPUNIT_ASSERT_EQUAL(2,m->getCellContainingPoint(&pos,1e-12));
- pos=10.3;
- CPPUNIT_ASSERT_EQUAL(-1,m->getCellContainingPoint(&pos,1e-12));
- pos=1.3;
- CPPUNIT_ASSERT_EQUAL(-1,m->getCellContainingPoint(&pos,1e-12));
- //
- MEDCouplingUMesh *m2=m->buildUnstructured();
- m2->checkCoherency();
- MEDCouplingFieldDouble *f1=m->getMeasureField(false);
- MEDCouplingFieldDouble *f2=m2->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),3);
- CPPUNIT_ASSERT_EQUAL(f2->getNumberOfTuples(),3);
- CPPUNIT_ASSERT_EQUAL(1,m2->getMeshDimension());
- CPPUNIT_ASSERT_EQUAL(1,m2->getSpaceDimension());
- for(int i=0;i<3;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(f1->getIJ(i,0),f2->getIJ(i,0),1e-10);
- da=DataArrayDouble::New();
- da->alloc(3,1);
- std::copy(discY,discY+3,da->getPointer());
- m->setCoordsAt(1,da);
- da->decrRef();
- m2->decrRef();
- f1->decrRef();
- f2->decrRef();
- //
- m2=m->buildUnstructured();
- m2->checkCoherency();
- f1=m->getMeasureField(false);
- f2=m2->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),6);
- CPPUNIT_ASSERT_EQUAL(f2->getNumberOfTuples(),6);
- CPPUNIT_ASSERT_EQUAL(2,m2->getMeshDimension());
- CPPUNIT_ASSERT_EQUAL(2,m2->getSpaceDimension());
- for(int i=0;i<6;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(f1->getIJ(i,0),f2->getIJ(i,0),1e-10);
- f1->decrRef();
- f2->decrRef();
- m2->decrRef();
- //
- da=DataArrayDouble::New();
- da->alloc(5,1);
- std::copy(discZ,discZ+5,da->getPointer());
- m->setCoordsAt(2,da);
- da->decrRef();
- m2=m->buildUnstructured();
- m2->checkCoherency();
- f1=m->getMeasureField(false);
- f2=m2->getMeasureField(false);
- CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),24);
- CPPUNIT_ASSERT_EQUAL(f2->getNumberOfTuples(),24);
- CPPUNIT_ASSERT_EQUAL(3,m2->getMeshDimension());
- CPPUNIT_ASSERT_EQUAL(3,m2->getSpaceDimension());
- for(int i=0;i<24;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(f1->getIJ(i,0),f2->getIJ(i,0),1e-10);
- f1->decrRef();
- f2->decrRef();
- //
- double pos1[3]={5.,30.,2.};
- CPPUNIT_ASSERT_EQUAL(16,m->getCellContainingPoint(pos1,1e-12));
- //
- const double pt[3]={2.4,12.7,-3.4};
- m->scale(pt,3.7);
- MEDCouplingUMesh *m3=m->buildUnstructured();
- m2->scale(pt,3.7);
- CPPUNIT_ASSERT(m3->isEqual(m2,1e-12));
- m2->decrRef();
- m3->decrRef();
- //
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDataArrayIntInvertO2NNO21()
-{
- const int arr1[6]={2,0,4,1,5,3};
- DataArrayInt *da=DataArrayInt::New();
- da->alloc(6,1);
- std::copy(arr1,arr1+6,da->getPointer());
- DataArrayInt *da2=da->invertArrayO2N2N2O(6);
- CPPUNIT_ASSERT_EQUAL(6,da2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
- const int expected1[6]={1,3,0,5,2,4};
- for(int i=0;i<6;i++)
- CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0));
- DataArrayInt *da3=da2->invertArrayN2O2O2N(6);
- for(int i=0;i<6;i++)
- CPPUNIT_ASSERT_EQUAL(arr1[i],da3->getIJ(i,0));
- da3->decrRef();
- da2->decrRef();
- da->decrRef();
- //
- const int arr2[10]={3,-1,5,4,-1,0,-1,1,2,-1};
- da=DataArrayInt::New();
- da->alloc(10,1);
- std::copy(arr2,arr2+10,da->getPointer());
- da2=da->invertArrayO2N2N2O(6);
- CPPUNIT_ASSERT_EQUAL(6,da2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
- const int expected2[10]={5,7,8,0,3,2};
- for(int i=0;i<6;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],da2->getIJ(i,0));
- da3=da2->invertArrayN2O2O2N(10);
- for(int i=0;i<10;i++)
- CPPUNIT_ASSERT_EQUAL(arr2[i],da3->getIJ(i,0));
- da3->decrRef();
- da2->decrRef();
- da->decrRef();
-}
-
-void MEDCouplingBasicsTest::testKeepSetSelectedComponent1()
-{
- const double arr1[20]={1.,2.,3.,4., 11.,12.,13.,14., 21.,22.,23.,24., 31.,32.,33.,34., 41.,42.,43.,44.};
- DataArrayDouble *a1=DataArrayDouble::New();
- a1->alloc(5,4);
- std::copy(arr1,arr1+20,a1->getPointer());
- a1->setInfoOnComponent(0,"aaaa");
- a1->setInfoOnComponent(1,"bbbb");
- a1->setInfoOnComponent(2,"cccc");
- a1->setInfoOnComponent(3,"dddd");
- const int arr2[6]={1,2,1,2,0,0};
- std::vector<int> arr2V(arr2,arr2+6);
- DataArrayDouble *a2=a1->keepSelectedComponents(arr2V);
- CPPUNIT_ASSERT_EQUAL(6,a2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,a2->getNumberOfTuples());
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(0))=="bbbb");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(1))=="cccc");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(2))=="bbbb");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(3))=="cccc");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(4))=="aaaa");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(5))=="aaaa");
- const double expected1[30]={2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.};
- for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a2->getIJ(0,i),1e-14);
- DataArrayInt *a3=a1->convertToIntArr();
- DataArrayInt *a4=a3->keepSelectedComponents(arr2V);
- CPPUNIT_ASSERT_EQUAL(6,a4->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,a4->getNumberOfTuples());
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(1))=="cccc");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(2))=="bbbb");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(3))=="cccc");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa");
- for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_EQUAL(int(expected1[i]),a4->getIJ(0,i));
- // setSelectedComponents
- const int arr3[2]={3,2};
- std::vector<int> arr3V(arr3,arr3+2);
- DataArrayDouble *a5=a1->keepSelectedComponents(arr3V);
- a5->setInfoOnComponent(0,"eeee");
- a5->setInfoOnComponent(1,"ffff");
- const int arr4[2]={1,2};
- std::vector<int> arr4V(arr4,arr4+2);
- a2->setSelectedComponents(a5,arr4V);
- CPPUNIT_ASSERT_EQUAL(6,a2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,a2->getNumberOfTuples());
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(0))=="bbbb");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(1))=="eeee");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(2))=="ffff");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(3))=="cccc");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(4))=="aaaa");
- CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(5))=="aaaa");
- const double expected2[30]={2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.};
- for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],a2->getIJ(0,i),1e-14);
- DataArrayInt *a6=a5->convertToIntArr();
- a6->setInfoOnComponent(0,"eeee");
- a6->setInfoOnComponent(1,"ffff");
- a4->setSelectedComponents(a6,arr4V);
- CPPUNIT_ASSERT_EQUAL(6,a4->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,a4->getNumberOfTuples());
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(1))=="eeee");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(2))=="ffff");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(3))=="cccc");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa");
- CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa");
- for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_EQUAL(int(expected2[i]),a4->getIJ(0,i));
- // test of throw
- const int arr5[3]={2,3,6};
- const int arr6[3]={2,7,5};
- const int arr7[4]={2,1,4,6};
- std::vector<int> arr5V(arr5,arr5+3);
- std::vector<int> arr6V(arr6,arr6+3);
- std::vector<int> arr7V(arr7,arr7+4);
- CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr5V),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr6V),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(a2->setSelectedComponents(a1,arr7V),INTERP_KERNEL::Exception);
- arr7V.resize(3);
- CPPUNIT_ASSERT_THROW(a2->setSelectedComponents(a1,arr7V),INTERP_KERNEL::Exception);
- //
- a6->decrRef();
- a5->decrRef();
- a4->decrRef();
- a3->decrRef();
- a2->decrRef();
- a1->decrRef();
-}
-
-void MEDCouplingBasicsTest::testKeepSetSelectedComponent2()
-{
- MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const double arr1[20]={1.,2.,3.,4., 11.,12.,13.,14., 21.,22.,23.,24., 31.,32.,33.,34., 41.,42.,43.,44.};
- DataArrayDouble *a1=DataArrayDouble::New();
- a1->alloc(5,4);
- std::copy(arr1,arr1+20,a1->getPointer());
- a1->setInfoOnComponent(0,"aaaa");
- a1->setInfoOnComponent(1,"bbbb");
- a1->setInfoOnComponent(2,"cccc");
- a1->setInfoOnComponent(3,"dddd");
- MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- f1->setTime(2.3,4,5);
- f1->setMesh(m1);
- f1->setName("f1");
- f1->setArray(a1);
- f1->checkCoherency();
- //
- const int arr2[6]={1,2,1,2,0,0};
- std::vector<int> arr2V(arr2,arr2+6);
- MEDCouplingFieldDouble *f2=f1->keepSelectedComponents(arr2V);
- CPPUNIT_ASSERT(f2->getMesh()==f1->getMesh());
- CPPUNIT_ASSERT(f2->getTimeDiscretization()==ONE_TIME);
- int dt,it;
- CPPUNIT_ASSERT_DOUBLES_EQUAL(2.3,f2->getTime(dt,it),1e-13);
- CPPUNIT_ASSERT_EQUAL(4,dt);
- CPPUNIT_ASSERT_EQUAL(5,it);
- f2->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(0))=="bbbb");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(1))=="cccc");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(2))=="bbbb");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(3))=="cccc");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(4))=="aaaa");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(5))=="aaaa");
- const double expected1[30]={2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.};
- for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f2->getIJ(0,i),1e-14);
- //setSelectedComponents
- const int arr3[2]={3,2};
- std::vector<int> arr3V(arr3,arr3+2);
- MEDCouplingFieldDouble *f5=f1->keepSelectedComponents(arr3V);
- f5->setTime(6.7,8,9);
- f5->getArray()->setInfoOnComponent(0,"eeee");
- f5->getArray()->setInfoOnComponent(1,"ffff");
- f5->checkCoherency();
- const int arr4[2]={1,2};
- std::vector<int> arr4V(arr4,arr4+2);
- f2->setSelectedComponents(f5,arr4V);
- CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
- f2->checkCoherency();
- CPPUNIT_ASSERT_DOUBLES_EQUAL(2.3,f2->getTime(dt,it),1e-13);
- CPPUNIT_ASSERT_EQUAL(4,dt);
- CPPUNIT_ASSERT_EQUAL(5,it);
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(0))=="bbbb");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(1))=="eeee");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(2))=="ffff");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(3))=="cccc");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(4))=="aaaa");
- CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(5))=="aaaa");
- const double expected2[30]={2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.};
- for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f2->getIJ(0,i),1e-14);
- f5->decrRef();
- f1->decrRef();
- f2->decrRef();
- a1->decrRef();
- m1->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIGetIdsEqual1()
-{
- const int tab1[7]={5,-2,-4,-2,3,2,-2};
- DataArrayInt *da=DataArrayInt::New();
- da->alloc(7,1);
- std::copy(tab1,tab1+7,da->getPointer());
- DataArrayInt *da2=da->getIdsEqual(-2);
- CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
- const int expected1[3]={1,3,6};
- CPPUNIT_ASSERT(std::equal(expected1,expected1+3,da2->getConstPointer()));
- da2->decrRef();
- da->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIGetIdsEqualList1()
-{
- const int tab1[7]={5,-2,-4,-2,3,2,-2};
- DataArrayInt *da=DataArrayInt::New();
- da->alloc(7,1);
- std::copy(tab1,tab1+7,da->getPointer());
- const int tab2[3]={3,-2,0};
- std::vector<int> tab2V(tab2,tab2+3);
- DataArrayInt *da2=da->getIdsEqualList(tab2V);
- CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
- const int expected1[4]={1,3,4,6};
- CPPUNIT_ASSERT(std::equal(expected1,expected1+4,da2->getConstPointer()));
- da2->decrRef();
- da->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAFromNoInterlace1()
-{
- const int tab1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43};
- DataArrayInt *da=DataArrayInt::New();
- da->alloc(5,3);
- std::copy(tab1,tab1+15,da->getPointer());
- DataArrayInt *da2=da->fromNoInterlace();
- const int expected1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43};
- CPPUNIT_ASSERT_EQUAL(5,da2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
- CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer()));
- DataArrayDouble *da3=da->convertToDblArr();
- DataArrayDouble *da4=da3->fromNoInterlace();
- CPPUNIT_ASSERT_EQUAL(5,da4->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,da4->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
- for(int i=0;i<15;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL((double)expected1[i],da4->getIJ(0,i),1e-14);
- da4->decrRef();
- da3->decrRef();
- da2->decrRef();
- da->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAToNoInterlace1()
-{
- const int tab1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43};
- DataArrayInt *da=DataArrayInt::New();
- da->alloc(5,3);
- std::copy(tab1,tab1+15,da->getPointer());
- DataArrayInt *da2=da->toNoInterlace();
- const int expected1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43};
- CPPUNIT_ASSERT_EQUAL(5,da2->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
- CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer()));
- DataArrayDouble *da3=da->convertToDblArr();
- DataArrayDouble *da4=da3->toNoInterlace();
- CPPUNIT_ASSERT_EQUAL(5,da4->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,da4->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
- for(int i=0;i<15;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL((double)expected1[i],da4->getIJ(0,i),1e-14);
- da4->decrRef();
- da3->decrRef();
- da2->decrRef();
- da->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIsUniform1()
-{
- const int tab1[5]={1,1,1,1,1};
- DataArrayInt *da=DataArrayInt::New();
- da->alloc(5,1);
- std::copy(tab1,tab1+5,da->getPointer());
- CPPUNIT_ASSERT(da->isUniform(1));
- da->setIJ(2,0,2);
- CPPUNIT_ASSERT(!da->isUniform(1));
- da->setIJ(2,0,1);
- CPPUNIT_ASSERT(da->isUniform(1));
- DataArrayDouble *da2=da->convertToDblArr();
- CPPUNIT_ASSERT(da2->isUniform(1.,1e-12));
- da2->setIJ(1,0,1.+1.e-13);
- CPPUNIT_ASSERT(da2->isUniform(1.,1e-12));
- da2->setIJ(1,0,1.+1.e-11);
- CPPUNIT_ASSERT(!da2->isUniform(1.,1e-12));
- da2->decrRef();
- da->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDADFromPolarToCart1()
-{
- const double tab1[4]={2.,0.2,2.5,0.7};
- DataArrayDouble *da=DataArrayDouble::New();
- da->alloc(2,2);
- std::copy(tab1,tab1+4,da->getPointer());
- DataArrayDouble *da2=da->fromPolarToCart();
- const double expected1[4]={1.9601331556824833,0.39733866159012243, 1.9121054682112213,1.6105442180942275};
- for(int i=0;i<4;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da2->getIJ(0,i),1e-13);
- da2->decrRef();
- da->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDADFromCylToCart1()
-{
- const double tab1[6]={2.,0.2,4.,2.5,0.7,9.};
- DataArrayDouble *da=DataArrayDouble::New();
- da->alloc(2,3);
- std::copy(tab1,tab1+6,da->getPointer());
- DataArrayDouble *da2=da->fromCylToCart();
- const double expected1[6]={1.9601331556824833,0.39733866159012243,4., 1.9121054682112213,1.6105442180942275,9.};
- for(int i=0;i<6;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da2->getIJ(0,i),1e-13);
- da2->decrRef();
- da->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDADFromSpherToCart1()
-{
- const double tab1[6]={2.,0.2,0.3,2.5,0.7,0.8};
- DataArrayDouble *da=DataArrayDouble::New();
- da->alloc(2,3);
- std::copy(tab1,tab1+6,da->getPointer());
- DataArrayDouble *da2=da->fromSpherToCart();
- const double expected1[6]={0.37959212195737485,0.11742160338765303,1.9601331556824833, 1.1220769624465328,1.1553337045129035,1.9121054682112213};
- for(int i=0;i<6;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da2->getIJ(0,i),1e-13);
- da2->decrRef();
- da->decrRef();
-}
-
-void MEDCouplingBasicsTest::testUnPolyze1()
-{
- const int elts[8]={0,1,2,3,4,5,6,7};
- std::vector<int> eltsV(elts,elts+8);
- MEDCouplingUMesh *mesh=build3DTargetMesh_1();
- mesh->convertToPolyTypes(eltsV);
- mesh->unPolyze();
- MEDCouplingUMesh *mesh2=build3DTargetMesh_1();
- mesh->checkCoherency();
- CPPUNIT_ASSERT(mesh->isEqual(mesh2,1e-12));
- mesh->convertToPolyTypes(eltsV);
- CPPUNIT_ASSERT(!mesh->isEqual(mesh2,1e-12));
- mesh->getNodalConnectivity()->setIJ(0,6,10);
- mesh->getNodalConnectivity()->setIJ(0,7,9);
- mesh->getNodalConnectivity()->setIJ(0,8,12);
- mesh->getNodalConnectivity()->setIJ(0,9,13);
- mesh->unPolyze();
- CPPUNIT_ASSERT(mesh->isEqual(mesh2,1e-12));
- mesh->convertToPolyTypes(eltsV);
- mesh->getNodalConnectivity()->setIJ(0,6,12);
- mesh->getNodalConnectivity()->setIJ(0,7,13);
- mesh->getNodalConnectivity()->setIJ(0,8,10);
- mesh->getNodalConnectivity()->setIJ(0,9,9);
- mesh->unPolyze();
- CPPUNIT_ASSERT(mesh->isEqual(mesh2,1e-12));
- mesh->convertToPolyTypes(eltsV);
- mesh->getNodalConnectivity()->setIJ(0,6,12);
- mesh->getNodalConnectivity()->setIJ(0,7,10);
- mesh->getNodalConnectivity()->setIJ(0,8,13);
- mesh->getNodalConnectivity()->setIJ(0,9,9);
- mesh->unPolyze();
- CPPUNIT_ASSERT(!mesh->isEqual(mesh2,1e-12));
- mesh->decrRef();
- mesh2->decrRef();
- // Test for 2D mesh
- mesh=build2DTargetMesh_1();
- mesh2=build2DTargetMesh_1();
- eltsV.resize(5);
- mesh->convertToPolyTypes(eltsV);
- CPPUNIT_ASSERT(!mesh->isEqual(mesh2,1e-12));
- mesh->unPolyze();
- CPPUNIT_ASSERT(mesh->isEqual(mesh2,1e-12));
- mesh->decrRef();
- mesh2->decrRef();
-}
-
-void MEDCouplingBasicsTest::testConvertDegeneratedCells1()
-{
- MEDCouplingUMesh *mesh=build3DTargetMesh_1();
- int conn[32]={0,1,3,3,9,10,12,12, 0,1,3,4,9,9,9,9, 1,1,1,1,10,12,9,10, 10,11,12,9,1,1,1,1};
- mesh->allocateCells(4);
- mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn);
- mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+8);
- mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+16);
- mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+24);
- mesh->finishInsertingCells();
- mesh->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(4,mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(0));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(1));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(2));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(3));
- MEDCouplingFieldDouble *f1=mesh->getMeasureField(true);
- mesh->convertDegeneratedCells();
- mesh->checkCoherency();
- MEDCouplingFieldDouble *f2=mesh->getMeasureField(true);
- CPPUNIT_ASSERT_EQUAL(4,mesh->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_PENTA6,mesh->getTypeOfCell(0));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_PYRA5,mesh->getTypeOfCell(1));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TETRA4,mesh->getTypeOfCell(2));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_PYRA5,mesh->getTypeOfCell(3));
- for(int i=0;i<4;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(f1->getArray()->getIJ(0,i),f2->getArray()->getIJ(0,i),1e-5);
- f1->decrRef();
- f2->decrRef();
- mesh->decrRef();
-}
-
-void MEDCouplingBasicsTest::testGetNodeIdsNearPoints1()
-{
- MEDCouplingUMesh *mesh=build2DTargetMesh_1();
- DataArrayDouble *coords=mesh->getCoords();
- DataArrayDouble *tmp=DataArrayDouble::New();
- tmp->alloc(3,2);
- const double vals[6]={0.2,0.2,0.1,0.2,0.2,0.2};
- std::copy(vals,vals+6,tmp->getPointer());
- DataArrayDouble *tmp2=DataArrayDouble::Aggregate(coords,tmp);
- tmp->decrRef();
- mesh->setCoords(tmp2);
- tmp2->decrRef();
- const double pts[6]={0.2,0.2,0.1,0.3,-0.3,0.7};
- std::vector<int> c=mesh->getNodeIdsNearPoint(pts,1e-7);
- CPPUNIT_ASSERT_EQUAL(3,(int)c.size());
- CPPUNIT_ASSERT_EQUAL(4,c[0]);
- CPPUNIT_ASSERT_EQUAL(9,c[1]);
- CPPUNIT_ASSERT_EQUAL(11,c[2]);
- c.clear();
- std::vector<int> cI;
- mesh->getNodeIdsNearPoints(pts,3,1e-7,c,cI);
- CPPUNIT_ASSERT_EQUAL(4,(int)cI.size());
- CPPUNIT_ASSERT_EQUAL(4,(int)c.size());
- CPPUNIT_ASSERT_EQUAL(4,c[0]);
- CPPUNIT_ASSERT_EQUAL(9,c[1]);
- CPPUNIT_ASSERT_EQUAL(11,c[2]);
- CPPUNIT_ASSERT_EQUAL(6,c[3]);
- CPPUNIT_ASSERT_EQUAL(0,cI[0]);
- CPPUNIT_ASSERT_EQUAL(3,cI[1]);
- CPPUNIT_ASSERT_EQUAL(3,cI[2]);
- CPPUNIT_ASSERT_EQUAL(4,cI[3]);
- mesh->decrRef();
-}
-
-void MEDCouplingBasicsTest::testFieldCopyTinyAttrFrom1()
-{
- MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- f1->setName("f1");
- f1->setTimeTolerance(1.e-5);
- f1->setDescription("f1Desc");
- f1->setTime(1.23,4,5);
- MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- f2->setName("f2");
- f2->setDescription("f2Desc");
- f2->setTime(6.78,9,10);
- f2->setTimeTolerance(4.556e-12);
- //
- int dt,it;
- f1->copyTinyAttrFrom(f2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(4.556e-12,f1->getTimeTolerance(),1e-24);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(6.78,f1->getTime(dt,it),1e-12);
- CPPUNIT_ASSERT_EQUAL(9,dt);
- CPPUNIT_ASSERT_EQUAL(10,it);
- CPPUNIT_ASSERT(std::string(f1->getName())=="f1");//name unchanged
- CPPUNIT_ASSERT(std::string(f1->getDescription())=="f1Desc");//description unchanged
- f1->decrRef();
- f2->decrRef();
- //
- f1=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
- f1->setName("f1");
- f1->setTimeTolerance(1.e-5);
- f1->setDescription("f1Desc");
- f2=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
- f2->setName("f2");
- f2->setDescription("f2Desc");
- f2->setTimeTolerance(4.556e-12);
- //
- f1->copyTinyAttrFrom(f2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(4.556e-12,f1->getTimeTolerance(),1e-24);
- CPPUNIT_ASSERT(std::string(f1->getName())=="f1");//name unchanged
- CPPUNIT_ASSERT(std::string(f1->getDescription())=="f1Desc");//description unchanged
- f1->decrRef();
- f2->decrRef();
- //
- f1=MEDCouplingFieldDouble::New(ON_CELLS,CONST_ON_TIME_INTERVAL);
- f1->setName("f1");
- f1->setTimeTolerance(1.e-5);
- f1->setDescription("f1Desc");
- f1->setTime(1.23,4,5);
- f1->setEndTime(5.43,2,1);
- f2=MEDCouplingFieldDouble::New(ON_CELLS,CONST_ON_TIME_INTERVAL);
- f2->setName("f2");
- f2->setDescription("f2Desc");
- f2->setTimeTolerance(4.556e-12);
- f2->setTime(6.78,9,10);
- f2->setEndTime(10.98,7,6);
- //
- f1->copyTinyAttrFrom(f2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(4.556e-12,f1->getTimeTolerance(),1e-24);
- CPPUNIT_ASSERT(std::string(f1->getName())=="f1");//name unchanged
- CPPUNIT_ASSERT(std::string(f1->getDescription())=="f1Desc");//description unchanged
- CPPUNIT_ASSERT_DOUBLES_EQUAL(6.78,f1->getTime(dt,it),1e-12);
- CPPUNIT_ASSERT_EQUAL(9,dt);
- CPPUNIT_ASSERT_EQUAL(10,it);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(10.98,f1->getEndTime(dt,it),1e-12);
- CPPUNIT_ASSERT_EQUAL(7,dt);
- CPPUNIT_ASSERT_EQUAL(6,it);
- f1->decrRef();
- f2->decrRef();
- //
- f1=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
- f1->setName("f1");
- f1->setTimeTolerance(1.e-5);
- f1->setDescription("f1Desc");
- f1->setTime(1.23,4,5);
- f1->setEndTime(5.43,2,1);
- f2=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
- f2->setName("f2");
- f2->setDescription("f2Desc");
- f2->setTimeTolerance(4.556e-12);
- f2->setTime(6.78,9,10);
- f2->setEndTime(10.98,7,6);
- //
- f1->copyTinyAttrFrom(f2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(4.556e-12,f1->getTimeTolerance(),1e-24);
- CPPUNIT_ASSERT(std::string(f1->getName())=="f1");//name unchanged
- CPPUNIT_ASSERT(std::string(f1->getDescription())=="f1Desc");//description unchanged
- CPPUNIT_ASSERT_DOUBLES_EQUAL(6.78,f1->getTime(dt,it),1e-12);
- CPPUNIT_ASSERT_EQUAL(9,dt);
- CPPUNIT_ASSERT_EQUAL(10,it);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(10.98,f1->getEndTime(dt,it),1e-12);
- CPPUNIT_ASSERT_EQUAL(7,dt);
- CPPUNIT_ASSERT_EQUAL(6,it);
- f1->decrRef();
- f2->decrRef();
-}
-
-/*!
- * 1D -> 2D extrusion with rotation
- */
-void MEDCouplingBasicsTest::testExtrudedMesh5()
-{
- const double coo1[4]={0.,1.,2.,3.5};
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(4,1);
- std::copy(coo1,coo1+4,a->getPointer());
- MEDCouplingCMesh *b=MEDCouplingCMesh::New();
- b->setCoordsAt(0,a);
- MEDCouplingUMesh *c=b->buildUnstructured();
- CPPUNIT_ASSERT_EQUAL(1,c->getSpaceDimension());
- c->changeSpaceDimension(2);
- //
- DataArrayDouble *d=DataArrayDouble::New();
- d->alloc(13,1);
- d->iota();
- MEDCouplingCMesh *e=MEDCouplingCMesh::New();
- e->setCoordsAt(0,d);
- MEDCouplingUMesh *f=e->buildUnstructured();
- DataArrayDouble *g=f->getCoords()->applyFunc(2,"3.5*IVec+x/6*3.14159265359*JVec");
- DataArrayDouble *h=g->fromPolarToCart();
- f->setCoords(h);
- MEDCouplingUMesh *i=c->buildExtrudedMesh(f,1);
- CPPUNIT_ASSERT_EQUAL(52,i->getNumberOfNodes());
- bool tmp2;
- int tmp3;
- DataArrayInt *tmp=i->mergeNodes(1e-9,tmp2,tmp3);
- CPPUNIT_ASSERT(tmp2);
- CPPUNIT_ASSERT_EQUAL(37,tmp3);
- tmp->decrRef();
- i->convertDegeneratedCells();
- i->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(36,i->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(37,i->getNumberOfNodes());
- CPPUNIT_ASSERT_EQUAL(12,i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI3));
- CPPUNIT_ASSERT_EQUAL(24,i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4));
- const double expected1[3]={0.25,0.75,2.0625};
- MEDCouplingFieldDouble *j=i->getMeasureField(true);
- for(int i=0;i<12;i++)
- for(int k=0;k<3;k++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[k],j->getIJ(0,i*3+k),1e-10);
- const double expected2[72]={0.62200846792814113, 0.16666666666681595, 1.4513530918323276, 0.38888888888923495, 2.6293994326053212, 0.7045454545460802, 0.45534180126145435, 0.45534180126150181, 1.0624642029433926, 1.0624642029435025, 1.9248539780597826, 1.9248539780599816, 0.16666666666661334, 0.62200846792815856, 0.38888888888876294, 1.4513530918323678, 0.70454545454522521, 2.629399432605394, -0.16666666666674007, 0.62200846792812436, -0.38888888888906142, 1.4513530918322881, -0.70454545454576778, 2.6293994326052488, -0.45534180126154766, 0.45534180126140844, -1.0624642029436118, 1.0624642029432834, -1.9248539780601803, 1.9248539780595841, -0.62200846792817499, 0.1666666666665495, -1.451353091832408, 0.388888888888613, -2.6293994326054668, 0.70454545454495332, -0.62200846792810593, -0.16666666666680507, -1.451353091832247, -0.38888888888921297, -2.6293994326051746, -0.70454545454604123, -0.45534180126135926, -0.45534180126159562, -1.0624642029431723, -1.0624642029437235, -1.9248539780593836, -1.9248539780603811, -0.1666666666664828, -0.62200846792819242, -0.38888888888846079, -1.4513530918324489, -0.70454545454467987, -2.6293994326055397, 0.16666666666687083, -0.62200846792808862, 0.38888888888936374, -1.4513530918322073, 0.70454545454631357, -2.6293994326051022, 0.45534180126164348, -0.45534180126131207, 1.0624642029438327, -1.0624642029430627, 1.9248539780605791, -1.9248539780591853, 0.62200846792821063, -0.16666666666641802, 1.4513530918324888, -0.38888888888831086, 2.6293994326056125, -0.70454545454440853};
- DataArrayDouble *m=i->getBarycenterAndOwner();
- for(int i=0;i<72;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m->getIJ(0,i),1e-10);
- //
- m->decrRef();
- j->decrRef();
- i->decrRef();
- h->decrRef();
- g->decrRef();
- f->decrRef();
- e->decrRef();
- d->decrRef();
- c->decrRef();
- b->decrRef();
- a->decrRef();
-}
-
-/*!
- * 1D -> 2D extrusion without rotation
- */
-void MEDCouplingBasicsTest::testExtrudedMesh6()
-{
- const double coo1[4]={0.,1.,2.,3.5};
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(4,1);
- std::copy(coo1,coo1+4,a->getPointer());
- MEDCouplingCMesh *b=MEDCouplingCMesh::New();
- b->setCoordsAt(0,a);
- MEDCouplingUMesh *c=b->buildUnstructured();
- CPPUNIT_ASSERT_EQUAL(1,c->getSpaceDimension());
- c->changeSpaceDimension(2);
- //
- DataArrayDouble *d=DataArrayDouble::New();
- d->alloc(5,1);
- d->iota();
- MEDCouplingCMesh *e=MEDCouplingCMesh::New();
- e->setCoordsAt(0,d);
- MEDCouplingUMesh *f=e->buildUnstructured();
- DataArrayDouble *d2=f->getCoords()->applyFunc("x*x/2");
- f->setCoords(d2);
- f->changeSpaceDimension(2);
- //
- const double center[2]={0.,0.};
- f->rotate(center,0,M_PI/3);
- MEDCouplingUMesh *g=c->buildExtrudedMesh(f,0);
- g->checkCoherency();
- const double expected1[]={ 0.4330127018922193, 0.4330127018922193, 0.649519052838329, 1.2990381056766578, 1.299038105676658, 1.948557158514987, 2.1650635094610955, 2.1650635094610964, 3.2475952641916446, 3.031088913245533, 3.0310889132455352, 4.546633369868303 };
- MEDCouplingFieldDouble *f1=g->getMeasureField(true);
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-12);
-
- const double expected2[]={0.625, 0.21650635094610962, 1.625, 0.21650635094610959, 2.8750000000000004, 0.21650635094610965, 1.1250000000000002, 1.0825317547305482, 2.125, 1.0825317547305482, 3.3750000000000004, 1.0825317547305484, 2.125, 2.8145825622994254, 3.125, 2.8145825622994254, 4.375, 2.8145825622994254, 3.6250000000000009, 5.4126587736527414, 4.625, 5.4126587736527414, 5.875, 5.4126587736527414};
- DataArrayDouble *f2=g->getBarycenterAndOwner();
- for(int i=0;i<24;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f2->getIJ(0,i),1e-12);
- //
- f1->decrRef();
- f2->decrRef();
- g->decrRef();
- f->decrRef();
- e->decrRef();
- d->decrRef();
- d2->decrRef();
- c->decrRef();
- b->decrRef();
- a->decrRef();
-}
-
-/*!
- * 2D -> 3D extrusion with rotation
- */
-void MEDCouplingBasicsTest::testExtrudedMesh7()
-{
- const double coo1[4]={0.,1.,2.,3.5};
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(4,1);
- std::copy(coo1,coo1+4,a->getPointer());
- MEDCouplingCMesh *b=MEDCouplingCMesh::New();
- b->setCoordsAt(0,a);
- MEDCouplingUMesh *c=b->buildUnstructured();
- CPPUNIT_ASSERT_EQUAL(1,c->getSpaceDimension());
- c->changeSpaceDimension(2);
- //
- DataArrayDouble *d=DataArrayDouble::New();
- d->alloc(13,1);
- d->iota();
- MEDCouplingCMesh *e=MEDCouplingCMesh::New();
- e->setCoordsAt(0,d);
- MEDCouplingUMesh *f=e->buildUnstructured();
- DataArrayDouble *g=f->getCoords()->applyFunc(2,"3.5*IVec+x/6*3.14159265359*JVec");
- DataArrayDouble *h=g->fromPolarToCart();
- f->setCoords(h);
- MEDCouplingUMesh *i=c->buildExtrudedMesh(f,1);
- CPPUNIT_ASSERT_EQUAL(52,i->getNumberOfNodes());
- bool tmp2;
- int tmp3;
- DataArrayInt *tmp=i->mergeNodes(1e-9,tmp2,tmp3);
- CPPUNIT_ASSERT(tmp2);
- CPPUNIT_ASSERT_EQUAL(37,tmp3);
- tmp->decrRef();
- i->convertDegeneratedCells();
- const double vec1[3]={10.,0.,0.};
- i->translate(vec1);
- DataArrayDouble *g2=h->applyFunc(3,"13.5/3.5*x*IVec+0*JVec+13.5/3.5*y*KVec");
- f->setCoords(g2);
- i->changeSpaceDimension(3);
- MEDCouplingUMesh *i3=i->buildExtrudedMesh(f,1);
- MEDCouplingFieldDouble *f2=i3->getMeasureField(true);
- tmp=i->mergeNodes(1e-9,tmp2,tmp3);
- CPPUNIT_ASSERT(tmp2);
- CPPUNIT_ASSERT_EQUAL(444,tmp3);
- tmp->decrRef();
- const double expected1[36]={1.327751058489274, 4.2942574094314701, 13.024068164857139, 1.3069177251569044, 4.1484240761012954, 12.297505664866796, 1.270833333332571, 3.8958333333309674, 11.039062499993179, 1.2291666666659207, 3.6041666666644425, 9.585937499993932, 1.1930822748415895, 3.3515759238941376, 8.3274943351204556, 1.1722489415082769, 3.2057425905609289, 7.6009318351210622, 1.1722489415082862, 3.2057425905609884, 7.6009318351213713, 1.1930822748416161, 3.3515759238943001, 8.3274943351212727, 1.2291666666659564, 3.6041666666646734, 9.5859374999950777, 1.2708333333326081, 3.8958333333311868, 11.039062499994293, 1.3069177251569224, 4.1484240761014384, 12.297505664867627, 1.3277510584902354, 4.2942574094346071, 13.024068164866796};
- int kk=0;
- for(int ii=0;ii<12;ii++)
- for(int jj=0;jj<36;jj++,kk++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[jj],f2->getIJ(0,kk),1e-9);
- //
- f2->decrRef();
- i3->decrRef();
- g2->decrRef();
- i->decrRef();
- h->decrRef();
- g->decrRef();
- f->decrRef();
- e->decrRef();
- d->decrRef();
- c->decrRef();
- b->decrRef();
- a->decrRef();
-}
-
-void MEDCouplingBasicsTest::testSimplexize1()
-{
- MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- std::vector<int> v(1);
- v[0]=3;
- m->convertToPolyTypes(v);
- DataArrayInt *da=m->simplexize(0);
- CPPUNIT_ASSERT_EQUAL(7,da->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfComponents());
- const int expected2[7]={0,0,1,2,3,4,4};
- for(int i=0;i<7;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],da->getIJ(i,0));
- m->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(7,m->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(0));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(1));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(2));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(3));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,m->getTypeOfCell(4));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(5));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(6));
- const double expected1[7]={0.125,0.125,0.125,0.125,0.25,0.125,0.125};
- MEDCouplingFieldDouble *f=m->getMeasureField(false);
- for(int i=0;i<7;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i]*sqrt(2.),f->getIJ(i,0),1e-10);
- std::set<INTERP_KERNEL::NormalizedCellType> types=m->getAllTypes();
- CPPUNIT_ASSERT_EQUAL(2,(int)types.size());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*(types.begin()));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,*(++(types.begin())));
- f->decrRef();
- da->decrRef();
- m->decrRef();
- //
- m=build3DSurfTargetMesh_1();
- v[0]=3;
- m->convertToPolyTypes(v);
- da=m->simplexize(1);
- CPPUNIT_ASSERT_EQUAL(7,da->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfComponents());
- for(int i=0;i<7;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],da->getIJ(i,0));
- m->checkCoherency();
- types=m->getAllTypes();
- CPPUNIT_ASSERT_EQUAL(2,(int)types.size());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*(types.begin()));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,*(++(types.begin())));
- CPPUNIT_ASSERT_EQUAL(7,m->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(0));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(1));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(2));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(3));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,m->getTypeOfCell(4));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(5));
- CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(6));
- f=m->getMeasureField(false);
- for(int i=0;i<7;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i]*sqrt(2.),f->getIJ(i,0),1e-10);
- f->decrRef();
- da->decrRef();
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testSimplexize2()
-{
- MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- std::vector<int> v(1);
- v[0]=3;
- m->convertToPolyTypes(v);
- MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- f1->setMesh(m);
- DataArrayDouble *arr=DataArrayDouble::New();
- const double arr1[10]={10.,110.,20.,120.,30.,130.,40.,140.,50.,150.};
- arr->alloc(5,2);
- std::copy(arr1,arr1+10,arr->getPointer());
- f1->setArray(arr);
- arr->decrRef();
- //
- f1->checkCoherency();
- CPPUNIT_ASSERT(f1->simplexize(0));
- f1->checkCoherency();
- const double expected1[14]={10.,110.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.,50.,150.};
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-10);
- CPPUNIT_ASSERT(!f1->simplexize(0));
- for(int i=0;i<14;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-10);
- //
- f1->decrRef();
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAMeld1()
-{
- DataArrayDouble *da1=DataArrayDouble::New();
- da1->alloc(7,2);
- DataArrayDouble *da2=DataArrayDouble::New();
- da2->alloc(7,1);
- //
- da1->fillWithValue(7.);
- da2->iota(0.);
- DataArrayDouble *da3=da2->applyFunc(3,"10*x*IVec+100*x*JVec+1000*x*KVec");
- //
- da1->setInfoOnComponent(0,"c0da1");
- da1->setInfoOnComponent(1,"c1da1");
- da3->setInfoOnComponent(0,"c0da3");
- da3->setInfoOnComponent(1,"c1da3");
- da3->setInfoOnComponent(2,"c2da3");
- //
- DataArrayDouble *da1C=da1->deepCpy();
- da1->meldWith(da3);
- CPPUNIT_ASSERT_EQUAL(5,da1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(7,da1->getNumberOfTuples());
- CPPUNIT_ASSERT(da1->getInfoOnComponent(0)=="c0da1");
- CPPUNIT_ASSERT(da1->getInfoOnComponent(1)=="c1da1");
- CPPUNIT_ASSERT(da1->getInfoOnComponent(2)=="c0da3");
- CPPUNIT_ASSERT(da1->getInfoOnComponent(3)=="c1da3");
- CPPUNIT_ASSERT(da1->getInfoOnComponent(4)=="c2da3");
- //
- const double expected1[35]={7.,7.,0.,0.,0., 7.,7.,10.,100.,1000., 7.,7.,20.,200.,2000., 7.,7.,30.,300.,3000., 7.,7.,40.,400.,4000.,7.,7.,50.,500.,5000.,7.,7.,60.,600.,6000.};
- for(int i=0;i<35;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da1->getIJ(0,i),1e-10);
- //
- DataArrayInt *dai1=da1C->convertToIntArr();
- DataArrayInt *dai3=da3->convertToIntArr();
- dai1->meldWith(dai3);
- CPPUNIT_ASSERT_EQUAL(5,dai1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(7,dai1->getNumberOfTuples());
- CPPUNIT_ASSERT(dai1->getInfoOnComponent(0)=="c0da1");
- CPPUNIT_ASSERT(dai1->getInfoOnComponent(1)=="c1da1");
- CPPUNIT_ASSERT(dai1->getInfoOnComponent(2)=="c0da3");
- CPPUNIT_ASSERT(dai1->getInfoOnComponent(3)=="c1da3");
- CPPUNIT_ASSERT(dai1->getInfoOnComponent(4)=="c2da3");
- for(int i=0;i<35;i++)
- CPPUNIT_ASSERT_EQUAL((int)expected1[i],dai1->getIJ(0,i));
- // test of static method DataArrayDouble::meld
- DataArrayDouble *da4=DataArrayDouble::Meld(da1C,da3);
- CPPUNIT_ASSERT_EQUAL(5,da4->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(7,da4->getNumberOfTuples());
- CPPUNIT_ASSERT(da4->getInfoOnComponent(0)=="c0da1");
- CPPUNIT_ASSERT(da4->getInfoOnComponent(1)=="c1da1");
- CPPUNIT_ASSERT(da4->getInfoOnComponent(2)=="c0da3");
- CPPUNIT_ASSERT(da4->getInfoOnComponent(3)=="c1da3");
- CPPUNIT_ASSERT(da4->getInfoOnComponent(4)=="c2da3");
- for(int i=0;i<35;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da4->getIJ(0,i),1e-10);
- // test of static method DataArrayInt::meld
- dai1->decrRef();
- dai1=da1C->convertToIntArr();
- DataArrayInt *dai4=DataArrayInt::Meld(dai1,dai3);
- CPPUNIT_ASSERT_EQUAL(5,dai4->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(7,dai4->getNumberOfTuples());
- CPPUNIT_ASSERT(dai4->getInfoOnComponent(0)=="c0da1");
- CPPUNIT_ASSERT(dai4->getInfoOnComponent(1)=="c1da1");
- CPPUNIT_ASSERT(dai4->getInfoOnComponent(2)=="c0da3");
- CPPUNIT_ASSERT(dai4->getInfoOnComponent(3)=="c1da3");
- CPPUNIT_ASSERT(dai4->getInfoOnComponent(4)=="c2da3");
- for(int i=0;i<35;i++)
- CPPUNIT_ASSERT_EQUAL((int)expected1[i],dai4->getIJ(0,i));
- //
- dai4->decrRef();
- da4->decrRef();
- dai3->decrRef();
- dai1->decrRef();
- da1C->decrRef();
- da1->decrRef();
- da2->decrRef();
- da3->decrRef();
-}
-
-void MEDCouplingBasicsTest::testFieldMeld1()
-{
- MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- f1->setMesh(m);
- DataArrayDouble *da1=DataArrayDouble::New();
- const double arr1[5]={12.,23.,34.,45.,56.};
- da1->alloc(5,1);
- std::copy(arr1,arr1+5,da1->getPointer());
- da1->setInfoOnComponent(0,"aaa");
- f1->setArray(da1);
- f1->setTime(3.4,2,1);
- f1->checkCoherency();
- //
- MEDCouplingFieldDouble *f2=f1->deepCpy();
- f2->setMesh(f1->getMesh());
- f2->checkCoherency();
- f2->changeNbOfComponents(2,5.);
- (*f2)=5.;
- f2->getArray()->setInfoOnComponent(0,"bbb");
- f2->getArray()->setInfoOnComponent(1,"ccc");
- f2->checkCoherency();
- //
- MEDCouplingFieldDouble *f3=MEDCouplingFieldDouble::MeldFields(f2,f1);
- f3->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(5,f3->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,f3->getNumberOfComponents());
- CPPUNIT_ASSERT(f3->getArray()->getInfoOnComponent(0)=="bbb");
- CPPUNIT_ASSERT(f3->getArray()->getInfoOnComponent(1)=="ccc");
- CPPUNIT_ASSERT(f3->getArray()->getInfoOnComponent(2)=="aaa");
- const double expected1[15]={5.,5.,12.,5.,5.,23.,5.,5.,34.,5.,5.,45.,5.,5.,56.};
- for(int i=0;i<15;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f3->getIJ(0,i),1e-12);
- int dt,it;
- double time=f3->getTime(dt,it);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,time,1e-14);
- CPPUNIT_ASSERT_EQUAL(2,dt);
- CPPUNIT_ASSERT_EQUAL(1,it);
- //
- MEDCouplingFieldDouble *f4=f2->buildNewTimeReprFromThis(NO_TIME,false);
- MEDCouplingFieldDouble *f5=f1->buildNewTimeReprFromThis(NO_TIME,false);
- MEDCouplingFieldDouble *f6=MEDCouplingFieldDouble::MeldFields(f4,f5);
- f6->checkCoherency();
- CPPUNIT_ASSERT_EQUAL(5,f6->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,f6->getNumberOfComponents());
- CPPUNIT_ASSERT(f6->getArray()->getInfoOnComponent(0)=="bbb");
- CPPUNIT_ASSERT(f6->getArray()->getInfoOnComponent(1)=="ccc");
- CPPUNIT_ASSERT(f6->getArray()->getInfoOnComponent(2)=="aaa");
- for(int i=0;i<15;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f6->getIJ(0,i),1e-12);
- //
- f6->decrRef();
- f4->decrRef();
- f5->decrRef();
- f3->decrRef();
- da1->decrRef();
- f2->decrRef();
- f1->decrRef();
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testMergeNodes2()
-{
- MEDCouplingUMesh *m1=build2DTargetMesh_1();
- MEDCouplingUMesh *m2=build2DTargetMesh_1();
- const double vec[2]={0.002,0.};
- m2->translate(vec);
- //
- std::vector<const MEDCouplingUMesh *> tmp(2);
- tmp[0]=m1;
- tmp[1]=m2;
- MEDCouplingUMesh *m3=MEDCouplingUMesh::MergeUMeshes(tmp);
- bool b;
- int newNbOfNodes;
- DataArrayInt *da=m3->mergeNodes2(0.01,b,newNbOfNodes);
- CPPUNIT_ASSERT_EQUAL(9,m3->getNumberOfNodes());
- const double expected1[18]={-0.299,-0.3, 0.201,-0.3, 0.701,-0.3, -0.299,0.2, 0.201,0.2, 0.701,0.2, -0.299,0.7, 0.201,0.7, 0.701,0.7};
- for(int i=0;i<18;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],m3->getCoords()->getIJ(0,i),1e-13);
- //
- da->decrRef();
- m3->decrRef();
- m1->decrRef();
- m2->decrRef();
-}
-
-void MEDCouplingBasicsTest::testMergeField2()
-{
- MEDCouplingUMesh *m=build2DTargetMesh_1();
- MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- f1->setMesh(m);
- DataArrayDouble *arr=DataArrayDouble::New();
- arr->alloc(5,2);
- arr->fillWithValue(2.);
- f1->setArray(arr);
- arr->decrRef();
- MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- f2->setMesh(m);
- arr=DataArrayDouble::New();
- arr->alloc(5,2);
- arr->fillWithValue(5.);
- f2->setArray(arr);
- arr->decrRef();
- MEDCouplingFieldDouble *f3=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- f3->setMesh(m);
- arr=DataArrayDouble::New();
- arr->alloc(5,2);
- arr->fillWithValue(7.);
- f3->setArray(arr);
- arr->decrRef();
- //
- std::vector<const MEDCouplingFieldDouble *> tmp(3);
- tmp[0]=f1; tmp[1]=f2; tmp[2]=f3;
- MEDCouplingFieldDouble *f4=MEDCouplingFieldDouble::MergeFields(tmp);
- CPPUNIT_ASSERT_EQUAL(15,f4->getMesh()->getNumberOfCells());
- const double expected1[30]={2.,2.,2.,2.,2.,2.,2.,2.,2.,2., 5.,5.,5.,5.,5.,5.,5.,5.,5.,5., 7.,7.,7.,7.,7.,7.,7.,7.,7.,7.};
- for(int i=0;i<30;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f4->getIJ(0,i),1.e-13);
- //
- f4->decrRef();
- f1->decrRef();
- f2->decrRef();
- f3->decrRef();
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIBuildComplement1()
-{
- DataArrayInt *a=DataArrayInt::New();
- const int tab[4]={3,1,7,8};
- a->alloc(4,1);
- std::copy(tab,tab+4,a->getPointer());
- DataArrayInt *b=a->buildComplement(12);
- CPPUNIT_ASSERT_EQUAL(8,b->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,b->getNumberOfComponents());
- const int expected1[8]={0,2,4,5,6,9,10,11};
- for(int i=0;i<8;i++)
- CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
- b->decrRef();
- a->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIBuildUnion1()
-{
- DataArrayInt *a=DataArrayInt::New();
- const int tab1[4]={3,1,7,8};
- a->alloc(4,1);
- std::copy(tab1,tab1+4,a->getPointer());
- DataArrayInt *c=DataArrayInt::New();
- const int tab2[5]={5,3,0,18,8};
- c->alloc(5,1);
- std::copy(tab2,tab2+5,c->getPointer());
- DataArrayInt *b=a->buildUnion(c);
- CPPUNIT_ASSERT_EQUAL(7,b->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,b->getNumberOfComponents());
- const int expected1[7]={0,1,3,5,7,8,18};
- for(int i=0;i<7;i++)
- CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
- c->decrRef();
- b->decrRef();
- a->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIBuildIntersection1()
-{
- DataArrayInt *a=DataArrayInt::New();
- const int tab1[4]={3,1,7,8};
- a->alloc(4,1);
- std::copy(tab1,tab1+4,a->getPointer());
- DataArrayInt *c=DataArrayInt::New();
- const int tab2[5]={5,3,0,18,8};
- c->alloc(5,1);
- std::copy(tab2,tab2+5,c->getPointer());
- DataArrayInt *b=a->buildIntersection(c);
- CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,b->getNumberOfComponents());
- const int expected1[2]={3,8};
- for(int i=0;i<2;i++)
- CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
- c->decrRef();
- b->decrRef();
- a->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIDeltaShiftIndex1()
-{
- DataArrayInt *a=DataArrayInt::New();
- const int tab[7]={1,3,6,7,7,9,15};
- a->alloc(7,1);
- std::copy(tab,tab+7,a->getPointer());
- DataArrayInt *b=a->deltaShiftIndex();
- CPPUNIT_ASSERT_EQUAL(6,b->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,b->getNumberOfComponents());
- const int expected1[6]={2,3,1,0,2,6};
- for(int i=0;i<6;i++)
- CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
- b->decrRef();
- a->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDaDoubleSelectByTupleIdSafe1()
-{
- DataArrayDouble *a=DataArrayDouble::New();
- a->alloc(7,2);
- a->setInfoOnComponent(0,"toto");
- a->setInfoOnComponent(1,"tata");
- const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
- std::copy(arr1,arr1+14,a->getPointer());
- //
- const int arr2[7]={4,2,0,6,5};
- DataArrayDouble *b=a->selectByTupleIdSafe(arr2,arr2+5);
- CPPUNIT_ASSERT_EQUAL(5,b->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
- const double expected1[10]={5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1};
- for(int i=0;i<10;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
- const int arr4[5]={4,-1,0,6,5};
- CPPUNIT_ASSERT_THROW(a->selectByTupleIdSafe(arr4,arr4+5),INTERP_KERNEL::Exception);
- const int arr5[5]={4,2,0,6,7};
- CPPUNIT_ASSERT_THROW(a->selectByTupleIdSafe(arr5,arr5+5),INTERP_KERNEL::Exception);
- b->decrRef();
- a->decrRef();
- //
- DataArrayInt *c=DataArrayInt::New();
- c->alloc(7,2);
- c->setInfoOnComponent(0,"toto");
- c->setInfoOnComponent(1,"tata");
- const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
- std::copy(arr3,arr3+14,c->getPointer());
- DataArrayInt *d=c->selectByTupleIdSafe(arr2,arr2+5);
- CPPUNIT_ASSERT_EQUAL(5,d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
- CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
- const int expected2[10]={5,15,3,13,1,11,7,17,6,16};
- for(int i=0;i<10;i++)
- CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
- CPPUNIT_ASSERT_THROW(c->selectByTupleIdSafe(arr4,arr4+5),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(c->selectByTupleIdSafe(arr5,arr5+5),INTERP_KERNEL::Exception);
- c->decrRef();
- d->decrRef();
-}
-
-void MEDCouplingBasicsTest::testAreCellsIncludedIn1()
-{
- MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- const int pt[2]={1,3};
- MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(pt,pt+2,true);
- DataArrayInt *tmp;
- CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp));
- CPPUNIT_ASSERT_EQUAL(2,tmp->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,tmp->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(pt[0],tmp->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(pt[1],tmp->getIJ(0,1));
- tmp->decrRef();
- CPPUNIT_ASSERT(!m2->areCellsIncludedIn(m,0,tmp));
- tmp->decrRef();
- m2->decrRef();
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIBuildSubstraction1()
-{
- DataArrayInt *a=DataArrayInt::New();
- const int aa[]={2,3,6,8,9};
- a->alloc(5,1);
- std::copy(aa,aa+5,a->getPointer());
- DataArrayInt *b=DataArrayInt::New();
- const int bb[]={1,3,5,9,11};
- b->alloc(5,1);
- std::copy(bb,bb+5,b->getPointer());
- //
- DataArrayInt *c=a->buildSubstraction(b);
- CPPUNIT_ASSERT_EQUAL(3,c->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,c->getNumberOfComponents());
- const int expected1[3]={2,6,8};
- CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer()));
- //
- c->decrRef();
- b->decrRef();
- a->decrRef();
-}
-
-void MEDCouplingBasicsTest::testBuildOrthogonalField2()
-{
- MEDCouplingUMesh *m=build2DTargetMesh_1();
- DataArrayInt *d1=DataArrayInt::New();
- DataArrayInt *d2=DataArrayInt::New();
- DataArrayInt *d3=DataArrayInt::New();
- DataArrayInt *d4=DataArrayInt::New();
- MEDCouplingUMesh *m1=m->buildDescendingConnectivity(d1,d2,d3,d4);
- //
- MEDCouplingFieldDouble *f1=m1->buildOrthogonalField();
- DataArrayDouble *da1=f1->getArray();
- CPPUNIT_ASSERT_EQUAL(2,da1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(13,da1->getNumberOfTuples());
- //
- const double expected1[26]={-1.,0.,0.,1.,1.,0.,0.,-1.,0.707106781186548,0.707106781186548,0.,-1.,0.,1.,1.,0.,0.,1.,1.,0.,-1.,0.,0.,1.,1.,0.};
- for(int i=0;i<26;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da1->getIJ(0,i),1e-14);
- //
- f1->decrRef();
- m1->decrRef();
- d1->decrRef();
- d2->decrRef();
- d3->decrRef();
- d4->decrRef();
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testUMInsertNextCell1()
-{
- double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 };
- int targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
- MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
- targetMesh->allocateCells(5);
- CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn),INTERP_KERNEL::Exception);
- targetMesh->setMeshDimension(2);
- targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
- CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,targetConn),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,targetConn),INTERP_KERNEL::Exception);
- CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,targetConn),INTERP_KERNEL::Exception);
- targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+4);
- targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+7);
- targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+10);
- targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+14);
- targetMesh->finishInsertingCells();
- DataArrayDouble *myCoords=DataArrayDouble::New();
- myCoords->alloc(9,2);
- std::copy(targetCoords,targetCoords+18,myCoords->getPointer());
- targetMesh->setCoords(myCoords);
- myCoords->decrRef();
- targetMesh->checkCoherency();
- targetMesh->decrRef();
-}
-
-void MEDCouplingBasicsTest::testFieldOperatorDivDiffComp1()
-{
- MEDCouplingUMesh *m=build2DTargetMesh_1();
- DataArrayInt *d1=DataArrayInt::New();
- DataArrayInt *d2=DataArrayInt::New();
- DataArrayInt *d3=DataArrayInt::New();
- DataArrayInt *d4=DataArrayInt::New();
- MEDCouplingUMesh *m1=m->buildDescendingConnectivity(d1,d2,d3,d4);
- //
- MEDCouplingFieldDouble *f1=m1->buildOrthogonalField();
- const double arr1[13]={2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.};
- DataArrayDouble *arr=DataArrayDouble::New();
- arr->alloc(13,1);
- std::copy(arr1,arr1+13,arr->getPointer());
- MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS);
- f2->setArray(arr);
- f2->setMesh(m1);
- f2->checkCoherency();
- //
- MEDCouplingFieldDouble *f3=(*f1)/(*f2);
- CPPUNIT_ASSERT_THROW((*f2)/(*f1),INTERP_KERNEL::Exception);
- f3->checkCoherency();
- (*f1)/=(*f2);
- CPPUNIT_ASSERT(f1->isEqual(f3,1e-10,1e-10));
- CPPUNIT_ASSERT_THROW((*f2)/=(*f1),INTERP_KERNEL::Exception);
- const double expected1[26]={-0.5, 0.0, 0.0, 0.33333333333333331, 0.25, 0.0, 0.0, -0.20000000000000001, 0.117851130197758, 0.117851130197758, 0.0, -0.14285714285714285, 0.0, 0.125, 0.1111111111111111, 0.0, 0.0, 0.10000000000000001, 0.090909090909090912, 0.0, -0.083333333333333329, 0.0, 0.0, 0.076923076923076927, 0.071428571428571425, 0.0};
- for(int i=0;i<26;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f3->getIJ(0,i),1e-10);
- //
- f3->decrRef();
- f2->decrRef();
- arr->decrRef();
- f1->decrRef();
- m1->decrRef();
- d1->decrRef();
- d2->decrRef();
- d3->decrRef();
- d4->decrRef();
- m->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDARearrange1()
-{
- DataArrayInt *da1=DataArrayInt::New();
- da1->alloc(12,1);
- da1->iota(0);
- const int *ptr=da1->getConstPointer();
- //
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(1,da1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNumberOfTuples());
- da1->rearrange(4);
- CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(4,da1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(3,da1->getNumberOfTuples());
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
- //
- da1->rearrange(6);
- CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(6,da1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(2,da1->getNumberOfTuples());
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
- //
- CPPUNIT_ASSERT_THROW(da1->rearrange(7),INTERP_KERNEL::Exception);
- //
- da1->rearrange(12);
- CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(1,da1->getNumberOfTuples());
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
- //
- da1->rearrange(3);
- CPPUNIT_ASSERT(ptr==da1->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(3,da1->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(4,da1->getNumberOfTuples());
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
- //double
- DataArrayDouble *da2=da1->convertToDblArr();
- da1->decrRef();
- const double *ptr2=da2->getConstPointer();
- //
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
- da2->rearrange(4);
- CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfTuples());
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL((double)i,da2->getIJ(0,i),1e-14);
- //
- da2->rearrange(6);
- CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(6,da2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(2,da2->getNumberOfTuples());
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL((double)i,da2->getIJ(0,i),1e-14);
- //
- CPPUNIT_ASSERT_THROW(da2->rearrange(7),INTERP_KERNEL::Exception);
- //
- da2->rearrange(1);
- CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(12,da2->getNumberOfTuples());
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL((double)i,da2->getIJ(0,i),1e-14);
- //
- da2->rearrange(3);
- CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
- CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
- CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
- for(int i=0;i<12;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL((double)i,da2->getIJ(0,i),1e-14);
- da2->decrRef();
-}
-
-void MEDCouplingBasicsTest::testGetDifferentValues1()
-{
- DataArrayInt *da1=DataArrayInt::New();
- const int arr[12]={1,2,3,2,2,3,5,1,5,5,2,2};
- da1->alloc(4,3);
- std::copy(arr,arr+12,da1->getPointer());
- std::set<int> s=da1->getDifferentValues();
- const int expected1[4]={1,2,3,5};
- CPPUNIT_ASSERT_EQUAL(4,(int)s.size());
- CPPUNIT_ASSERT(std::equal(expected1,expected1+4,s.begin()));
- da1->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIBuildPermutationArr1()
-{
- DataArrayInt *a=DataArrayInt::New();
- const int vala[5]={4,5,6,7,8};
- a->alloc(5,1);
- std::copy(vala,vala+5,a->getPointer());
- DataArrayInt *b=DataArrayInt::New();
- const int valb[5]={5,4,8,6,7};
- b->alloc(5,1);
- std::copy(valb,valb+5,b->getPointer());
- DataArrayInt *c=a->buildPermutationArr(*b);
- const int expect1[5]={1,0,4,2,3};
- CPPUNIT_ASSERT_EQUAL(5,c->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,c->getNumberOfComponents());
- CPPUNIT_ASSERT(std::equal(expect1,expect1+5,c->getConstPointer()));
- CPPUNIT_ASSERT(a->isEqualWithoutConsideringStrAndOrder(*b));
- b->setIJ(0,0,9);
- CPPUNIT_ASSERT(!a->isEqualWithoutConsideringStrAndOrder(*b));
- CPPUNIT_ASSERT_THROW(a->buildPermutationArr(*b),INTERP_KERNEL::Exception);
- a->setIJ(3,0,4);
- b->setIJ(0,0,5);
- b->setIJ(4,0,4);//;a==[4,5,6,4,8] and b==[5,4,8,6,4]
- CPPUNIT_ASSERT(a->isEqualWithoutConsideringStrAndOrder(*b));
- c->decrRef();
- c=a->buildPermutationArr(*b);
- const int expect2[5]={1,3,4,2,3};
- CPPUNIT_ASSERT(std::equal(expect2,expect2+5,c->getConstPointer()));
- DataArrayDouble *d=b->convertToDblArr();
- b->sort();
- const int expect3[5]={4,4,5,6,8};
- CPPUNIT_ASSERT(std::equal(expect3,expect3+5,b->getConstPointer()));
- d->sort();
- CPPUNIT_ASSERT_EQUAL(5,d->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
- for(int i=0;i<5;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(double(expect3[i]),d->getIJ(i,0),1e-14);
- //
- d->decrRef();
- c->decrRef();
- a->decrRef();
- b->decrRef();
-}
-
-void MEDCouplingBasicsTest::testAreCellsIncludedIn2()
-{
- const char myName[]="Vitoo";
- MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
- MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(0,0,true);
- CPPUNIT_ASSERT_EQUAL(0,m2->getNumberOfCells());
- CPPUNIT_ASSERT_EQUAL(3,m2->getSpaceDimension());
- CPPUNIT_ASSERT_EQUAL(2,m2->getMeshDimension());
- m2->setName(myName);
- DataArrayInt *tmp;
- CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp));
- CPPUNIT_ASSERT(std::string(myName)==tmp->getName());
- CPPUNIT_ASSERT_EQUAL(0,tmp->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(1,tmp->getNumberOfComponents());
- m->decrRef();
- m2->decrRef();
- tmp->decrRef();
-}
-
-void MEDCouplingBasicsTest::testUMeshGetPartBarycenterAndOwner1()
-{
- MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const int part[3]={1,0,4};
- DataArrayDouble *b=m1->getPartBarycenterAndOwner(part,part+3);
- CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(3,b->getNumberOfTuples());
- const double expected1[6]={0.36666666666666665,-0.13333333333333333,-0.05,-0.05,0.45,0.45};
- for(int i=0;i<6;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
- b->decrRef();
- m1->decrRef();
-}
-
-void MEDCouplingBasicsTest::testUMeshGetPartMeasureField1()
-{
- MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const int part[3]={1,0,4};
- MEDCouplingFieldDouble *b=m1->getPartMeasureField(true,part,part+3);
- CPPUNIT_ASSERT_EQUAL(1,b->getArray()->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(3,b->getArray()->getNumberOfTuples());
- const double expected1[3]={0.125,0.25,0.25};
- for(int i=0;i<3;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getArray()->getIJ(0,i),1e-14);
- b->decrRef();
- m1->decrRef();
-}
-
-void MEDCouplingBasicsTest::testUMeshBuildPartOrthogonalField1()
-{
- MEDCouplingUMesh *m1=build2DTargetMesh_1();
- m1->changeSpaceDimension(3);
- const int part[3]={1,0,4};
- MEDCouplingFieldDouble *b=m1->buildPartOrthogonalField(part,part+3);
- CPPUNIT_ASSERT_EQUAL(3,b->getArray()->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(3,b->getArray()->getNumberOfTuples());
- const double expected1[9]={0.,0.,-1.,0.,0.,-1.,0.,0.,-1.};
- for(int i=0;i<9;i++)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getArray()->getIJ(0,i),1e-14);
- b->decrRef();
- m1->decrRef();
-}
-
-void MEDCouplingBasicsTest::testUMeshGetTypesOfPart1()
-{
- MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const int part1[]={0,3,4};
- std::set<INTERP_KERNEL::NormalizedCellType> s;
- s=m1->getTypesOfPart(part1,part1+3);
- CPPUNIT_ASSERT(s.size()==1);
- CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_QUAD4);
- const int part2[]={2,2,2,1};
- s=m1->getTypesOfPart(part2,part2+4);
- CPPUNIT_ASSERT(s.size()==1);
- CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_TRI3);
- const int part3[]={3,2,1};
- s=m1->getTypesOfPart(part3,part3+3);
- CPPUNIT_ASSERT(s.size()==2);
- CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_TRI3);
- CPPUNIT_ASSERT(*(++s.begin())==INTERP_KERNEL::NORM_QUAD4);
- m1->decrRef();
-}
-
-void MEDCouplingBasicsTest::testUMeshKeepCellIdsByType1()
-{
- MEDCouplingUMesh *m1=build2DTargetMesh_1();
- const int part1[3]={0,3,4};
- DataArrayInt *a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part1,part1+3);
- CPPUNIT_ASSERT_EQUAL(1,a->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(0,a->getNumberOfTuples());
- a->decrRef();
- //
- const int part2[5]={3,2,0,2,4};
- a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part2,part2+5);
- CPPUNIT_ASSERT_EQUAL(1,a->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(2,a->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,a->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(2,a->getIJ(1,0));
- a->decrRef();
- //
- a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_QUAD4,part2,part2+5);
- CPPUNIT_ASSERT_EQUAL(1,a->getNumberOfComponents());
- CPPUNIT_ASSERT_EQUAL(3,a->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(3,a->getIJ(0,0));
- CPPUNIT_ASSERT_EQUAL(0,a->getIJ(1,0));
- CPPUNIT_ASSERT_EQUAL(4,a->getIJ(2,0));
- //
- a->decrRef();
- m1->decrRef();
-}
-
-void MEDCouplingBasicsTest::testDAIAggregateMulti1()
-{
- DataArrayInt *a=DataArrayInt::New();
- a->setName("aa");
- a->alloc(4,1);
- a->iota(0);
- a->rearrange(2);
- DataArrayInt *b=DataArrayInt::New();
- b->setName("bb");
- b->alloc(6,1);
- b->iota(0);
- b->rearrange(2);
- //
- std::vector<const DataArrayInt *> v(2);
- v[0]=a; v[1]=b;
- DataArrayInt *c=DataArrayInt::Aggregate(v);
- CPPUNIT_ASSERT_EQUAL(5,c->getNumberOfTuples());
- CPPUNIT_ASSERT_EQUAL(2,c->getNumberOfComponents());
- CPPUNIT_ASSERT(c->getName()=="aa");
- const int expect1[10]={0,1,2,3,0,1,2,3,4,5};
- for(int i=0;i<10;i++)
- CPPUNIT_ASSERT_EQUAL(expect1[i],c->getIJ(0,i));
- //
- c->decrRef();
- a->decrRef();
- b->decrRef();
-}
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "MEDCouplingBasicsTest.hxx"
+#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingGaussLocalization.hxx"
+
+#include <cmath>
+#include <functional>
+#include <iterator>
+
+using namespace ParaMEDMEM;
+
+void MEDCouplingBasicsTest::testGetMeasureFieldCMesh1()
+{
+ MEDCouplingCMesh *m=MEDCouplingCMesh::New();
+ DataArrayDouble *da=DataArrayDouble::New();
+ const double discX[4]={2.3,3.4,5.8,10.2};
+ const double discY[3]={12.3,23.4,45.8};
+ const double discZ[5]={-0.7,1.2,1.25,2.13,2.67};
+ da->alloc(4,1);
+ std::copy(discX,discX+4,da->getPointer());
+ m->setCoordsAt(0,da);
+ da->decrRef();
+ m->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(3,m->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(1,m->getSpaceDimension());
+ MEDCouplingFieldDouble *f=m->getMeasureField(true);
+ CPPUNIT_ASSERT_EQUAL(3,f->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,f->getNumberOfComponents());
+ const double expected1[3]={1.1,2.4,4.4};
+ for(int i=0;i<3;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f->getIJ(i,0),1e-12);
+ f->decrRef();
+ DataArrayDouble *coords=m->getCoordinatesAndOwner();
+ CPPUNIT_ASSERT_EQUAL(4,coords->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,coords->getNumberOfComponents());
+ for(int i=0;i<4;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(discX[i],coords->getIJ(i,0),1e-12);
+ coords->decrRef();
+ coords=m->getBarycenterAndOwner();
+ CPPUNIT_ASSERT_EQUAL(3,coords->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,coords->getNumberOfComponents());
+ const double expected1_3[3]={2.85,4.6,8.};
+ for(int i=0;i<3;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1_3[i],coords->getIJ(i,0),1e-12);
+ coords->decrRef();
+ //
+ da=DataArrayDouble::New();
+ da->alloc(3,1);
+ std::copy(discY,discY+3,da->getPointer());
+ m->setCoordsAt(1,da);
+ da->decrRef();
+ m->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(12,m->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(6,m->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(2,m->getSpaceDimension());
+ f=m->getMeasureField(true);
+ CPPUNIT_ASSERT_EQUAL(6,f->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,f->getNumberOfComponents());
+ const double expected2[6]={12.21,26.64,48.84,24.64,53.76,98.56};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(i,0),1e-12);
+ f->decrRef();
+ coords=m->getCoordinatesAndOwner();
+ CPPUNIT_ASSERT_EQUAL(12,coords->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,coords->getNumberOfComponents());
+ const double expected2_2[24]={2.3,12.3,3.4,12.3,5.8,12.3,10.2,12.3, 2.3,23.4,3.4,23.4,5.8,23.4,10.2,23.4, 2.3,45.8,3.4,45.8,5.8,45.8,10.2,45.8};
+ for(int i=0;i<24;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2_2[i],coords->getIJ(0,i),1e-12);
+ coords->decrRef();
+ coords=m->getBarycenterAndOwner();
+ CPPUNIT_ASSERT_EQUAL(6,coords->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,coords->getNumberOfComponents());
+ const double expected2_3[12]={2.85,17.85,4.6,17.85,8.,17.85, 2.85,34.6,4.6,34.6,8.,34.6};
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2_3[i],coords->getIJ(0,i),1e-12);
+ coords->decrRef();
+ //
+ da=DataArrayDouble::New();
+ da->alloc(5,1);
+ std::copy(discZ,discZ+5,da->getPointer());
+ m->setCoordsAt(2,da);
+ da->decrRef();
+ m->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(60,m->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(24,m->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension());
+ f=m->getMeasureField(true);
+ CPPUNIT_ASSERT_EQUAL(24,f->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,f->getNumberOfComponents());
+ const double expected3[24]={23.199, 50.616, 92.796, 46.816, 102.144, 187.264, 0.6105, 1.332, 2.442, 1.232, 2.688, 4.928, 10.7448, 23.4432, 42.9792, 21.6832, 47.3088, 86.7328, 6.5934, 14.3856, 26.3736, 13.3056, 29.0304, 53.2224};
+ for(int i=0;i<24;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],f->getIJ(i,0),1e-12);
+ f->decrRef();
+ coords=m->getCoordinatesAndOwner();
+ CPPUNIT_ASSERT_EQUAL(60,coords->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,coords->getNumberOfComponents());
+ const double expected3_2[180]={
+ 2.3,12.3,-0.7, 3.4,12.3,-0.7, 5.8,12.3,-0.7, 10.2,12.3,-0.7, 2.3,23.4,-0.7, 3.4,23.4,-0.7, 5.8,23.4,-0.7, 10.2,23.4,-0.7, 2.3,45.8,-0.7, 3.4,45.8,-0.7, 5.8,45.8,-0.7, 10.2,45.8,-0.7,
+ 2.3,12.3,1.2, 3.4,12.3,1.2, 5.8,12.3,1.2, 10.2,12.3,1.2, 2.3,23.4,1.2, 3.4,23.4,1.2, 5.8,23.4,1.2, 10.2,23.4,1.2, 2.3,45.8,1.2, 3.4,45.8,1.2, 5.8,45.8,1.2, 10.2,45.8,1.2,
+ 2.3,12.3,1.25, 3.4,12.3,1.25, 5.8,12.3,1.25, 10.2,12.3,1.25, 2.3,23.4,1.25, 3.4,23.4,1.25, 5.8,23.4,1.25, 10.2,23.4,1.25, 2.3,45.8,1.25, 3.4,45.8,1.25, 5.8,45.8,1.25, 10.2,45.8,1.25,
+ 2.3,12.3,2.13, 3.4,12.3,2.13, 5.8,12.3,2.13, 10.2,12.3,2.13, 2.3,23.4,2.13, 3.4,23.4,2.13, 5.8,23.4,2.13, 10.2,23.4,2.13, 2.3,45.8,2.13, 3.4,45.8,2.13, 5.8,45.8,2.13, 10.2,45.8,2.13,
+ 2.3,12.3,2.67, 3.4,12.3,2.67, 5.8,12.3,2.67, 10.2,12.3,2.67, 2.3,23.4,2.67, 3.4,23.4,2.67, 5.8,23.4,2.67, 10.2,23.4,2.67, 2.3,45.8,2.67, 3.4,45.8,2.67, 5.8,45.8,2.67, 10.2,45.8,2.67
+ };
+ for(int i=0;i<180;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3_2[i],coords->getIJ(0,i),1e-12);
+ coords->decrRef();
+ coords=m->getBarycenterAndOwner();
+ CPPUNIT_ASSERT_EQUAL(24,coords->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,coords->getNumberOfComponents());
+ const double expected3_3[72]={
+ 2.85,17.85,0.25,4.6,17.85,0.25,8.,17.85,0.25, 2.85,34.6,0.25,4.6,34.6,0.25,8.,34.6,0.25,
+ 2.85,17.85,1.225,4.6,17.85,1.225,8.,17.85,1.225, 2.85,34.6,1.225,4.6,34.6,1.225,8.,34.6,1.225,
+ 2.85,17.85,1.69,4.6,17.85,1.69,8.,17.85,1.69, 2.85,34.6,1.69,4.6,34.6,1.69,8.,34.6,1.69,
+ 2.85,17.85,2.4,4.6,17.85,2.4,8.,17.85,2.4, 2.85,34.6,2.4,4.6,34.6,2.4,8.,34.6,2.4
+ };
+ for(int i=0;i<72;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3_3[i],coords->getIJ(0,i),1e-12);
+ coords->decrRef();
+ //
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testFieldDoubleZipCoords1()
+{
+ MEDCouplingUMesh *m=build2DTargetMeshMergeNode_1();
+ MEDCouplingFieldDouble *f=m->fillFromAnalytic(ON_NODES,2,"x*2.");
+ f->getArray()->setInfoOnComponent(0,"titi");
+ f->getArray()->setInfoOnComponent(1,"tutu");
+ f->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(18,f->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,f->getNumberOfComponents());
+ const double expected1[36]={-0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4};
+ for(int i=0;i<36;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f->getIJ(0,i),1e-12);
+ CPPUNIT_ASSERT(f->zipCoords());
+ f->checkCoherency();
+ const double expected2[30]={-0.6, -0.6, 1.4, 1.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 1.4, 1.4, -0.6, -0.6, 0.4, 0.4, 1.4, 1.4, 0.4, 0.4};
+ for(int i=0;i<30;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(0,i),1e-12);
+ CPPUNIT_ASSERT(!f->zipCoords());
+ f->checkCoherency();
+ for(int i=0;i<30;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(0,i),1e-12);
+ CPPUNIT_ASSERT(std::string(f->getArray()->getInfoOnComponent(0))=="titi");
+ CPPUNIT_ASSERT(std::string(f->getArray()->getInfoOnComponent(1))=="tutu");
+ f->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testFieldDoubleZipConnectivity1()
+{
+ MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ MEDCouplingUMesh *m2=build2DTargetMesh_1();
+ const int cells1[3]={2,3,4};
+ MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true);
+ MEDCouplingUMesh *m3=dynamic_cast<MEDCouplingUMesh *>(m3_1);
+ CPPUNIT_ASSERT(m3);
+ m2->decrRef();
+ MEDCouplingUMesh *m4=build2DSourceMesh_1();
+ MEDCouplingUMesh *m5=MEDCouplingUMesh::MergeUMeshes(m1,m3);
+ m1->decrRef();
+ m3->decrRef();
+ MEDCouplingUMesh *m6=MEDCouplingUMesh::MergeUMeshes(m5,m4);
+ m4->decrRef();
+ m5->decrRef();
+ //
+ CPPUNIT_ASSERT_EQUAL(10,m6->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(22,m6->getNumberOfNodes());
+ bool areNodesMerged;
+ int newNbOfNodes;
+ DataArrayInt *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(9,m6->getNumberOfNodes());
+ arr->decrRef();
+ MEDCouplingFieldDouble *f=m6->fillFromAnalytic(ON_CELLS,2,"x");
+ MEDCouplingFieldDouble *f2=m6->fillFromAnalytic(ON_NODES,2,"x");
+ CPPUNIT_ASSERT_EQUAL(10,f->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,f->getNumberOfComponents());
+ const double expected1[20]={-0.05, -0.05, 0.3666666666666667, 0.3666666666666667, 0.53333333333333321, 0.53333333333333321,
+ -0.05, -0.05, 0.45, 0.45, 0.53333333333333321, 0.53333333333333321, -0.05, -0.05, 0.45, 0.45,
+ 0.36666666666666659, 0.36666666666666659, 0.033333333333333326, 0.033333333333333326};
+ for(int i=0;i<20;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f->getIJ(0,i),1e-12);
+ f->getArray()->setInfoOnComponent(0,"titi");
+ f->getArray()->setInfoOnComponent(1,"tutu");
+ f->checkCoherency();
+ CPPUNIT_ASSERT(f->zipConnectivity(0));
+ const double expected2[14]={-0.05, -0.05, 0.3666666666666667, 0.3666666666666667, 0.53333333333333321, 0.53333333333333321,
+ -0.05, -0.05, 0.45, 0.45, 0.36666666666666659, 0.36666666666666659, 0.033333333333333326, 0.033333333333333326};
+ CPPUNIT_ASSERT_EQUAL(7,f->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,f->getNumberOfComponents());
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getIJ(0,i),1e-12);
+ CPPUNIT_ASSERT(std::string(f->getArray()->getInfoOnComponent(0))=="titi");
+ CPPUNIT_ASSERT(std::string(f->getArray()->getInfoOnComponent(1))=="tutu");
+ CPPUNIT_ASSERT(!f->zipConnectivity(0));
+ f->decrRef();
+ //
+ const double expected3[18]={-0.3, -0.3, 0.2, 0.2, 0.7, 0.7, -0.3, -0.3, 0.2, 0.2, 0.7, 0.7,
+ -0.3, -0.3, 0.2, 0.2, 0.7, 0.7};
+ CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
+ for(int i=0;i<18;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],f2->getIJ(0,i),1e-12);
+ CPPUNIT_ASSERT(f2->zipConnectivity(0));
+ CPPUNIT_ASSERT_EQUAL(9,f2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,f2->getNumberOfComponents());
+ for(int i=0;i<18;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],f2->getIJ(0,i),1e-12);
+ f2->decrRef();
+ //
+ m6->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDaDoubleRenumber1()
+{
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(7,2);
+ a->setInfoOnComponent(0,"toto");
+ a->setInfoOnComponent(1,"tata");
+ const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
+ std::copy(arr1,arr1+14,a->getPointer());
+ //
+ const int arr2[7]={3,1,0,6,5,4,2};
+ DataArrayDouble *b=a->renumber(arr2);
+ CPPUNIT_ASSERT_EQUAL(7,b->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
+ const double expected1[14]={3.1, 13.1, 2.1, 12.1, 7.1, 17.1, 1.1, 11.1, 6.1, 16.1, 5.1, 15.1, 4.1, 14.1};
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
+ b->decrRef();
+ a->decrRef();
+ //
+ DataArrayInt *c=DataArrayInt::New();
+ c->alloc(7,2);
+ c->setInfoOnComponent(0,"toto");
+ c->setInfoOnComponent(1,"tata");
+ const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ std::copy(arr3,arr3+14,c->getPointer());
+ DataArrayInt *d=c->renumber(arr2);
+ CPPUNIT_ASSERT_EQUAL(7,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
+ const int expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14};
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
+ c->decrRef();
+ d->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDaDoubleRenumberAndReduce1()
+{
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(7,2);
+ a->setInfoOnComponent(0,"toto");
+ a->setInfoOnComponent(1,"tata");
+ const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
+ std::copy(arr1,arr1+14,a->getPointer());
+ //
+ const int arr2[7]={2,-1,1,-1,0,4,3};
+ DataArrayDouble *b=a->renumberAndReduce(arr2,5);
+ CPPUNIT_ASSERT_EQUAL(5,b->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
+ const double expected1[10]={5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1};
+ for(int i=0;i<10;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
+ b->decrRef();
+ a->decrRef();
+ //
+ DataArrayInt *c=DataArrayInt::New();
+ c->alloc(7,2);
+ c->setInfoOnComponent(0,"toto");
+ c->setInfoOnComponent(1,"tata");
+ const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ std::copy(arr3,arr3+14,c->getPointer());
+ DataArrayInt *d=c->renumberAndReduce(arr2,5);
+ CPPUNIT_ASSERT_EQUAL(5,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
+ const int expected2[10]={5,15,3,13,1,11,7,17,6,16};
+ for(int i=0;i<10;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
+ c->decrRef();
+ d->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDaDoubleRenumberInPlace1()
+{
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(7,2);
+ const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
+ std::copy(arr1,arr1+14,a->getPointer());
+ //
+ const int arr2[7]={3,1,0,6,5,4,2};
+ a->renumberInPlace(arr2);
+ CPPUNIT_ASSERT_EQUAL(7,a->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,a->getNumberOfComponents());
+ const double expected1[14]={3.1, 13.1, 2.1, 12.1, 7.1, 17.1, 1.1, 11.1, 6.1, 16.1, 5.1, 15.1, 4.1, 14.1};
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a->getIJ(0,i),1e-14);
+ a->decrRef();
+ //
+ DataArrayInt *c=DataArrayInt::New();
+ c->alloc(7,2);
+ const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ std::copy(arr3,arr3+14,c->getPointer());
+ c->renumberInPlace(arr2);
+ CPPUNIT_ASSERT_EQUAL(7,c->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,c->getNumberOfComponents());
+ const int expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14};
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],c->getIJ(0,i));
+ c->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDaDoubleRenumberR1()
+{
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(7,2);
+ a->setInfoOnComponent(0,"toto");
+ a->setInfoOnComponent(1,"tata");
+ const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
+ std::copy(arr1,arr1+14,a->getPointer());
+ //
+ const int arr2[7]={3,1,0,6,5,4,2};
+ DataArrayDouble *b=a->renumberR(arr2);
+ CPPUNIT_ASSERT_EQUAL(7,b->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
+ const double expected1[14]={4.1, 14.1, 2.1, 12.1, 1.1, 11.1, 7.1, 17.1, 6.1, 16.1, 5.1, 15.1, 3.1, 13.1};
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
+ b->decrRef();
+ a->decrRef();
+ //
+ DataArrayInt *c=DataArrayInt::New();
+ c->alloc(7,2);
+ c->setInfoOnComponent(0,"toto");
+ c->setInfoOnComponent(1,"tata");
+ const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ std::copy(arr3,arr3+14,c->getPointer());
+ DataArrayInt *d=c->renumberR(arr2);
+ CPPUNIT_ASSERT_EQUAL(7,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
+ const int expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13};
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
+ c->decrRef();
+ d->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDaDoubleRenumberInPlaceR1()
+{
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(7,2);
+ const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
+ std::copy(arr1,arr1+14,a->getPointer());
+ //
+ const int arr2[7]={3,1,0,6,5,4,2};
+ a->renumberInPlaceR(arr2);
+ CPPUNIT_ASSERT_EQUAL(7,a->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,a->getNumberOfComponents());
+ const double expected1[14]={4.1, 14.1, 2.1, 12.1, 1.1, 11.1, 7.1, 17.1, 6.1, 16.1, 5.1, 15.1, 3.1, 13.1};
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a->getIJ(0,i),1e-14);
+ a->decrRef();
+ //
+ DataArrayInt *c=DataArrayInt::New();
+ c->alloc(7,2);
+ const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ std::copy(arr3,arr3+14,c->getPointer());
+ c->renumberInPlaceR(arr2);
+ CPPUNIT_ASSERT_EQUAL(7,c->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,c->getNumberOfComponents());
+ const int expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13};
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],c->getIJ(0,i));
+ c->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDaDoubleSelectByTupleId1()
+{
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(7,2);
+ a->setInfoOnComponent(0,"toto");
+ a->setInfoOnComponent(1,"tata");
+ const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
+ std::copy(arr1,arr1+14,a->getPointer());
+ //
+ const int arr2[7]={4,2,0,6,5};
+ DataArrayDouble *b=a->selectByTupleId(arr2,arr2+5);
+ CPPUNIT_ASSERT_EQUAL(5,b->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
+ const double expected1[10]={5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1};
+ for(int i=0;i<10;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
+ b->decrRef();
+ a->decrRef();
+ //
+ DataArrayInt *c=DataArrayInt::New();
+ c->alloc(7,2);
+ c->setInfoOnComponent(0,"toto");
+ c->setInfoOnComponent(1,"tata");
+ const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ std::copy(arr3,arr3+14,c->getPointer());
+ DataArrayInt *d=c->selectByTupleId(arr2,arr2+5);
+ CPPUNIT_ASSERT_EQUAL(5,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
+ const int expected2[10]={5,15,3,13,1,11,7,17,6,16};
+ for(int i=0;i<10;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
+ c->decrRef();
+ d->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDaDoubleGetMinMaxValues1()
+{
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(9,1);
+ const double arr1[9]={2.34,4.56,-6.77,4.55,4.56,2.24,2.34,1.02,4.56};
+ std::copy(arr1,arr1+9,a->getPointer());
+ int where;
+ double m=a->getMaxValue(where);
+ CPPUNIT_ASSERT_EQUAL(1,where);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4.56,m,1e-12);
+ DataArrayInt *ws;
+ m=a->getMaxValue2(ws);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4.56,m,1e-12);
+ CPPUNIT_ASSERT_EQUAL(3,ws->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,ws->getNumberOfComponents());
+ const int expected1[3]={1,4,8};
+ for(int i=0;i<3;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
+ ws->decrRef();
+ a->decrRef();
+ a=DataArrayDouble::New();
+ const double arr2[9]={-2.34,-4.56,6.77,-4.55,-4.56,-2.24,-2.34,-1.02,-4.56};
+ a->alloc(9,1);
+ std::copy(arr2,arr2+9,a->getPointer());
+ where=-2;
+ m=a->getMinValue(where);
+ CPPUNIT_ASSERT_EQUAL(1,where);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(-4.56,m,1e-12);
+ m=a->getMinValue2(ws);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(-4.56,m,1e-12);
+ CPPUNIT_ASSERT_EQUAL(3,ws->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,ws->getNumberOfComponents());
+ for(int i=0;i<3;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
+ ws->decrRef();
+ a->decrRef();
+}
+
+void MEDCouplingBasicsTest::testFieldDoubleGetMinMaxValues2()
+{
+ MEDCouplingUMesh *m1=0;
+ MEDCouplingUMesh *m2=build3DExtrudedUMesh_1(m1);
+ m1->decrRef();
+ CPPUNIT_ASSERT_EQUAL(18,m2->getNumberOfCells());
+ const double arr1[18]={8.71,4.53,-12.41,8.71,-8.71,8.7099,4.55,8.71,5.55,6.77,-1e-200,4.55,8.7099,0.,1.23,0.,2.22,8.71};
+ MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(18,1);
+ std::copy(arr1,arr1+18,a->getPointer());
+ f->setArray(a);
+ a->decrRef();
+ f->setMesh(m2);
+ //
+ f->checkCoherency();
+ double m=f->getMaxValue();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12);
+ DataArrayInt *ws;
+ m=f->getMaxValue2(ws);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12);
+ CPPUNIT_ASSERT_EQUAL(4,ws->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,ws->getNumberOfComponents());
+ const int expected1[4]={0,3,7,17};
+ for(int i=0;i<4;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
+ ws->decrRef();
+ //
+ const double arr2[18]={-8.71,-4.53,12.41,-8.71,8.71,-8.7099,-4.55,-8.71,-5.55,-6.77,1e-200,-4.55,-8.7099,0.,-1.23,0.,-2.22,-8.71};
+ std::copy(arr2,arr2+18,a->getPointer());
+ f->checkCoherency();
+ m=f->getMinValue();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.71,m,1e-12);
+ m=f->getMinValue2(ws);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(-8.71,m,1e-12);
+ CPPUNIT_ASSERT_EQUAL(4,ws->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,ws->getNumberOfComponents());
+ for(int i=0;i<4;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0));
+ ws->decrRef();
+ //
+ f->decrRef();
+ m2->decrRef();
+}
+
+void MEDCouplingBasicsTest::testBuildUnstructuredCMesh1()
+{
+ MEDCouplingCMesh *m=MEDCouplingCMesh::New();
+ DataArrayDouble *da=DataArrayDouble::New();
+ const double discX[4]={2.3,3.4,5.8,10.2};
+ const double discY[3]={12.3,23.4,45.8};
+ const double discZ[5]={-0.7,1.2,1.25,2.13,2.67};
+ da->alloc(4,1);
+ std::copy(discX,discX+4,da->getPointer());
+ m->setCoordsAt(0,da);
+ da->decrRef();
+ m->checkCoherency();
+ double pos=2.4;
+ CPPUNIT_ASSERT_EQUAL(0,m->getCellContainingPoint(&pos,1e-12));
+ pos=3.7;
+ CPPUNIT_ASSERT_EQUAL(1,m->getCellContainingPoint(&pos,1e-12));
+ pos=5.9;
+ CPPUNIT_ASSERT_EQUAL(2,m->getCellContainingPoint(&pos,1e-12));
+ pos=10.3;
+ CPPUNIT_ASSERT_EQUAL(-1,m->getCellContainingPoint(&pos,1e-12));
+ pos=1.3;
+ CPPUNIT_ASSERT_EQUAL(-1,m->getCellContainingPoint(&pos,1e-12));
+ //
+ MEDCouplingUMesh *m2=m->buildUnstructured();
+ m2->checkCoherency();
+ MEDCouplingFieldDouble *f1=m->getMeasureField(false);
+ MEDCouplingFieldDouble *f2=m2->getMeasureField(false);
+ CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),3);
+ CPPUNIT_ASSERT_EQUAL(f2->getNumberOfTuples(),3);
+ CPPUNIT_ASSERT_EQUAL(1,m2->getMeshDimension());
+ CPPUNIT_ASSERT_EQUAL(1,m2->getSpaceDimension());
+ for(int i=0;i<3;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(f1->getIJ(i,0),f2->getIJ(i,0),1e-10);
+ da=DataArrayDouble::New();
+ da->alloc(3,1);
+ std::copy(discY,discY+3,da->getPointer());
+ m->setCoordsAt(1,da);
+ da->decrRef();
+ m2->decrRef();
+ f1->decrRef();
+ f2->decrRef();
+ //
+ m2=m->buildUnstructured();
+ m2->checkCoherency();
+ f1=m->getMeasureField(false);
+ f2=m2->getMeasureField(false);
+ CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),6);
+ CPPUNIT_ASSERT_EQUAL(f2->getNumberOfTuples(),6);
+ CPPUNIT_ASSERT_EQUAL(2,m2->getMeshDimension());
+ CPPUNIT_ASSERT_EQUAL(2,m2->getSpaceDimension());
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(f1->getIJ(i,0),f2->getIJ(i,0),1e-10);
+ f1->decrRef();
+ f2->decrRef();
+ m2->decrRef();
+ //
+ da=DataArrayDouble::New();
+ da->alloc(5,1);
+ std::copy(discZ,discZ+5,da->getPointer());
+ m->setCoordsAt(2,da);
+ da->decrRef();
+ m2=m->buildUnstructured();
+ m2->checkCoherency();
+ f1=m->getMeasureField(false);
+ f2=m2->getMeasureField(false);
+ CPPUNIT_ASSERT_EQUAL(f1->getNumberOfTuples(),24);
+ CPPUNIT_ASSERT_EQUAL(f2->getNumberOfTuples(),24);
+ CPPUNIT_ASSERT_EQUAL(3,m2->getMeshDimension());
+ CPPUNIT_ASSERT_EQUAL(3,m2->getSpaceDimension());
+ for(int i=0;i<24;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(f1->getIJ(i,0),f2->getIJ(i,0),1e-10);
+ f1->decrRef();
+ f2->decrRef();
+ //
+ double pos1[3]={5.,30.,2.};
+ CPPUNIT_ASSERT_EQUAL(16,m->getCellContainingPoint(pos1,1e-12));
+ //
+ const double pt[3]={2.4,12.7,-3.4};
+ m->scale(pt,3.7);
+ MEDCouplingUMesh *m3=m->buildUnstructured();
+ m2->scale(pt,3.7);
+ CPPUNIT_ASSERT(m3->isEqual(m2,1e-12));
+ m2->decrRef();
+ m3->decrRef();
+ //
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDataArrayIntInvertO2NNO21()
+{
+ const int arr1[6]={2,0,4,1,5,3};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(6,1);
+ std::copy(arr1,arr1+6,da->getPointer());
+ DataArrayInt *da2=da->invertArrayO2N2N2O(6);
+ CPPUNIT_ASSERT_EQUAL(6,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ const int expected1[6]={1,3,0,5,2,4};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0));
+ DataArrayInt *da3=da2->invertArrayN2O2O2N(6);
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(arr1[i],da3->getIJ(i,0));
+ da3->decrRef();
+ da2->decrRef();
+ da->decrRef();
+ //
+ const int arr2[10]={3,-1,5,4,-1,0,-1,1,2,-1};
+ da=DataArrayInt::New();
+ da->alloc(10,1);
+ std::copy(arr2,arr2+10,da->getPointer());
+ da2=da->invertArrayO2N2N2O(6);
+ CPPUNIT_ASSERT_EQUAL(6,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ const int expected2[10]={5,7,8,0,3,2};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],da2->getIJ(i,0));
+ da3=da2->invertArrayN2O2O2N(10);
+ for(int i=0;i<10;i++)
+ CPPUNIT_ASSERT_EQUAL(arr2[i],da3->getIJ(i,0));
+ da3->decrRef();
+ da2->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testKeepSetSelectedComponent1()
+{
+ const double arr1[20]={1.,2.,3.,4., 11.,12.,13.,14., 21.,22.,23.,24., 31.,32.,33.,34., 41.,42.,43.,44.};
+ DataArrayDouble *a1=DataArrayDouble::New();
+ a1->alloc(5,4);
+ std::copy(arr1,arr1+20,a1->getPointer());
+ a1->setInfoOnComponent(0,"aaaa");
+ a1->setInfoOnComponent(1,"bbbb");
+ a1->setInfoOnComponent(2,"cccc");
+ a1->setInfoOnComponent(3,"dddd");
+ const int arr2[6]={1,2,1,2,0,0};
+ std::vector<int> arr2V(arr2,arr2+6);
+ DataArrayDouble *a2=a1->keepSelectedComponents(arr2V);
+ CPPUNIT_ASSERT_EQUAL(6,a2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,a2->getNumberOfTuples());
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(0))=="bbbb");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(1))=="cccc");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(2))=="bbbb");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(3))=="cccc");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(4))=="aaaa");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(5))=="aaaa");
+ const double expected1[30]={2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.};
+ for(int i=0;i<30;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a2->getIJ(0,i),1e-14);
+ DataArrayInt *a3=a1->convertToIntArr();
+ DataArrayInt *a4=a3->keepSelectedComponents(arr2V);
+ CPPUNIT_ASSERT_EQUAL(6,a4->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,a4->getNumberOfTuples());
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(1))=="cccc");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(2))=="bbbb");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(3))=="cccc");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa");
+ for(int i=0;i<30;i++)
+ CPPUNIT_ASSERT_EQUAL(int(expected1[i]),a4->getIJ(0,i));
+ // setSelectedComponents
+ const int arr3[2]={3,2};
+ std::vector<int> arr3V(arr3,arr3+2);
+ DataArrayDouble *a5=a1->keepSelectedComponents(arr3V);
+ a5->setInfoOnComponent(0,"eeee");
+ a5->setInfoOnComponent(1,"ffff");
+ const int arr4[2]={1,2};
+ std::vector<int> arr4V(arr4,arr4+2);
+ a2->setSelectedComponents(a5,arr4V);
+ CPPUNIT_ASSERT_EQUAL(6,a2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,a2->getNumberOfTuples());
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(0))=="bbbb");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(1))=="eeee");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(2))=="ffff");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(3))=="cccc");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(4))=="aaaa");
+ CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(5))=="aaaa");
+ const double expected2[30]={2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.};
+ for(int i=0;i<30;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],a2->getIJ(0,i),1e-14);
+ DataArrayInt *a6=a5->convertToIntArr();
+ a6->setInfoOnComponent(0,"eeee");
+ a6->setInfoOnComponent(1,"ffff");
+ a4->setSelectedComponents(a6,arr4V);
+ CPPUNIT_ASSERT_EQUAL(6,a4->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,a4->getNumberOfTuples());
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(1))=="eeee");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(2))=="ffff");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(3))=="cccc");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa");
+ CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa");
+ for(int i=0;i<30;i++)
+ CPPUNIT_ASSERT_EQUAL(int(expected2[i]),a4->getIJ(0,i));
+ // test of throw
+ const int arr5[3]={2,3,6};
+ const int arr6[3]={2,7,5};
+ const int arr7[4]={2,1,4,6};
+ std::vector<int> arr5V(arr5,arr5+3);
+ std::vector<int> arr6V(arr6,arr6+3);
+ std::vector<int> arr7V(arr7,arr7+4);
+ CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr5V),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr6V),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(a2->setSelectedComponents(a1,arr7V),INTERP_KERNEL::Exception);
+ arr7V.resize(3);
+ CPPUNIT_ASSERT_THROW(a2->setSelectedComponents(a1,arr7V),INTERP_KERNEL::Exception);
+ //
+ a6->decrRef();
+ a5->decrRef();
+ a4->decrRef();
+ a3->decrRef();
+ a2->decrRef();
+ a1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testKeepSetSelectedComponent2()
+{
+ MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ const double arr1[20]={1.,2.,3.,4., 11.,12.,13.,14., 21.,22.,23.,24., 31.,32.,33.,34., 41.,42.,43.,44.};
+ DataArrayDouble *a1=DataArrayDouble::New();
+ a1->alloc(5,4);
+ std::copy(arr1,arr1+20,a1->getPointer());
+ a1->setInfoOnComponent(0,"aaaa");
+ a1->setInfoOnComponent(1,"bbbb");
+ a1->setInfoOnComponent(2,"cccc");
+ a1->setInfoOnComponent(3,"dddd");
+ MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f1->setTime(2.3,4,5);
+ f1->setMesh(m1);
+ f1->setName("f1");
+ f1->setArray(a1);
+ f1->checkCoherency();
+ //
+ const int arr2[6]={1,2,1,2,0,0};
+ std::vector<int> arr2V(arr2,arr2+6);
+ MEDCouplingFieldDouble *f2=f1->keepSelectedComponents(arr2V);
+ CPPUNIT_ASSERT(f2->getMesh()==f1->getMesh());
+ CPPUNIT_ASSERT(f2->getTimeDiscretization()==ONE_TIME);
+ int dt,it;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2.3,f2->getTime(dt,it),1e-13);
+ CPPUNIT_ASSERT_EQUAL(4,dt);
+ CPPUNIT_ASSERT_EQUAL(5,it);
+ f2->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(0))=="bbbb");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(1))=="cccc");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(2))=="bbbb");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(3))=="cccc");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(4))=="aaaa");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(5))=="aaaa");
+ const double expected1[30]={2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.};
+ for(int i=0;i<30;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f2->getIJ(0,i),1e-14);
+ //setSelectedComponents
+ const int arr3[2]={3,2};
+ std::vector<int> arr3V(arr3,arr3+2);
+ MEDCouplingFieldDouble *f5=f1->keepSelectedComponents(arr3V);
+ f5->setTime(6.7,8,9);
+ f5->getArray()->setInfoOnComponent(0,"eeee");
+ f5->getArray()->setInfoOnComponent(1,"ffff");
+ f5->checkCoherency();
+ const int arr4[2]={1,2};
+ std::vector<int> arr4V(arr4,arr4+2);
+ f2->setSelectedComponents(f5,arr4V);
+ CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+ f2->checkCoherency();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2.3,f2->getTime(dt,it),1e-13);
+ CPPUNIT_ASSERT_EQUAL(4,dt);
+ CPPUNIT_ASSERT_EQUAL(5,it);
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(0))=="bbbb");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(1))=="eeee");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(2))=="ffff");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(3))=="cccc");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(4))=="aaaa");
+ CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(5))=="aaaa");
+ const double expected2[30]={2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.};
+ for(int i=0;i<30;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f2->getIJ(0,i),1e-14);
+ f5->decrRef();
+ f1->decrRef();
+ f2->decrRef();
+ a1->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIGetIdsEqual1()
+{
+ const int tab1[7]={5,-2,-4,-2,3,2,-2};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(7,1);
+ std::copy(tab1,tab1+7,da->getPointer());
+ DataArrayInt *da2=da->getIdsEqual(-2);
+ CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ const int expected1[3]={1,3,6};
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+3,da2->getConstPointer()));
+ da2->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIGetIdsEqualList1()
+{
+ const int tab1[7]={5,-2,-4,-2,3,2,-2};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(7,1);
+ std::copy(tab1,tab1+7,da->getPointer());
+ const int tab2[3]={3,-2,0};
+ std::vector<int> tab2V(tab2,tab2+3);
+ DataArrayInt *da2=da->getIdsEqualList(tab2V);
+ CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ const int expected1[4]={1,3,4,6};
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+4,da2->getConstPointer()));
+ da2->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAFromNoInterlace1()
+{
+ const int tab1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(5,3);
+ std::copy(tab1,tab1+15,da->getPointer());
+ DataArrayInt *da2=da->fromNoInterlace();
+ const int expected1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43};
+ CPPUNIT_ASSERT_EQUAL(5,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer()));
+ DataArrayDouble *da3=da->convertToDblArr();
+ DataArrayDouble *da4=da3->fromNoInterlace();
+ CPPUNIT_ASSERT_EQUAL(5,da4->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da4->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
+ for(int i=0;i<15;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL((double)expected1[i],da4->getIJ(0,i),1e-14);
+ da4->decrRef();
+ da3->decrRef();
+ da2->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAToNoInterlace1()
+{
+ const int tab1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(5,3);
+ std::copy(tab1,tab1+15,da->getPointer());
+ DataArrayInt *da2=da->toNoInterlace();
+ const int expected1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43};
+ CPPUNIT_ASSERT_EQUAL(5,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer()));
+ DataArrayDouble *da3=da->convertToDblArr();
+ DataArrayDouble *da4=da3->toNoInterlace();
+ CPPUNIT_ASSERT_EQUAL(5,da4->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da4->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components !
+ for(int i=0;i<15;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL((double)expected1[i],da4->getIJ(0,i),1e-14);
+ da4->decrRef();
+ da3->decrRef();
+ da2->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIsUniform1()
+{
+ const int tab1[5]={1,1,1,1,1};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(5,1);
+ std::copy(tab1,tab1+5,da->getPointer());
+ CPPUNIT_ASSERT(da->isUniform(1));
+ da->setIJ(2,0,2);
+ CPPUNIT_ASSERT(!da->isUniform(1));
+ da->setIJ(2,0,1);
+ CPPUNIT_ASSERT(da->isUniform(1));
+ DataArrayDouble *da2=da->convertToDblArr();
+ CPPUNIT_ASSERT(da2->isUniform(1.,1e-12));
+ da2->setIJ(1,0,1.+1.e-13);
+ CPPUNIT_ASSERT(da2->isUniform(1.,1e-12));
+ da2->setIJ(1,0,1.+1.e-11);
+ CPPUNIT_ASSERT(!da2->isUniform(1.,1e-12));
+ da2->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDADFromPolarToCart1()
+{
+ const double tab1[4]={2.,0.2,2.5,0.7};
+ DataArrayDouble *da=DataArrayDouble::New();
+ da->alloc(2,2);
+ std::copy(tab1,tab1+4,da->getPointer());
+ DataArrayDouble *da2=da->fromPolarToCart();
+ const double expected1[4]={1.9601331556824833,0.39733866159012243, 1.9121054682112213,1.6105442180942275};
+ for(int i=0;i<4;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da2->getIJ(0,i),1e-13);
+ da2->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDADFromCylToCart1()
+{
+ const double tab1[6]={2.,0.2,4.,2.5,0.7,9.};
+ DataArrayDouble *da=DataArrayDouble::New();
+ da->alloc(2,3);
+ std::copy(tab1,tab1+6,da->getPointer());
+ DataArrayDouble *da2=da->fromCylToCart();
+ const double expected1[6]={1.9601331556824833,0.39733866159012243,4., 1.9121054682112213,1.6105442180942275,9.};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da2->getIJ(0,i),1e-13);
+ da2->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDADFromSpherToCart1()
+{
+ const double tab1[6]={2.,0.2,0.3,2.5,0.7,0.8};
+ DataArrayDouble *da=DataArrayDouble::New();
+ da->alloc(2,3);
+ std::copy(tab1,tab1+6,da->getPointer());
+ DataArrayDouble *da2=da->fromSpherToCart();
+ const double expected1[6]={0.37959212195737485,0.11742160338765303,1.9601331556824833, 1.1220769624465328,1.1553337045129035,1.9121054682112213};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da2->getIJ(0,i),1e-13);
+ da2->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUnPolyze1()
+{
+ const int elts[8]={0,1,2,3,4,5,6,7};
+ std::vector<int> eltsV(elts,elts+8);
+ MEDCouplingUMesh *mesh=build3DTargetMesh_1();
+ mesh->convertToPolyTypes(eltsV);
+ mesh->unPolyze();
+ MEDCouplingUMesh *mesh2=build3DTargetMesh_1();
+ mesh->checkCoherency();
+ CPPUNIT_ASSERT(mesh->isEqual(mesh2,1e-12));
+ mesh->convertToPolyTypes(eltsV);
+ CPPUNIT_ASSERT(!mesh->isEqual(mesh2,1e-12));
+ mesh->getNodalConnectivity()->setIJ(0,6,10);
+ mesh->getNodalConnectivity()->setIJ(0,7,9);
+ mesh->getNodalConnectivity()->setIJ(0,8,12);
+ mesh->getNodalConnectivity()->setIJ(0,9,13);
+ mesh->unPolyze();
+ CPPUNIT_ASSERT(mesh->isEqual(mesh2,1e-12));
+ mesh->convertToPolyTypes(eltsV);
+ mesh->getNodalConnectivity()->setIJ(0,6,12);
+ mesh->getNodalConnectivity()->setIJ(0,7,13);
+ mesh->getNodalConnectivity()->setIJ(0,8,10);
+ mesh->getNodalConnectivity()->setIJ(0,9,9);
+ mesh->unPolyze();
+ CPPUNIT_ASSERT(mesh->isEqual(mesh2,1e-12));
+ mesh->convertToPolyTypes(eltsV);
+ mesh->getNodalConnectivity()->setIJ(0,6,12);
+ mesh->getNodalConnectivity()->setIJ(0,7,10);
+ mesh->getNodalConnectivity()->setIJ(0,8,13);
+ mesh->getNodalConnectivity()->setIJ(0,9,9);
+ mesh->unPolyze();
+ CPPUNIT_ASSERT(!mesh->isEqual(mesh2,1e-12));
+ mesh->decrRef();
+ mesh2->decrRef();
+ // Test for 2D mesh
+ mesh=build2DTargetMesh_1();
+ mesh2=build2DTargetMesh_1();
+ eltsV.resize(5);
+ mesh->convertToPolyTypes(eltsV);
+ CPPUNIT_ASSERT(!mesh->isEqual(mesh2,1e-12));
+ mesh->unPolyze();
+ CPPUNIT_ASSERT(mesh->isEqual(mesh2,1e-12));
+ mesh->decrRef();
+ mesh2->decrRef();
+}
+
+void MEDCouplingBasicsTest::testConvertDegeneratedCells1()
+{
+ MEDCouplingUMesh *mesh=build3DTargetMesh_1();
+ int conn[32]={0,1,3,3,9,10,12,12, 0,1,3,4,9,9,9,9, 1,1,1,1,10,12,9,10, 10,11,12,9,1,1,1,1};
+ mesh->allocateCells(4);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+8);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+16);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+24);
+ mesh->finishInsertingCells();
+ mesh->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(4,mesh->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(0));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(1));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(2));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh->getTypeOfCell(3));
+ MEDCouplingFieldDouble *f1=mesh->getMeasureField(true);
+ mesh->convertDegeneratedCells();
+ mesh->checkCoherency();
+ MEDCouplingFieldDouble *f2=mesh->getMeasureField(true);
+ CPPUNIT_ASSERT_EQUAL(4,mesh->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_PENTA6,mesh->getTypeOfCell(0));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_PYRA5,mesh->getTypeOfCell(1));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TETRA4,mesh->getTypeOfCell(2));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_PYRA5,mesh->getTypeOfCell(3));
+ for(int i=0;i<4;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(f1->getArray()->getIJ(0,i),f2->getArray()->getIJ(0,i),1e-5);
+ f1->decrRef();
+ f2->decrRef();
+ mesh->decrRef();
+}
+
+void MEDCouplingBasicsTest::testGetNodeIdsNearPoints1()
+{
+ MEDCouplingUMesh *mesh=build2DTargetMesh_1();
+ DataArrayDouble *coords=mesh->getCoords();
+ DataArrayDouble *tmp=DataArrayDouble::New();
+ tmp->alloc(3,2);
+ const double vals[6]={0.2,0.2,0.1,0.2,0.2,0.2};
+ std::copy(vals,vals+6,tmp->getPointer());
+ DataArrayDouble *tmp2=DataArrayDouble::Aggregate(coords,tmp);
+ tmp->decrRef();
+ mesh->setCoords(tmp2);
+ tmp2->decrRef();
+ const double pts[6]={0.2,0.2,0.1,0.3,-0.3,0.7};
+ std::vector<int> c=mesh->getNodeIdsNearPoint(pts,1e-7);
+ CPPUNIT_ASSERT_EQUAL(3,(int)c.size());
+ CPPUNIT_ASSERT_EQUAL(4,c[0]);
+ CPPUNIT_ASSERT_EQUAL(9,c[1]);
+ CPPUNIT_ASSERT_EQUAL(11,c[2]);
+ c.clear();
+ std::vector<int> cI;
+ mesh->getNodeIdsNearPoints(pts,3,1e-7,c,cI);
+ CPPUNIT_ASSERT_EQUAL(4,(int)cI.size());
+ CPPUNIT_ASSERT_EQUAL(4,(int)c.size());
+ CPPUNIT_ASSERT_EQUAL(4,c[0]);
+ CPPUNIT_ASSERT_EQUAL(9,c[1]);
+ CPPUNIT_ASSERT_EQUAL(11,c[2]);
+ CPPUNIT_ASSERT_EQUAL(6,c[3]);
+ CPPUNIT_ASSERT_EQUAL(0,cI[0]);
+ CPPUNIT_ASSERT_EQUAL(3,cI[1]);
+ CPPUNIT_ASSERT_EQUAL(3,cI[2]);
+ CPPUNIT_ASSERT_EQUAL(4,cI[3]);
+ mesh->decrRef();
+}
+
+void MEDCouplingBasicsTest::testFieldCopyTinyAttrFrom1()
+{
+ MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f1->setName("f1");
+ f1->setTimeTolerance(1.e-5);
+ f1->setDescription("f1Desc");
+ f1->setTime(1.23,4,5);
+ MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f2->setName("f2");
+ f2->setDescription("f2Desc");
+ f2->setTime(6.78,9,10);
+ f2->setTimeTolerance(4.556e-12);
+ //
+ int dt,it;
+ f1->copyTinyAttrFrom(f2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4.556e-12,f1->getTimeTolerance(),1e-24);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6.78,f1->getTime(dt,it),1e-12);
+ CPPUNIT_ASSERT_EQUAL(9,dt);
+ CPPUNIT_ASSERT_EQUAL(10,it);
+ CPPUNIT_ASSERT(std::string(f1->getName())=="f1");//name unchanged
+ CPPUNIT_ASSERT(std::string(f1->getDescription())=="f1Desc");//description unchanged
+ f1->decrRef();
+ f2->decrRef();
+ //
+ f1=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
+ f1->setName("f1");
+ f1->setTimeTolerance(1.e-5);
+ f1->setDescription("f1Desc");
+ f2=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
+ f2->setName("f2");
+ f2->setDescription("f2Desc");
+ f2->setTimeTolerance(4.556e-12);
+ //
+ f1->copyTinyAttrFrom(f2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4.556e-12,f1->getTimeTolerance(),1e-24);
+ CPPUNIT_ASSERT(std::string(f1->getName())=="f1");//name unchanged
+ CPPUNIT_ASSERT(std::string(f1->getDescription())=="f1Desc");//description unchanged
+ f1->decrRef();
+ f2->decrRef();
+ //
+ f1=MEDCouplingFieldDouble::New(ON_CELLS,CONST_ON_TIME_INTERVAL);
+ f1->setName("f1");
+ f1->setTimeTolerance(1.e-5);
+ f1->setDescription("f1Desc");
+ f1->setTime(1.23,4,5);
+ f1->setEndTime(5.43,2,1);
+ f2=MEDCouplingFieldDouble::New(ON_CELLS,CONST_ON_TIME_INTERVAL);
+ f2->setName("f2");
+ f2->setDescription("f2Desc");
+ f2->setTimeTolerance(4.556e-12);
+ f2->setTime(6.78,9,10);
+ f2->setEndTime(10.98,7,6);
+ //
+ f1->copyTinyAttrFrom(f2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4.556e-12,f1->getTimeTolerance(),1e-24);
+ CPPUNIT_ASSERT(std::string(f1->getName())=="f1");//name unchanged
+ CPPUNIT_ASSERT(std::string(f1->getDescription())=="f1Desc");//description unchanged
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6.78,f1->getTime(dt,it),1e-12);
+ CPPUNIT_ASSERT_EQUAL(9,dt);
+ CPPUNIT_ASSERT_EQUAL(10,it);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(10.98,f1->getEndTime(dt,it),1e-12);
+ CPPUNIT_ASSERT_EQUAL(7,dt);
+ CPPUNIT_ASSERT_EQUAL(6,it);
+ f1->decrRef();
+ f2->decrRef();
+ //
+ f1=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
+ f1->setName("f1");
+ f1->setTimeTolerance(1.e-5);
+ f1->setDescription("f1Desc");
+ f1->setTime(1.23,4,5);
+ f1->setEndTime(5.43,2,1);
+ f2=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME);
+ f2->setName("f2");
+ f2->setDescription("f2Desc");
+ f2->setTimeTolerance(4.556e-12);
+ f2->setTime(6.78,9,10);
+ f2->setEndTime(10.98,7,6);
+ //
+ f1->copyTinyAttrFrom(f2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4.556e-12,f1->getTimeTolerance(),1e-24);
+ CPPUNIT_ASSERT(std::string(f1->getName())=="f1");//name unchanged
+ CPPUNIT_ASSERT(std::string(f1->getDescription())=="f1Desc");//description unchanged
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6.78,f1->getTime(dt,it),1e-12);
+ CPPUNIT_ASSERT_EQUAL(9,dt);
+ CPPUNIT_ASSERT_EQUAL(10,it);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(10.98,f1->getEndTime(dt,it),1e-12);
+ CPPUNIT_ASSERT_EQUAL(7,dt);
+ CPPUNIT_ASSERT_EQUAL(6,it);
+ f1->decrRef();
+ f2->decrRef();
+}
+
+/*!
+ * 1D -> 2D extrusion with rotation
+ */
+void MEDCouplingBasicsTest::testExtrudedMesh5()
+{
+ const double coo1[4]={0.,1.,2.,3.5};
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(4,1);
+ std::copy(coo1,coo1+4,a->getPointer());
+ MEDCouplingCMesh *b=MEDCouplingCMesh::New();
+ b->setCoordsAt(0,a);
+ MEDCouplingUMesh *c=b->buildUnstructured();
+ CPPUNIT_ASSERT_EQUAL(1,c->getSpaceDimension());
+ c->changeSpaceDimension(2);
+ //
+ DataArrayDouble *d=DataArrayDouble::New();
+ d->alloc(13,1);
+ d->iota();
+ MEDCouplingCMesh *e=MEDCouplingCMesh::New();
+ e->setCoordsAt(0,d);
+ MEDCouplingUMesh *f=e->buildUnstructured();
+ DataArrayDouble *g=f->getCoords()->applyFunc(2,"3.5*IVec+x/6*3.14159265359*JVec");
+ DataArrayDouble *h=g->fromPolarToCart();
+ f->setCoords(h);
+ MEDCouplingUMesh *i=c->buildExtrudedMesh(f,1);
+ CPPUNIT_ASSERT_EQUAL(52,i->getNumberOfNodes());
+ bool tmp2;
+ int tmp3;
+ DataArrayInt *tmp=i->mergeNodes(1e-9,tmp2,tmp3);
+ CPPUNIT_ASSERT(tmp2);
+ CPPUNIT_ASSERT_EQUAL(37,tmp3);
+ tmp->decrRef();
+ i->convertDegeneratedCells();
+ i->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(36,i->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(37,i->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(12,i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI3));
+ CPPUNIT_ASSERT_EQUAL(24,i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4));
+ const double expected1[3]={0.25,0.75,2.0625};
+ MEDCouplingFieldDouble *j=i->getMeasureField(true);
+ for(int i=0;i<12;i++)
+ for(int k=0;k<3;k++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[k],j->getIJ(0,i*3+k),1e-10);
+ const double expected2[72]={0.62200846792814113, 0.16666666666681595, 1.4513530918323276, 0.38888888888923495, 2.6293994326053212, 0.7045454545460802, 0.45534180126145435, 0.45534180126150181, 1.0624642029433926, 1.0624642029435025, 1.9248539780597826, 1.9248539780599816, 0.16666666666661334, 0.62200846792815856, 0.38888888888876294, 1.4513530918323678, 0.70454545454522521, 2.629399432605394, -0.16666666666674007, 0.62200846792812436, -0.38888888888906142, 1.4513530918322881, -0.70454545454576778, 2.6293994326052488, -0.45534180126154766, 0.45534180126140844, -1.0624642029436118, 1.0624642029432834, -1.9248539780601803, 1.9248539780595841, -0.62200846792817499, 0.1666666666665495, -1.451353091832408, 0.388888888888613, -2.6293994326054668, 0.70454545454495332, -0.62200846792810593, -0.16666666666680507, -1.451353091832247, -0.38888888888921297, -2.6293994326051746, -0.70454545454604123, -0.45534180126135926, -0.45534180126159562, -1.0624642029431723, -1.0624642029437235, -1.9248539780593836, -1.9248539780603811, -0.1666666666664828, -0.62200846792819242, -0.38888888888846079, -1.4513530918324489, -0.70454545454467987, -2.6293994326055397, 0.16666666666687083, -0.62200846792808862, 0.38888888888936374, -1.4513530918322073, 0.70454545454631357, -2.6293994326051022, 0.45534180126164348, -0.45534180126131207, 1.0624642029438327, -1.0624642029430627, 1.9248539780605791, -1.9248539780591853, 0.62200846792821063, -0.16666666666641802, 1.4513530918324888, -0.38888888888831086, 2.6293994326056125, -0.70454545454440853};
+ DataArrayDouble *m=i->getBarycenterAndOwner();
+ for(int i=0;i<72;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m->getIJ(0,i),1e-10);
+ //
+ m->decrRef();
+ j->decrRef();
+ i->decrRef();
+ h->decrRef();
+ g->decrRef();
+ f->decrRef();
+ e->decrRef();
+ d->decrRef();
+ c->decrRef();
+ b->decrRef();
+ a->decrRef();
+}
+
+/*!
+ * 1D -> 2D extrusion without rotation
+ */
+void MEDCouplingBasicsTest::testExtrudedMesh6()
+{
+ const double coo1[4]={0.,1.,2.,3.5};
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(4,1);
+ std::copy(coo1,coo1+4,a->getPointer());
+ MEDCouplingCMesh *b=MEDCouplingCMesh::New();
+ b->setCoordsAt(0,a);
+ MEDCouplingUMesh *c=b->buildUnstructured();
+ CPPUNIT_ASSERT_EQUAL(1,c->getSpaceDimension());
+ c->changeSpaceDimension(2);
+ //
+ DataArrayDouble *d=DataArrayDouble::New();
+ d->alloc(5,1);
+ d->iota();
+ MEDCouplingCMesh *e=MEDCouplingCMesh::New();
+ e->setCoordsAt(0,d);
+ MEDCouplingUMesh *f=e->buildUnstructured();
+ DataArrayDouble *d2=f->getCoords()->applyFunc("x*x/2");
+ f->setCoords(d2);
+ f->changeSpaceDimension(2);
+ //
+ const double center[2]={0.,0.};
+ f->rotate(center,0,M_PI/3);
+ MEDCouplingUMesh *g=c->buildExtrudedMesh(f,0);
+ g->checkCoherency();
+ const double expected1[]={ 0.4330127018922193, 0.4330127018922193, 0.649519052838329, 1.2990381056766578, 1.299038105676658, 1.948557158514987, 2.1650635094610955, 2.1650635094610964, 3.2475952641916446, 3.031088913245533, 3.0310889132455352, 4.546633369868303 };
+ MEDCouplingFieldDouble *f1=g->getMeasureField(true);
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-12);
+
+ const double expected2[]={0.625, 0.21650635094610962, 1.625, 0.21650635094610959, 2.8750000000000004, 0.21650635094610965, 1.1250000000000002, 1.0825317547305482, 2.125, 1.0825317547305482, 3.3750000000000004, 1.0825317547305484, 2.125, 2.8145825622994254, 3.125, 2.8145825622994254, 4.375, 2.8145825622994254, 3.6250000000000009, 5.4126587736527414, 4.625, 5.4126587736527414, 5.875, 5.4126587736527414};
+ DataArrayDouble *f2=g->getBarycenterAndOwner();
+ for(int i=0;i<24;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f2->getIJ(0,i),1e-12);
+ //
+ f1->decrRef();
+ f2->decrRef();
+ g->decrRef();
+ f->decrRef();
+ e->decrRef();
+ d->decrRef();
+ d2->decrRef();
+ c->decrRef();
+ b->decrRef();
+ a->decrRef();
+}
+
+/*!
+ * 2D -> 3D extrusion with rotation
+ */
+void MEDCouplingBasicsTest::testExtrudedMesh7()
+{
+ const double coo1[4]={0.,1.,2.,3.5};
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(4,1);
+ std::copy(coo1,coo1+4,a->getPointer());
+ MEDCouplingCMesh *b=MEDCouplingCMesh::New();
+ b->setCoordsAt(0,a);
+ MEDCouplingUMesh *c=b->buildUnstructured();
+ CPPUNIT_ASSERT_EQUAL(1,c->getSpaceDimension());
+ c->changeSpaceDimension(2);
+ //
+ DataArrayDouble *d=DataArrayDouble::New();
+ d->alloc(13,1);
+ d->iota();
+ MEDCouplingCMesh *e=MEDCouplingCMesh::New();
+ e->setCoordsAt(0,d);
+ MEDCouplingUMesh *f=e->buildUnstructured();
+ DataArrayDouble *g=f->getCoords()->applyFunc(2,"3.5*IVec+x/6*3.14159265359*JVec");
+ DataArrayDouble *h=g->fromPolarToCart();
+ f->setCoords(h);
+ MEDCouplingUMesh *i=c->buildExtrudedMesh(f,1);
+ CPPUNIT_ASSERT_EQUAL(52,i->getNumberOfNodes());
+ bool tmp2;
+ int tmp3;
+ DataArrayInt *tmp=i->mergeNodes(1e-9,tmp2,tmp3);
+ CPPUNIT_ASSERT(tmp2);
+ CPPUNIT_ASSERT_EQUAL(37,tmp3);
+ tmp->decrRef();
+ i->convertDegeneratedCells();
+ const double vec1[3]={10.,0.,0.};
+ i->translate(vec1);
+ DataArrayDouble *g2=h->applyFunc(3,"13.5/3.5*x*IVec+0*JVec+13.5/3.5*y*KVec");
+ f->setCoords(g2);
+ i->changeSpaceDimension(3);
+ MEDCouplingUMesh *i3=i->buildExtrudedMesh(f,1);
+ MEDCouplingFieldDouble *f2=i3->getMeasureField(true);
+ tmp=i->mergeNodes(1e-9,tmp2,tmp3);
+ CPPUNIT_ASSERT(tmp2);
+ CPPUNIT_ASSERT_EQUAL(444,tmp3);
+ tmp->decrRef();
+ const double expected1[36]={1.327751058489274, 4.2942574094314701, 13.024068164857139, 1.3069177251569044, 4.1484240761012954, 12.297505664866796, 1.270833333332571, 3.8958333333309674, 11.039062499993179, 1.2291666666659207, 3.6041666666644425, 9.585937499993932, 1.1930822748415895, 3.3515759238941376, 8.3274943351204556, 1.1722489415082769, 3.2057425905609289, 7.6009318351210622, 1.1722489415082862, 3.2057425905609884, 7.6009318351213713, 1.1930822748416161, 3.3515759238943001, 8.3274943351212727, 1.2291666666659564, 3.6041666666646734, 9.5859374999950777, 1.2708333333326081, 3.8958333333311868, 11.039062499994293, 1.3069177251569224, 4.1484240761014384, 12.297505664867627, 1.3277510584902354, 4.2942574094346071, 13.024068164866796};
+ int kk=0;
+ for(int ii=0;ii<12;ii++)
+ for(int jj=0;jj<36;jj++,kk++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[jj],f2->getIJ(0,kk),1e-9);
+ //
+ f2->decrRef();
+ i3->decrRef();
+ g2->decrRef();
+ i->decrRef();
+ h->decrRef();
+ g->decrRef();
+ f->decrRef();
+ e->decrRef();
+ d->decrRef();
+ c->decrRef();
+ b->decrRef();
+ a->decrRef();
+}
+
+void MEDCouplingBasicsTest::testSimplexize1()
+{
+ MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
+ std::vector<int> v(1);
+ v[0]=3;
+ m->convertToPolyTypes(v);
+ DataArrayInt *da=m->simplexize(0);
+ CPPUNIT_ASSERT_EQUAL(7,da->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfComponents());
+ const int expected2[7]={0,0,1,2,3,4,4};
+ for(int i=0;i<7;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],da->getIJ(i,0));
+ m->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(7,m->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(0));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(1));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(2));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(3));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,m->getTypeOfCell(4));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(5));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(6));
+ const double expected1[7]={0.125,0.125,0.125,0.125,0.25,0.125,0.125};
+ MEDCouplingFieldDouble *f=m->getMeasureField(false);
+ for(int i=0;i<7;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i]*sqrt(2.),f->getIJ(i,0),1e-10);
+ std::set<INTERP_KERNEL::NormalizedCellType> types=m->getAllTypes();
+ CPPUNIT_ASSERT_EQUAL(2,(int)types.size());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*(types.begin()));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,*(++(types.begin())));
+ f->decrRef();
+ da->decrRef();
+ m->decrRef();
+ //
+ m=build3DSurfTargetMesh_1();
+ v[0]=3;
+ m->convertToPolyTypes(v);
+ da=m->simplexize(1);
+ CPPUNIT_ASSERT_EQUAL(7,da->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfComponents());
+ for(int i=0;i<7;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],da->getIJ(i,0));
+ m->checkCoherency();
+ types=m->getAllTypes();
+ CPPUNIT_ASSERT_EQUAL(2,(int)types.size());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*(types.begin()));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,*(++(types.begin())));
+ CPPUNIT_ASSERT_EQUAL(7,m->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(0));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(1));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(2));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(3));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POLYGON,m->getTypeOfCell(4));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(5));
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(6));
+ f=m->getMeasureField(false);
+ for(int i=0;i<7;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i]*sqrt(2.),f->getIJ(i,0),1e-10);
+ f->decrRef();
+ da->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testSimplexize2()
+{
+ MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
+ std::vector<int> v(1);
+ v[0]=3;
+ m->convertToPolyTypes(v);
+ MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f1->setMesh(m);
+ DataArrayDouble *arr=DataArrayDouble::New();
+ const double arr1[10]={10.,110.,20.,120.,30.,130.,40.,140.,50.,150.};
+ arr->alloc(5,2);
+ std::copy(arr1,arr1+10,arr->getPointer());
+ f1->setArray(arr);
+ arr->decrRef();
+ //
+ f1->checkCoherency();
+ CPPUNIT_ASSERT(f1->simplexize(0));
+ f1->checkCoherency();
+ const double expected1[14]={10.,110.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.,50.,150.};
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-10);
+ CPPUNIT_ASSERT(!f1->simplexize(0));
+ for(int i=0;i<14;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getIJ(0,i),1e-10);
+ //
+ f1->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAMeld1()
+{
+ DataArrayDouble *da1=DataArrayDouble::New();
+ da1->alloc(7,2);
+ DataArrayDouble *da2=DataArrayDouble::New();
+ da2->alloc(7,1);
+ //
+ da1->fillWithValue(7.);
+ da2->iota(0.);
+ DataArrayDouble *da3=da2->applyFunc(3,"10*x*IVec+100*x*JVec+1000*x*KVec");
+ //
+ da1->setInfoOnComponent(0,"c0da1");
+ da1->setInfoOnComponent(1,"c1da1");
+ da3->setInfoOnComponent(0,"c0da3");
+ da3->setInfoOnComponent(1,"c1da3");
+ da3->setInfoOnComponent(2,"c2da3");
+ //
+ DataArrayDouble *da1C=da1->deepCpy();
+ da1->meldWith(da3);
+ CPPUNIT_ASSERT_EQUAL(5,da1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(7,da1->getNumberOfTuples());
+ CPPUNIT_ASSERT(da1->getInfoOnComponent(0)=="c0da1");
+ CPPUNIT_ASSERT(da1->getInfoOnComponent(1)=="c1da1");
+ CPPUNIT_ASSERT(da1->getInfoOnComponent(2)=="c0da3");
+ CPPUNIT_ASSERT(da1->getInfoOnComponent(3)=="c1da3");
+ CPPUNIT_ASSERT(da1->getInfoOnComponent(4)=="c2da3");
+ //
+ const double expected1[35]={7.,7.,0.,0.,0., 7.,7.,10.,100.,1000., 7.,7.,20.,200.,2000., 7.,7.,30.,300.,3000., 7.,7.,40.,400.,4000.,7.,7.,50.,500.,5000.,7.,7.,60.,600.,6000.};
+ for(int i=0;i<35;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da1->getIJ(0,i),1e-10);
+ //
+ DataArrayInt *dai1=da1C->convertToIntArr();
+ DataArrayInt *dai3=da3->convertToIntArr();
+ dai1->meldWith(dai3);
+ CPPUNIT_ASSERT_EQUAL(5,dai1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(7,dai1->getNumberOfTuples());
+ CPPUNIT_ASSERT(dai1->getInfoOnComponent(0)=="c0da1");
+ CPPUNIT_ASSERT(dai1->getInfoOnComponent(1)=="c1da1");
+ CPPUNIT_ASSERT(dai1->getInfoOnComponent(2)=="c0da3");
+ CPPUNIT_ASSERT(dai1->getInfoOnComponent(3)=="c1da3");
+ CPPUNIT_ASSERT(dai1->getInfoOnComponent(4)=="c2da3");
+ for(int i=0;i<35;i++)
+ CPPUNIT_ASSERT_EQUAL((int)expected1[i],dai1->getIJ(0,i));
+ // test of static method DataArrayDouble::meld
+ DataArrayDouble *da4=DataArrayDouble::Meld(da1C,da3);
+ CPPUNIT_ASSERT_EQUAL(5,da4->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(7,da4->getNumberOfTuples());
+ CPPUNIT_ASSERT(da4->getInfoOnComponent(0)=="c0da1");
+ CPPUNIT_ASSERT(da4->getInfoOnComponent(1)=="c1da1");
+ CPPUNIT_ASSERT(da4->getInfoOnComponent(2)=="c0da3");
+ CPPUNIT_ASSERT(da4->getInfoOnComponent(3)=="c1da3");
+ CPPUNIT_ASSERT(da4->getInfoOnComponent(4)=="c2da3");
+ for(int i=0;i<35;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da4->getIJ(0,i),1e-10);
+ // test of static method DataArrayInt::meld
+ dai1->decrRef();
+ dai1=da1C->convertToIntArr();
+ DataArrayInt *dai4=DataArrayInt::Meld(dai1,dai3);
+ CPPUNIT_ASSERT_EQUAL(5,dai4->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(7,dai4->getNumberOfTuples());
+ CPPUNIT_ASSERT(dai4->getInfoOnComponent(0)=="c0da1");
+ CPPUNIT_ASSERT(dai4->getInfoOnComponent(1)=="c1da1");
+ CPPUNIT_ASSERT(dai4->getInfoOnComponent(2)=="c0da3");
+ CPPUNIT_ASSERT(dai4->getInfoOnComponent(3)=="c1da3");
+ CPPUNIT_ASSERT(dai4->getInfoOnComponent(4)=="c2da3");
+ for(int i=0;i<35;i++)
+ CPPUNIT_ASSERT_EQUAL((int)expected1[i],dai4->getIJ(0,i));
+ //
+ dai4->decrRef();
+ da4->decrRef();
+ dai3->decrRef();
+ dai1->decrRef();
+ da1C->decrRef();
+ da1->decrRef();
+ da2->decrRef();
+ da3->decrRef();
+}
+
+void MEDCouplingBasicsTest::testFieldMeld1()
+{
+ MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
+ MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f1->setMesh(m);
+ DataArrayDouble *da1=DataArrayDouble::New();
+ const double arr1[5]={12.,23.,34.,45.,56.};
+ da1->alloc(5,1);
+ std::copy(arr1,arr1+5,da1->getPointer());
+ da1->setInfoOnComponent(0,"aaa");
+ f1->setArray(da1);
+ f1->setTime(3.4,2,1);
+ f1->checkCoherency();
+ //
+ MEDCouplingFieldDouble *f2=f1->deepCpy();
+ f2->setMesh(f1->getMesh());
+ f2->checkCoherency();
+ f2->changeNbOfComponents(2,5.);
+ (*f2)=5.;
+ f2->getArray()->setInfoOnComponent(0,"bbb");
+ f2->getArray()->setInfoOnComponent(1,"ccc");
+ f2->checkCoherency();
+ //
+ MEDCouplingFieldDouble *f3=MEDCouplingFieldDouble::MeldFields(f2,f1);
+ f3->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(5,f3->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,f3->getNumberOfComponents());
+ CPPUNIT_ASSERT(f3->getArray()->getInfoOnComponent(0)=="bbb");
+ CPPUNIT_ASSERT(f3->getArray()->getInfoOnComponent(1)=="ccc");
+ CPPUNIT_ASSERT(f3->getArray()->getInfoOnComponent(2)=="aaa");
+ const double expected1[15]={5.,5.,12.,5.,5.,23.,5.,5.,34.,5.,5.,45.,5.,5.,56.};
+ for(int i=0;i<15;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f3->getIJ(0,i),1e-12);
+ int dt,it;
+ double time=f3->getTime(dt,it);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,time,1e-14);
+ CPPUNIT_ASSERT_EQUAL(2,dt);
+ CPPUNIT_ASSERT_EQUAL(1,it);
+ //
+ MEDCouplingFieldDouble *f4=f2->buildNewTimeReprFromThis(NO_TIME,false);
+ MEDCouplingFieldDouble *f5=f1->buildNewTimeReprFromThis(NO_TIME,false);
+ MEDCouplingFieldDouble *f6=MEDCouplingFieldDouble::MeldFields(f4,f5);
+ f6->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(5,f6->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,f6->getNumberOfComponents());
+ CPPUNIT_ASSERT(f6->getArray()->getInfoOnComponent(0)=="bbb");
+ CPPUNIT_ASSERT(f6->getArray()->getInfoOnComponent(1)=="ccc");
+ CPPUNIT_ASSERT(f6->getArray()->getInfoOnComponent(2)=="aaa");
+ for(int i=0;i<15;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f6->getIJ(0,i),1e-12);
+ //
+ f6->decrRef();
+ f4->decrRef();
+ f5->decrRef();
+ f3->decrRef();
+ da1->decrRef();
+ f2->decrRef();
+ f1->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testMergeNodes2()
+{
+ MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ MEDCouplingUMesh *m2=build2DTargetMesh_1();
+ const double vec[2]={0.002,0.};
+ m2->translate(vec);
+ //
+ std::vector<const MEDCouplingUMesh *> tmp(2);
+ tmp[0]=m1;
+ tmp[1]=m2;
+ MEDCouplingUMesh *m3=MEDCouplingUMesh::MergeUMeshes(tmp);
+ bool b;
+ int newNbOfNodes;
+ DataArrayInt *da=m3->mergeNodes2(0.01,b,newNbOfNodes);
+ CPPUNIT_ASSERT_EQUAL(9,m3->getNumberOfNodes());
+ const double expected1[18]={-0.299,-0.3, 0.201,-0.3, 0.701,-0.3, -0.299,0.2, 0.201,0.2, 0.701,0.2, -0.299,0.7, 0.201,0.7, 0.701,0.7};
+ for(int i=0;i<18;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],m3->getCoords()->getIJ(0,i),1e-13);
+ //
+ da->decrRef();
+ m3->decrRef();
+ m1->decrRef();
+ m2->decrRef();
+}
+
+void MEDCouplingBasicsTest::testMergeField2()
+{
+ MEDCouplingUMesh *m=build2DTargetMesh_1();
+ MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f1->setMesh(m);
+ DataArrayDouble *arr=DataArrayDouble::New();
+ arr->alloc(5,2);
+ arr->fillWithValue(2.);
+ f1->setArray(arr);
+ arr->decrRef();
+ MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f2->setMesh(m);
+ arr=DataArrayDouble::New();
+ arr->alloc(5,2);
+ arr->fillWithValue(5.);
+ f2->setArray(arr);
+ arr->decrRef();
+ MEDCouplingFieldDouble *f3=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f3->setMesh(m);
+ arr=DataArrayDouble::New();
+ arr->alloc(5,2);
+ arr->fillWithValue(7.);
+ f3->setArray(arr);
+ arr->decrRef();
+ //
+ std::vector<const MEDCouplingFieldDouble *> tmp(3);
+ tmp[0]=f1; tmp[1]=f2; tmp[2]=f3;
+ MEDCouplingFieldDouble *f4=MEDCouplingFieldDouble::MergeFields(tmp);
+ CPPUNIT_ASSERT_EQUAL(15,f4->getMesh()->getNumberOfCells());
+ const double expected1[30]={2.,2.,2.,2.,2.,2.,2.,2.,2.,2., 5.,5.,5.,5.,5.,5.,5.,5.,5.,5., 7.,7.,7.,7.,7.,7.,7.,7.,7.,7.};
+ for(int i=0;i<30;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f4->getIJ(0,i),1.e-13);
+ //
+ f4->decrRef();
+ f1->decrRef();
+ f2->decrRef();
+ f3->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIBuildComplement1()
+{
+ DataArrayInt *a=DataArrayInt::New();
+ const int tab[4]={3,1,7,8};
+ a->alloc(4,1);
+ std::copy(tab,tab+4,a->getPointer());
+ DataArrayInt *b=a->buildComplement(12);
+ CPPUNIT_ASSERT_EQUAL(8,b->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,b->getNumberOfComponents());
+ const int expected1[8]={0,2,4,5,6,9,10,11};
+ for(int i=0;i<8;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
+ b->decrRef();
+ a->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIBuildUnion1()
+{
+ DataArrayInt *a=DataArrayInt::New();
+ const int tab1[4]={3,1,7,8};
+ a->alloc(4,1);
+ std::copy(tab1,tab1+4,a->getPointer());
+ DataArrayInt *c=DataArrayInt::New();
+ const int tab2[5]={5,3,0,18,8};
+ c->alloc(5,1);
+ std::copy(tab2,tab2+5,c->getPointer());
+ DataArrayInt *b=a->buildUnion(c);
+ CPPUNIT_ASSERT_EQUAL(7,b->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,b->getNumberOfComponents());
+ const int expected1[7]={0,1,3,5,7,8,18};
+ for(int i=0;i<7;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
+ c->decrRef();
+ b->decrRef();
+ a->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIBuildIntersection1()
+{
+ DataArrayInt *a=DataArrayInt::New();
+ const int tab1[4]={3,1,7,8};
+ a->alloc(4,1);
+ std::copy(tab1,tab1+4,a->getPointer());
+ DataArrayInt *c=DataArrayInt::New();
+ const int tab2[5]={5,3,0,18,8};
+ c->alloc(5,1);
+ std::copy(tab2,tab2+5,c->getPointer());
+ DataArrayInt *b=a->buildIntersection(c);
+ CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,b->getNumberOfComponents());
+ const int expected1[2]={3,8};
+ for(int i=0;i<2;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
+ c->decrRef();
+ b->decrRef();
+ a->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIDeltaShiftIndex1()
+{
+ DataArrayInt *a=DataArrayInt::New();
+ const int tab[7]={1,3,6,7,7,9,15};
+ a->alloc(7,1);
+ std::copy(tab,tab+7,a->getPointer());
+ DataArrayInt *b=a->deltaShiftIndex();
+ CPPUNIT_ASSERT_EQUAL(6,b->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,b->getNumberOfComponents());
+ const int expected1[6]={2,3,1,0,2,6};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i));
+ b->decrRef();
+ a->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDaDoubleSelectByTupleIdSafe1()
+{
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(7,2);
+ a->setInfoOnComponent(0,"toto");
+ a->setInfoOnComponent(1,"tata");
+ const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1};
+ std::copy(arr1,arr1+14,a->getPointer());
+ //
+ const int arr2[7]={4,2,0,6,5};
+ DataArrayDouble *b=a->selectByTupleIdSafe(arr2,arr2+5);
+ CPPUNIT_ASSERT_EQUAL(5,b->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(b->getInfoOnComponent(1))=="tata");
+ const double expected1[10]={5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1};
+ for(int i=0;i<10;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
+ const int arr4[5]={4,-1,0,6,5};
+ CPPUNIT_ASSERT_THROW(a->selectByTupleIdSafe(arr4,arr4+5),INTERP_KERNEL::Exception);
+ const int arr5[5]={4,2,0,6,7};
+ CPPUNIT_ASSERT_THROW(a->selectByTupleIdSafe(arr5,arr5+5),INTERP_KERNEL::Exception);
+ b->decrRef();
+ a->decrRef();
+ //
+ DataArrayInt *c=DataArrayInt::New();
+ c->alloc(7,2);
+ c->setInfoOnComponent(0,"toto");
+ c->setInfoOnComponent(1,"tata");
+ const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17};
+ std::copy(arr3,arr3+14,c->getPointer());
+ DataArrayInt *d=c->selectByTupleIdSafe(arr2,arr2+5);
+ CPPUNIT_ASSERT_EQUAL(5,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto");
+ CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata");
+ const int expected2[10]={5,15,3,13,1,11,7,17,6,16};
+ for(int i=0;i<10;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i));
+ CPPUNIT_ASSERT_THROW(c->selectByTupleIdSafe(arr4,arr4+5),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(c->selectByTupleIdSafe(arr5,arr5+5),INTERP_KERNEL::Exception);
+ c->decrRef();
+ d->decrRef();
+}
+
+void MEDCouplingBasicsTest::testAreCellsIncludedIn1()
+{
+ MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
+ const int pt[2]={1,3};
+ MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(pt,pt+2,true);
+ DataArrayInt *tmp;
+ CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp));
+ CPPUNIT_ASSERT_EQUAL(2,tmp->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,tmp->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(pt[0],tmp->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(pt[1],tmp->getIJ(0,1));
+ tmp->decrRef();
+ CPPUNIT_ASSERT(!m2->areCellsIncludedIn(m,0,tmp));
+ tmp->decrRef();
+ m2->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIBuildSubstraction1()
+{
+ DataArrayInt *a=DataArrayInt::New();
+ const int aa[]={2,3,6,8,9};
+ a->alloc(5,1);
+ std::copy(aa,aa+5,a->getPointer());
+ DataArrayInt *b=DataArrayInt::New();
+ const int bb[]={1,3,5,9,11};
+ b->alloc(5,1);
+ std::copy(bb,bb+5,b->getPointer());
+ //
+ DataArrayInt *c=a->buildSubstraction(b);
+ CPPUNIT_ASSERT_EQUAL(3,c->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,c->getNumberOfComponents());
+ const int expected1[3]={2,6,8};
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer()));
+ //
+ c->decrRef();
+ b->decrRef();
+ a->decrRef();
+}
+
+void MEDCouplingBasicsTest::testBuildOrthogonalField2()
+{
+ MEDCouplingUMesh *m=build2DTargetMesh_1();
+ DataArrayInt *d1=DataArrayInt::New();
+ DataArrayInt *d2=DataArrayInt::New();
+ DataArrayInt *d3=DataArrayInt::New();
+ DataArrayInt *d4=DataArrayInt::New();
+ MEDCouplingUMesh *m1=m->buildDescendingConnectivity(d1,d2,d3,d4);
+ //
+ MEDCouplingFieldDouble *f1=m1->buildOrthogonalField();
+ DataArrayDouble *da1=f1->getArray();
+ CPPUNIT_ASSERT_EQUAL(2,da1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(13,da1->getNumberOfTuples());
+ //
+ const double expected1[26]={-1.,0.,0.,1.,1.,0.,0.,-1.,0.707106781186548,0.707106781186548,0.,-1.,0.,1.,1.,0.,0.,1.,1.,0.,-1.,0.,0.,1.,1.,0.};
+ for(int i=0;i<26;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da1->getIJ(0,i),1e-14);
+ //
+ f1->decrRef();
+ m1->decrRef();
+ d1->decrRef();
+ d2->decrRef();
+ d3->decrRef();
+ d4->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMInsertNextCell1()
+{
+ double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 };
+ int targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4};
+ MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
+ targetMesh->allocateCells(5);
+ CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn),INTERP_KERNEL::Exception);
+ targetMesh->setMeshDimension(2);
+ targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
+ CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,targetConn),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,targetConn),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,targetConn),INTERP_KERNEL::Exception);
+ targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+4);
+ targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+7);
+ targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+10);
+ targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+14);
+ targetMesh->finishInsertingCells();
+ DataArrayDouble *myCoords=DataArrayDouble::New();
+ myCoords->alloc(9,2);
+ std::copy(targetCoords,targetCoords+18,myCoords->getPointer());
+ targetMesh->setCoords(myCoords);
+ myCoords->decrRef();
+ targetMesh->checkCoherency();
+ targetMesh->decrRef();
+}
+
+void MEDCouplingBasicsTest::testFieldOperatorDivDiffComp1()
+{
+ MEDCouplingUMesh *m=build2DTargetMesh_1();
+ DataArrayInt *d1=DataArrayInt::New();
+ DataArrayInt *d2=DataArrayInt::New();
+ DataArrayInt *d3=DataArrayInt::New();
+ DataArrayInt *d4=DataArrayInt::New();
+ MEDCouplingUMesh *m1=m->buildDescendingConnectivity(d1,d2,d3,d4);
+ //
+ MEDCouplingFieldDouble *f1=m1->buildOrthogonalField();
+ const double arr1[13]={2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.};
+ DataArrayDouble *arr=DataArrayDouble::New();
+ arr->alloc(13,1);
+ std::copy(arr1,arr1+13,arr->getPointer());
+ MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS);
+ f2->setArray(arr);
+ f2->setMesh(m1);
+ f2->checkCoherency();
+ //
+ MEDCouplingFieldDouble *f3=(*f1)/(*f2);
+ CPPUNIT_ASSERT_THROW((*f2)/(*f1),INTERP_KERNEL::Exception);
+ f3->checkCoherency();
+ (*f1)/=(*f2);
+ CPPUNIT_ASSERT(f1->isEqual(f3,1e-10,1e-10));
+ CPPUNIT_ASSERT_THROW((*f2)/=(*f1),INTERP_KERNEL::Exception);
+ const double expected1[26]={-0.5, 0.0, 0.0, 0.33333333333333331, 0.25, 0.0, 0.0, -0.20000000000000001, 0.117851130197758, 0.117851130197758, 0.0, -0.14285714285714285, 0.0, 0.125, 0.1111111111111111, 0.0, 0.0, 0.10000000000000001, 0.090909090909090912, 0.0, -0.083333333333333329, 0.0, 0.0, 0.076923076923076927, 0.071428571428571425, 0.0};
+ for(int i=0;i<26;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f3->getIJ(0,i),1e-10);
+ //
+ f3->decrRef();
+ f2->decrRef();
+ arr->decrRef();
+ f1->decrRef();
+ m1->decrRef();
+ d1->decrRef();
+ d2->decrRef();
+ d3->decrRef();
+ d4->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDARearrange1()
+{
+ DataArrayInt *da1=DataArrayInt::New();
+ da1->alloc(12,1);
+ da1->iota(0);
+ const int *ptr=da1->getConstPointer();
+ //
+ CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(1,da1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(12,da1->getNumberOfTuples());
+ da1->rearrange(4);
+ CPPUNIT_ASSERT(ptr==da1->getConstPointer());
+ CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(4,da1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,da1->getNumberOfTuples());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
+ //
+ da1->rearrange(6);
+ CPPUNIT_ASSERT(ptr==da1->getConstPointer());
+ CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(6,da1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,da1->getNumberOfTuples());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
+ //
+ CPPUNIT_ASSERT_THROW(da1->rearrange(7),INTERP_KERNEL::Exception);
+ //
+ da1->rearrange(12);
+ CPPUNIT_ASSERT(ptr==da1->getConstPointer());
+ CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(12,da1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(1,da1->getNumberOfTuples());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
+ //
+ da1->rearrange(3);
+ CPPUNIT_ASSERT(ptr==da1->getConstPointer());
+ CPPUNIT_ASSERT_EQUAL(12,da1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(3,da1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,da1->getNumberOfTuples());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i));
+ //double
+ DataArrayDouble *da2=da1->convertToDblArr();
+ da1->decrRef();
+ const double *ptr2=da2->getConstPointer();
+ //
+ CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
+ da2->rearrange(4);
+ CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
+ CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfTuples());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL((double)i,da2->getIJ(0,i),1e-14);
+ //
+ da2->rearrange(6);
+ CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
+ CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(6,da2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,da2->getNumberOfTuples());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL((double)i,da2->getIJ(0,i),1e-14);
+ //
+ CPPUNIT_ASSERT_THROW(da2->rearrange(7),INTERP_KERNEL::Exception);
+ //
+ da2->rearrange(1);
+ CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
+ CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(12,da2->getNumberOfTuples());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL((double)i,da2->getIJ(0,i),1e-14);
+ //
+ da2->rearrange(3);
+ CPPUNIT_ASSERT(ptr2==da2->getConstPointer());
+ CPPUNIT_ASSERT_EQUAL(12,da2->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL((double)i,da2->getIJ(0,i),1e-14);
+ da2->decrRef();
+}
+
+void MEDCouplingBasicsTest::testGetDifferentValues1()
+{
+ DataArrayInt *da1=DataArrayInt::New();
+ const int arr[12]={1,2,3,2,2,3,5,1,5,5,2,2};
+ da1->alloc(4,3);
+ std::copy(arr,arr+12,da1->getPointer());
+ std::set<int> s=da1->getDifferentValues();
+ const int expected1[4]={1,2,3,5};
+ CPPUNIT_ASSERT_EQUAL(4,(int)s.size());
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+4,s.begin()));
+ da1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIBuildPermutationArr1()
+{
+ DataArrayInt *a=DataArrayInt::New();
+ const int vala[5]={4,5,6,7,8};
+ a->alloc(5,1);
+ std::copy(vala,vala+5,a->getPointer());
+ DataArrayInt *b=DataArrayInt::New();
+ const int valb[5]={5,4,8,6,7};
+ b->alloc(5,1);
+ std::copy(valb,valb+5,b->getPointer());
+ DataArrayInt *c=a->buildPermutationArr(*b);
+ const int expect1[5]={1,0,4,2,3};
+ CPPUNIT_ASSERT_EQUAL(5,c->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,c->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expect1,expect1+5,c->getConstPointer()));
+ CPPUNIT_ASSERT(a->isEqualWithoutConsideringStrAndOrder(*b));
+ b->setIJ(0,0,9);
+ CPPUNIT_ASSERT(!a->isEqualWithoutConsideringStrAndOrder(*b));
+ CPPUNIT_ASSERT_THROW(a->buildPermutationArr(*b),INTERP_KERNEL::Exception);
+ a->setIJ(3,0,4);
+ b->setIJ(0,0,5);
+ b->setIJ(4,0,4);//;a==[4,5,6,4,8] and b==[5,4,8,6,4]
+ CPPUNIT_ASSERT(a->isEqualWithoutConsideringStrAndOrder(*b));
+ c->decrRef();
+ c=a->buildPermutationArr(*b);
+ const int expect2[5]={1,3,4,2,3};
+ CPPUNIT_ASSERT(std::equal(expect2,expect2+5,c->getConstPointer()));
+ DataArrayDouble *d=b->convertToDblArr();
+ b->sort();
+ const int expect3[5]={4,4,5,6,8};
+ CPPUNIT_ASSERT(std::equal(expect3,expect3+5,b->getConstPointer()));
+ d->sort();
+ CPPUNIT_ASSERT_EQUAL(5,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ for(int i=0;i<5;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(double(expect3[i]),d->getIJ(i,0),1e-14);
+ //
+ d->decrRef();
+ c->decrRef();
+ a->decrRef();
+ b->decrRef();
+}
+
+void MEDCouplingBasicsTest::testAreCellsIncludedIn2()
+{
+ const char myName[]="Vitoo";
+ MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
+ MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(0,0,true);
+ CPPUNIT_ASSERT_EQUAL(0,m2->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(3,m2->getSpaceDimension());
+ CPPUNIT_ASSERT_EQUAL(2,m2->getMeshDimension());
+ m2->setName(myName);
+ DataArrayInt *tmp;
+ CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp));
+ CPPUNIT_ASSERT(std::string(myName)==tmp->getName());
+ CPPUNIT_ASSERT_EQUAL(0,tmp->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,tmp->getNumberOfComponents());
+ m->decrRef();
+ m2->decrRef();
+ tmp->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMeshGetPartBarycenterAndOwner1()
+{
+ MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ const int part[3]={1,0,4};
+ DataArrayDouble *b=m1->getPartBarycenterAndOwner(part,part+3);
+ CPPUNIT_ASSERT_EQUAL(2,b->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,b->getNumberOfTuples());
+ const double expected1[6]={0.36666666666666665,-0.13333333333333333,-0.05,-0.05,0.45,0.45};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
+ b->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMeshGetPartMeasureField1()
+{
+ MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ const int part[3]={1,0,4};
+ DataArrayDouble *b=m1->getPartMeasureField(true,part,part+3);
+ CPPUNIT_ASSERT_EQUAL(1,b->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,b->getNumberOfTuples());
+ const double expected1[3]={0.125,0.25,0.25};
+ for(int i=0;i<3;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14);
+ b->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMeshBuildPartOrthogonalField1()
+{
+ MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ m1->changeSpaceDimension(3);
+ const int part[3]={1,0,4};
+ MEDCouplingFieldDouble *b=m1->buildPartOrthogonalField(part,part+3);
+ CPPUNIT_ASSERT_EQUAL(3,b->getArray()->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,b->getArray()->getNumberOfTuples());
+ const double expected1[9]={0.,0.,-1.,0.,0.,-1.,0.,0.,-1.};
+ for(int i=0;i<9;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getArray()->getIJ(0,i),1e-14);
+ b->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMeshGetTypesOfPart1()
+{
+ MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ const int part1[]={0,3,4};
+ std::set<INTERP_KERNEL::NormalizedCellType> s;
+ s=m1->getTypesOfPart(part1,part1+3);
+ CPPUNIT_ASSERT(s.size()==1);
+ CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_QUAD4);
+ const int part2[]={2,2,2,1};
+ s=m1->getTypesOfPart(part2,part2+4);
+ CPPUNIT_ASSERT(s.size()==1);
+ CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_TRI3);
+ const int part3[]={3,2,1};
+ s=m1->getTypesOfPart(part3,part3+3);
+ CPPUNIT_ASSERT(s.size()==2);
+ CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_TRI3);
+ CPPUNIT_ASSERT(*(++s.begin())==INTERP_KERNEL::NORM_QUAD4);
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMeshKeepCellIdsByType1()
+{
+ MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ const int part1[3]={0,3,4};
+ DataArrayInt *a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part1,part1+3);
+ CPPUNIT_ASSERT_EQUAL(1,a->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(0,a->getNumberOfTuples());
+ a->decrRef();
+ //
+ const int part2[5]={3,2,0,2,4};
+ a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part2,part2+5);
+ CPPUNIT_ASSERT_EQUAL(1,a->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,a->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,a->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,a->getIJ(1,0));
+ a->decrRef();
+ //
+ a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_QUAD4,part2,part2+5);
+ CPPUNIT_ASSERT_EQUAL(1,a->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,a->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,a->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(0,a->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(4,a->getIJ(2,0));
+ //
+ a->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIAggregateMulti1()
+{
+ DataArrayInt *a=DataArrayInt::New();
+ a->setName("aa");
+ a->alloc(4,1);
+ a->iota(0);
+ a->rearrange(2);
+ DataArrayInt *b=DataArrayInt::New();
+ b->setName("bb");
+ b->alloc(6,1);
+ b->iota(0);
+ b->rearrange(2);
+ //
+ std::vector<const DataArrayInt *> v(2);
+ v[0]=a; v[1]=b;
+ DataArrayInt *c=DataArrayInt::Aggregate(v);
+ CPPUNIT_ASSERT_EQUAL(5,c->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,c->getNumberOfComponents());
+ CPPUNIT_ASSERT(c->getName()=="aa");
+ const int expect1[10]={0,1,2,3,0,1,2,3,4,5};
+ for(int i=0;i<10;i++)
+ CPPUNIT_ASSERT_EQUAL(expect1[i],c->getIJ(0,i));
+ //
+ c->decrRef();
+ a->decrRef();
+ b->decrRef();
+}
+
+void MEDCouplingBasicsTest::testMergeUMeshes2()
+{
+ MEDCouplingUMesh *m1=build3DSurfTargetMesh_1();
+ MEDCouplingUMesh *m2=build3DSurfTargetMesh_1();
+ MEDCouplingUMesh *m3=build3DSurfTargetMesh_1();
+ //
+ const int vec1[3]={0,2,3};
+ MEDCouplingUMesh *m2_2=(MEDCouplingUMesh *)m2->buildPartOfMySelf(vec1,vec1+3,false);
+ const int vec2[2]={1,1};
+ MEDCouplingUMesh *m3_2=(MEDCouplingUMesh *)m3->buildPartOfMySelf(vec2,vec2+2,false);
+ //
+ std::vector<const MEDCouplingUMesh *> ms(3);
+ ms[0]=m1; ms[1]=m2_2; ms[2]=m3_2;
+ //
+ MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshes(ms);
+ m4->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(10,m4->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(20,m4->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(45,m4->getMeshLength());
+ //
+ const int vec3[5]={0,1,2,3,4};
+ MEDCouplingUMesh *m4_1=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec3,vec3+5,false);
+ m4_1->setName(m1->getName());
+ CPPUNIT_ASSERT(m4_1->isEqual(m1,1e-12));
+ m4_1->decrRef();
+ //
+ const int vec4[3]={5,6,7};
+ MEDCouplingUMesh *m4_2=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec4,vec4+3,false);
+ DataArrayInt *cellCor=0;
+ DataArrayInt *nodeCor=0;
+ m4_2->checkGeoEquivalWith(m2_2,10,1e-12,cellCor,nodeCor);
+ CPPUNIT_ASSERT(cellCor==0);
+ CPPUNIT_ASSERT(nodeCor==0);
+ m4_2->decrRef();
+ //
+ const int vec5[2]={8,9};
+ MEDCouplingUMesh *m4_3=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec5,vec5+2,false);
+ CPPUNIT_ASSERT_EQUAL(2,m4_3->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(3,m4_3->getNumberOfNodes());
+ m3_2->zipCoords();
+ m4_3->setName(m3_2->getName());
+ CPPUNIT_ASSERT(m4_3->isEqual(m3_2,1e-12));
+ m4_3->decrRef();
+ //
+ m4->decrRef();
+ m1->decrRef();
+ m2->decrRef();
+ m2_2->decrRef();
+ m3->decrRef();
+ m3_2->decrRef();
+}
+
+void MEDCouplingBasicsTest::testBuild0DMeshFromCoords1()
+{
+ const double sourceCoords[12]={-0.3,-0.3,0., 0.7,-0.3,0., -0.3,0.7,0., 0.7,0.7,0.};
+ DataArrayDouble *coo=DataArrayDouble::New();
+ coo->alloc(4,3);
+ coo->setName("My0D");
+ std::copy(sourceCoords,sourceCoords+12,coo->getPointer());
+ MEDCouplingUMesh *m=MEDCouplingUMesh::Build0DMeshFromCoords(coo);
+ m->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfCells());
+ CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension());
+ CPPUNIT_ASSERT_EQUAL(0,m->getMeshDimension());
+ const std::set<INTERP_KERNEL::NormalizedCellType>& types=m->getAllTypes();
+ CPPUNIT_ASSERT_EQUAL(1,(int)types.size());
+ CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POINT1,*types.begin());
+ for(int i=0;i<4;i++)
+ {
+ std::vector<int> conn;
+ m->getNodeIdsOfCell(i,conn);
+ CPPUNIT_ASSERT_EQUAL(1,(int)conn.size());
+ CPPUNIT_ASSERT_EQUAL(i,conn[0]);
+ CPPUNIT_ASSERT(INTERP_KERNEL::NORM_POINT1==m->getTypeOfCell(i));
+ }
+ CPPUNIT_ASSERT(std::string(m->getName())=="My0D");
+ m->decrRef();
+ coo->decrRef();
+}
+
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "MEDCouplingBasicsTest.hxx"
+#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingCMesh.hxx"
+#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingGaussLocalization.hxx"
+#include "MEDCouplingMultiFields.hxx"
+#include "MEDCouplingFieldOverTime.hxx"
+
+#include <cmath>
+#include <functional>
+#include <iterator>
+
+using namespace ParaMEDMEM;
+
+void MEDCouplingBasicsTest::testDescriptionInMeshTimeUnit1()
+{
+ static const char text1[]="totoTTEDD";
+ MEDCouplingUMesh *m=build2DTargetMesh_1();
+ m->setDescription(text1);
+ CPPUNIT_ASSERT(std::string(m->getDescription())==text1);
+ MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCpy();
+ CPPUNIT_ASSERT(m->isEqual(m2,1e-12));
+ CPPUNIT_ASSERT(std::string(m2->getDescription())==text1);
+ m2->setDescription("ggg");
+ CPPUNIT_ASSERT(!m->isEqual(m2,1e-12));
+ m2->decrRef();
+ //
+ MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f->setTimeUnit(text1);
+ CPPUNIT_ASSERT(std::string(f->getTimeUnit())==text1);
+ MEDCouplingFieldDouble *f2=f->deepCpy();
+ CPPUNIT_ASSERT(std::string(f2->getTimeUnit())==text1);
+ f2->decrRef();
+ //
+ f->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testMultiFields1()
+{
+ MEDCouplingMultiFields *mfs=buildMultiFields_1();
+ std::vector<MEDCouplingMesh *> ms=mfs->getMeshes();
+ std::vector<int> refs;
+ std::vector<MEDCouplingMesh *> dms=mfs->getDifferentMeshes(refs);
+ std::vector<DataArrayDouble *> das=mfs->getArrays();
+ std::vector< std::vector<int> > refs2;
+ std::vector<DataArrayDouble *> das2=mfs->getDifferentArrays(refs2);
+ //
+ CPPUNIT_ASSERT_EQUAL(5,(int)ms.size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)dms.size());
+ CPPUNIT_ASSERT_EQUAL(6,(int)das.size());
+ CPPUNIT_ASSERT_EQUAL(5,(int)das2.size());
+ //
+ MEDCouplingMultiFields *mfs2=mfs->deepCpy();
+ CPPUNIT_ASSERT(mfs->isEqual(mfs2,1e-12,1e-12));
+ mfs2->decrRef();
+ //
+ mfs->decrRef();
+}
+
+void MEDCouplingBasicsTest::testFieldOverTime1()
+{
+ std::vector<MEDCouplingFieldDouble *> fs=buildMultiFields_2();
+ CPPUNIT_ASSERT_THROW(MEDCouplingFieldOverTime::New(fs),INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *f4bis=fs[4]->buildNewTimeReprFromThis(ONE_TIME,false);
+ fs[4]->decrRef();
+ fs[4]=f4bis;
+ CPPUNIT_ASSERT_THROW(MEDCouplingFieldOverTime::New(fs),INTERP_KERNEL::Exception);
+ f4bis->setTime(2.7,20,21);
+ MEDCouplingFieldOverTime *fot=MEDCouplingFieldOverTime::New(fs);
+ MEDCouplingDefinitionTime dt=fot->getDefinitionTimeZone();
+ std::vector<double> hs=dt.getHotSpotsTime();
+ CPPUNIT_ASSERT_EQUAL(6,(int)hs.size());
+ const double expected1[]={0.2,0.7,1.2,1.35,1.7,2.7};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],hs[i],1e-12);
+ int meshId,arrId,arrIdInField,fieldId;
+ dt.getIdsOnTimeRight(0.2,meshId,arrId,arrIdInField,fieldId);
+ CPPUNIT_ASSERT_EQUAL(0,meshId);
+ CPPUNIT_ASSERT_EQUAL(0,arrId);
+ CPPUNIT_ASSERT_EQUAL(0,arrIdInField);
+ CPPUNIT_ASSERT_EQUAL(0,fieldId);
+ //
+ dt.getIdsOnTimeRight(0.7,meshId,arrId,arrIdInField,fieldId);
+ CPPUNIT_ASSERT_EQUAL(0,meshId);
+ CPPUNIT_ASSERT_EQUAL(1,arrId);
+ CPPUNIT_ASSERT_EQUAL(0,arrIdInField);
+ CPPUNIT_ASSERT_EQUAL(1,fieldId);
+ //
+ dt.getIdsOnTimeLeft(1.2,meshId,arrId,arrIdInField,fieldId);//**** WARNING left here
+ CPPUNIT_ASSERT_EQUAL(0,meshId);
+ CPPUNIT_ASSERT_EQUAL(2,arrId);
+ CPPUNIT_ASSERT_EQUAL(1,arrIdInField);
+ CPPUNIT_ASSERT_EQUAL(1,fieldId);
+ //
+ dt.getIdsOnTimeRight(1.2,meshId,arrId,arrIdInField,fieldId);//**** WARNING right again here
+ CPPUNIT_ASSERT_EQUAL(1,meshId);
+ CPPUNIT_ASSERT_EQUAL(3,arrId);
+ CPPUNIT_ASSERT_EQUAL(0,arrIdInField);
+ CPPUNIT_ASSERT_EQUAL(2,fieldId);
+ //
+ dt.getIdsOnTimeRight(1.35,meshId,arrId,arrIdInField,fieldId);
+ CPPUNIT_ASSERT_EQUAL(1,meshId);
+ CPPUNIT_ASSERT_EQUAL(3,arrId);
+ CPPUNIT_ASSERT_EQUAL(0,arrIdInField);
+ CPPUNIT_ASSERT_EQUAL(2,fieldId);
+ //
+ dt.getIdsOnTimeRight(1.7,meshId,arrId,arrIdInField,fieldId);
+ CPPUNIT_ASSERT_EQUAL(0,meshId);
+ CPPUNIT_ASSERT_EQUAL(3,arrId);
+ CPPUNIT_ASSERT_EQUAL(0,arrIdInField);
+ CPPUNIT_ASSERT_EQUAL(3,fieldId);
+ //
+ dt.getIdsOnTimeRight(2.7,meshId,arrId,arrIdInField,fieldId);
+ CPPUNIT_ASSERT_EQUAL(1,meshId);
+ CPPUNIT_ASSERT_EQUAL(4,arrId);
+ CPPUNIT_ASSERT_EQUAL(0,arrIdInField);
+ CPPUNIT_ASSERT_EQUAL(4,fieldId);
+ //
+ MEDCouplingDefinitionTime dt2;
+ CPPUNIT_ASSERT(!dt2.isEqual(dt));
+ dt2.assign(dt);
+ dt2.assign(dt);//to check memory management
+ CPPUNIT_ASSERT(dt2.isEqual(dt));
+ //
+ MEDCouplingDefinitionTime dt3;
+ std::vector<int> tmp1;
+ std::vector<double> tmp2;
+ CPPUNIT_ASSERT(!dt2.isEqual(dt3));
+ dt2.getTinySerializationInformation(tmp1,tmp2);
+ dt3.unserialize(tmp1,tmp2);
+ CPPUNIT_ASSERT(dt2.isEqual(dt3));
+ //
+ for(std::vector<MEDCouplingFieldDouble *>::iterator it=fs.begin();it!=fs.end();it++)
+ (*it)->decrRef();
+ fot->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAICheckAndPreparePermutation1()
+{
+ const int vals1[]={9,10,0,6,4,11,3,7};
+ const int expect1[]={5,6,0,3,2,7,1,4};
+ const int vals2[]={9,10,0,6,10,11,3,7};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(8,1);
+ std::copy(vals1,vals1+8,da->getPointer());
+ DataArrayInt *da2=da->checkAndPreparePermutation();
+ CPPUNIT_ASSERT_EQUAL(8,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ for(int i=0;i<8;i++)
+ CPPUNIT_ASSERT_EQUAL(expect1[i],da2->getIJ(i,0));
+ da2->decrRef();
+ da->decrRef();
+ //
+ da=DataArrayInt::New();
+ da->alloc(8,1);
+ da->iota(0);
+ da2=da->checkAndPreparePermutation();
+ CPPUNIT_ASSERT_EQUAL(8,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ CPPUNIT_ASSERT(da2->isIdentity());
+ da2->decrRef();
+ da->decrRef();
+ //
+ da=DataArrayInt::New();
+ da->alloc(8,1);
+ std::copy(vals2,vals2+8,da->getPointer());
+ CPPUNIT_ASSERT_THROW(da->checkAndPreparePermutation(),INTERP_KERNEL::Exception);
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIChangeSurjectiveFormat1()
+{
+ const int vals1[8]={0,3,2,3,2,2,1,2};
+ const int expected1[5]={0,1,2,6,8};
+ const int expected2[8]={0, 6, 2,4,5,7, 1,3};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(8,1);
+ std::copy(vals1,vals1+8,da->getPointer());
+ //
+ DataArrayInt *da2,*da2I;
+ da->changeSurjectiveFormat(4,da2,da2I);
+ CPPUNIT_ASSERT_EQUAL(5,da2I->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(8,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+5,da2I->getConstPointer()));
+ CPPUNIT_ASSERT(std::equal(expected2,expected2+8,da2->getConstPointer()));
+ da2->decrRef();
+ da2I->decrRef();
+ //
+ CPPUNIT_ASSERT_THROW(da->changeSurjectiveFormat(3,da2,da2I),INTERP_KERNEL::Exception);
+ //
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMeshGetCellIdsLyingOnNodes1()
+{
+ MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
+ const int nodeIds1[5]={1,2,3,4,6};
+ const int nodeIds2[2]={6,7};
+ DataArrayInt *da=m->getCellIdsLyingOnNodes(nodeIds1,nodeIds1+5,true);
+ CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(1,da->getIJ(0,0));
+ da->decrRef();
+ da=m->getCellIdsLyingOnNodes(nodeIds2,nodeIds2+2,false);
+ CPPUNIT_ASSERT_EQUAL(2,da->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(3,da->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(4,da->getIJ(1,0));
+ da->decrRef();
+ //
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMeshFindCellsIdsOnBoundary1()
+{
+ MEDCouplingUMesh *m=build3DSurfTargetMesh_1();
+ DataArrayInt *da5=m->findCellsIdsOnBoundary();
+ CPPUNIT_ASSERT_EQUAL(5,da5->getNumberOfTuples());
+ CPPUNIT_ASSERT(da5->isIdentity());
+ //
+ da5->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testMeshSetTime1()
+{
+ MEDCouplingUMesh *m1=build3DSurfTargetMesh_1();
+ MEDCouplingUMesh *m2=build3DSurfTargetMesh_1();
+ //
+ CPPUNIT_ASSERT(m1->isEqual(m2,1e-12));
+ m1->setTime(3.14,6,7);
+ int tmp1,tmp2;
+ double tmp3=m1->getTime(tmp1,tmp2);
+ CPPUNIT_ASSERT_EQUAL(6,tmp1);
+ CPPUNIT_ASSERT_EQUAL(7,tmp2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3.14,tmp3,1e-12);
+ CPPUNIT_ASSERT(!m1->isEqual(m2,1e-12));
+ m2->setTime(3.14,6,7);
+ CPPUNIT_ASSERT(m1->isEqual(m2,1e-12));
+ m1->setTimeUnit("ms");
+ CPPUNIT_ASSERT(std::string(m1->getTimeUnit())=="ms");
+ m1->setTimeUnit("us");
+ CPPUNIT_ASSERT(std::string(m1->getTimeUnit())=="us");
+ CPPUNIT_ASSERT(!m1->isEqual(m2,1e-12));
+ m2->setTimeUnit("us");
+ CPPUNIT_ASSERT(m1->isEqual(m2,1e-12));
+ m2->setTime(3.14,6,8);
+ CPPUNIT_ASSERT(!m1->isEqual(m2,1e-12));
+ m2->setTime(3.14,7,7);
+ CPPUNIT_ASSERT(!m1->isEqual(m2,1e-12));
+ m2->setTime(3.15,6,7);
+ CPPUNIT_ASSERT(!m1->isEqual(m2,1e-12));
+ //
+ m1->setTime(10.34,55,12);
+ MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->deepCpy();
+ CPPUNIT_ASSERT(m1->isEqual(m3,1e-12));
+ tmp3=m3->getTime(tmp1,tmp2);
+ CPPUNIT_ASSERT_EQUAL(55,tmp1);
+ CPPUNIT_ASSERT_EQUAL(12,tmp2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(10.34,tmp3,1e-12);
+ //
+ m3->decrRef();
+ m1->decrRef();
+ m2->decrRef();
+ // testing CMesh
+ const double coo1[4]={0.,1.,2.,3.5};
+ DataArrayDouble *a=DataArrayDouble::New();
+ a->alloc(4,1);
+ std::copy(coo1,coo1+4,a->getPointer());
+ MEDCouplingCMesh *b=MEDCouplingCMesh::New();
+ b->setCoordsAt(0,a);
+ a->decrRef();
+ //
+ b->setTime(5.67,8,100);
+ tmp3=b->getTime(tmp1,tmp2);
+ CPPUNIT_ASSERT_EQUAL(8,tmp1);
+ CPPUNIT_ASSERT_EQUAL(100,tmp2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(5.67,tmp3,1e-12);
+ MEDCouplingCMesh *c=(MEDCouplingCMesh *)b->deepCpy();
+ CPPUNIT_ASSERT(c->isEqual(b,1e-12));
+ tmp3=c->getTime(tmp1,tmp2);
+ CPPUNIT_ASSERT_EQUAL(8,tmp1);
+ CPPUNIT_ASSERT_EQUAL(100,tmp2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(5.67,tmp3,1e-12);
+ c->decrRef();
+ b->decrRef();
+}
+
+void MEDCouplingBasicsTest::testApplyFuncTwo1()
+{
+ MEDCouplingUMesh *m1=build3DSurfTargetMesh_1();
+ MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f1->setMesh(m1);
+ //
+ const double vals[15]={1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.,5.,15.,25.};
+ DataArrayDouble *da=DataArrayDouble::New();
+ da->alloc(5,3);
+ std::copy(vals,vals+15,da->getPointer());
+ f1->setArray(da);
+ //
+ CPPUNIT_ASSERT_THROW(da->applyFunc2(1,"y+z"),INTERP_KERNEL::Exception);
+ da->setInfoOnComponent(0,"x [m]");
+ da->setInfoOnComponent(1,"y [mm]");
+ da->setInfoOnComponent(2,"z [km]");
+ DataArrayDouble *da2=da->applyFunc2(1,"y+z");
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,da2->getNumberOfTuples());
+ const double expected1[5]={32.,34.,36.,38.,40.};
+ for(int i=0;i<5;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da2->getIJ(0,i),1e-12);
+ da2->decrRef();
+ da2=da->applyFunc(1,"y+z");
+ const double expected2[5]={12.,14.,16.,18.,20.};
+ for(int i=0;i<5;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],da2->getIJ(0,i),1e-12);
+ da2->decrRef();
+ //
+ CPPUNIT_ASSERT_EQUAL(3,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ f1->applyFunc2(1,"y+z");
+ CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ for(int i=0;i<5;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getArray()->getIJ(0,i),1e-12);
+ //
+ da->decrRef();
+ f1->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testApplyFuncThree1()
+{
+ MEDCouplingUMesh *m1=build3DSurfTargetMesh_1();
+ MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+ f1->setMesh(m1);
+ //
+ const double vals[15]={1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.,5.,15.,25.};
+ DataArrayDouble *da=DataArrayDouble::New();
+ da->alloc(5,3);
+ std::copy(vals,vals+15,da->getPointer());
+ f1->setArray(da);
+ //
+ std::vector<std::string> vs(3);
+ vs[0]="x"; vs[1]="Y"; vs[2]="z";
+ CPPUNIT_ASSERT_THROW(da->applyFunc3(1,vs,"y+z"),INTERP_KERNEL::Exception);
+ vs[1]="y";
+ DataArrayDouble *da2=da->applyFunc3(1,vs,"y+z");
+ const double expected1[5]={32.,34.,36.,38.,40.};
+ for(int i=0;i<5;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da2->getIJ(0,i),1e-12);
+ da2->decrRef();
+ f1->setArray(da);
+ CPPUNIT_ASSERT_EQUAL(3,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ f1->applyFunc3(1,vs,"y+z");
+ CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(5,f1->getNumberOfTuples());
+ for(int i=0;i<5;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getArray()->getIJ(0,i),1e-12);
+ //
+ da->decrRef();
+ f1->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testFillFromAnalyticTwo1()
+{
+ MEDCouplingUMesh *m1=build3DSurfTargetMesh_1();
+ CPPUNIT_ASSERT_THROW(m1->fillFromAnalytic2(ON_NODES,1,"y+z"),INTERP_KERNEL::Exception);
+ m1->getCoords()->setInfoOnComponent(0,"x [m]");
+ m1->getCoords()->setInfoOnComponent(1,"y");
+ m1->getCoords()->setInfoOnComponent(2,"z");
+ MEDCouplingFieldDouble *f1=m1->fillFromAnalytic2(ON_NODES,1,"y+z");
+ CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,f1->getNumberOfTuples());
+ const double expected1[9]={0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2};
+ for(int i=0;i<9;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getArray()->getIJ(0,i),1e-12);
+ f1->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testFillFromAnalyticThree1()
+{
+ MEDCouplingUMesh *m1=build3DSurfTargetMesh_1();
+ std::vector<std::string> vs(3);
+ vs[0]="x"; vs[1]="Y"; vs[2]="z";
+ CPPUNIT_ASSERT_THROW(m1->fillFromAnalytic3(ON_NODES,1,vs,"y+z"),INTERP_KERNEL::Exception);
+ vs[1]="y";
+ MEDCouplingFieldDouble *f1=m1->fillFromAnalytic3(ON_NODES,1,vs,"y+z");
+ CPPUNIT_ASSERT_EQUAL(1,f1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,f1->getNumberOfTuples());
+ const double expected1[9]={0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2};
+ for(int i=0;i<9;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getArray()->getIJ(0,i),1e-12);
+ f1->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAUnitVar1()
+{
+ DataArrayDouble *da=DataArrayDouble::New();
+ da->alloc(1,3);
+ da->setInfoOnComponent(0,"XPS [m]");
+ std::string st1,st2;
+ st1=da->getVarOnComponent(0);
+ CPPUNIT_ASSERT(st1=="XPS");
+ st2=da->getUnitOnComponent(0);
+ CPPUNIT_ASSERT(st2=="m");
+ //
+ da->setInfoOnComponent(0,"XPS [m]");
+ st1=da->getVarOnComponent(0);
+ CPPUNIT_ASSERT(st1=="XPS");
+ st2=da->getUnitOnComponent(0);
+ CPPUNIT_ASSERT(st2=="m");
+ //
+ da->setInfoOnComponent(0,"XPP [m]");
+ st1=da->getVarOnComponent(0);
+ CPPUNIT_ASSERT(st1=="XPP");
+ st2=da->getUnitOnComponent(0);
+ CPPUNIT_ASSERT(st2=="m");
+ //
+ da->setInfoOnComponent(0,"XPP kdep kefer [ m ]");
+ st1=da->getVarOnComponent(0);
+ CPPUNIT_ASSERT(st1=="XPP kdep kefer");
+ st2=da->getUnitOnComponent(0);
+ CPPUNIT_ASSERT(st2==" m ");
+ //
+ da->setInfoOnComponent(0," XPP k[ dep k]efer [ m^ 2/s^3*kJ ]");
+ st1=da->getVarOnComponent(0);
+ CPPUNIT_ASSERT(st1==" XPP k[ dep k]efer");
+ st2=da->getUnitOnComponent(0);
+ CPPUNIT_ASSERT(st2==" m^ 2/s^3*kJ ");
+ //
+ da->setInfoOnComponent(0," XPP kefer ");
+ st1=da->getVarOnComponent(0);
+ CPPUNIT_ASSERT(st1==" XPP kefer ");
+ st2=da->getUnitOnComponent(0);
+ CPPUNIT_ASSERT(st2=="");
+ //
+ da->setInfoOnComponent(0,"temperature( bof)");
+ st1=da->getVarOnComponent(0);
+ CPPUNIT_ASSERT(st1=="temperature( bof)");
+ st2=da->getUnitOnComponent(0);
+ CPPUNIT_ASSERT(st2=="");
+ //
+ da->setInfoOnComponent(0,"kkk [m]");
+ da->setInfoOnComponent(1,"ppp [m^2/kJ]");
+ da->setInfoOnComponent(2,"abcde [MW/s]");
+ //
+ std::vector<std::string> vs;
+ vs=da->getVarsOnComponent();
+ CPPUNIT_ASSERT_EQUAL(3,(int)vs.size());
+ CPPUNIT_ASSERT(vs[0]=="kkk");
+ CPPUNIT_ASSERT(vs[1]=="ppp");
+ CPPUNIT_ASSERT(vs[2]=="abcde");
+ vs=da->getUnitsOnComponent();
+ CPPUNIT_ASSERT_EQUAL(3,(int)vs.size());
+ CPPUNIT_ASSERT(vs[0]=="m");
+ CPPUNIT_ASSERT(vs[1]=="m^2/kJ");
+ CPPUNIT_ASSERT(vs[2]=="MW/s");
+ //
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testGaussCoordinates1()
+{
+ //Testing 1D cell types
+ MEDCouplingUMesh *m1=build1DMultiTypes_1();
+ MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_GAUSS_PT,ONE_TIME);
+ f->setMesh(m1);
+ std::vector<double> wg1(1); wg1[0]=0.3;
+ std::vector<double> gsCoo1(1); gsCoo1[0]=0.2;
+ std::vector<double> refCoo1(2); refCoo1[0]=-1.0; refCoo1[1]=1.0;
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_SEG2,refCoo1,gsCoo1,wg1);
+ std::vector<double> wg2(wg1);
+ std::vector<double> gsCoo2(1); gsCoo2[0]=0.2;
+ std::vector<double> refCoo2(3); refCoo2[0]=-1.0; refCoo2[1]=1.0; refCoo2[2]=0.0;
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_SEG3,refCoo2,gsCoo2,wg2);
+ //
+ DataArrayDouble *resToTest=f->getLocalizationOfDiscr();
+ CPPUNIT_ASSERT_EQUAL(3,resToTest->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,resToTest->getNumberOfTuples());
+ const double expected1[6]={0.6,0.6,0.6, 0.6,0.6,0.6};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],resToTest->getIJ(0,i),1e-14);
+ resToTest->decrRef();
+ //
+ m1->decrRef();
+ f->decrRef();
+ //Testing 2D cell types
+ MEDCouplingUMesh *m2=build2DMultiTypes_1();
+ f=MEDCouplingFieldDouble::New(ON_GAUSS_PT,ONE_TIME);
+ f->setMesh(m2);
+ std::vector<double> wg3(2); wg3[0]=0.3; wg3[1]=0.3;
+ const double tria3CooGauss[4]={ 0.1, 0.8, 0.2, 0.7 };
+ std::vector<double> gsCoo3(tria3CooGauss,tria3CooGauss+4);
+ const double tria3CooRef[6]={ 0.0, 0.0, 1.0 , 0.0, 0.0, 1.0 };
+ std::vector<double> refCoo3(tria3CooRef,tria3CooRef+6);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,refCoo3,gsCoo3,wg3);
+ std::vector<double> wg4(3); wg4[0]=0.3; wg4[1]=0.3; wg4[2]=0.3;
+ const double tria6CooGauss[6]={ 0.3, 0.2, 0.2, 0.1, 0.2, 0.4 };
+ std::vector<double> gsCoo4(tria6CooGauss,tria6CooGauss+6);
+ const double tria6CooRef[12]={0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.5, 0.0, 0.5, 0.5, 0.0, 0.5};
+ std::vector<double> refCoo4(tria6CooRef,tria6CooRef+12);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI6,refCoo4,gsCoo4,wg4);
+ std::vector<double> wg5(4); wg5[0]=0.3; wg5[1]=0.3; wg5[2]=0.3; wg5[3]=0.3;
+ const double quad4CooGauss[8]={ 0.3, 0.2, 0.2, 0.1, 0.2, 0.4, 0.15, 0.27 };
+ std::vector<double> gsCoo5(quad4CooGauss,quad4CooGauss+8);
+ const double quad4CooRef[8]={-1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0};
+ std::vector<double> refCoo5(quad4CooRef,quad4CooRef+8);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,refCoo5,gsCoo5,wg5);
+ std::vector<double> wg6(4); wg6[0]=0.3; wg6[1]=0.3; wg6[2]=0.3; wg6[3]=0.3;
+ const double quad8CooGauss[8]={ 0.34, 0.16, 0.21, 0.3, 0.23, 0.4, 0.14, 0.37 };
+ std::vector<double> gsCoo6(quad8CooGauss,quad8CooGauss+8);
+ const double quad8CooRef[16]={ -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, -1.0, 0.0};
+ std::vector<double> refCoo6(quad8CooRef,quad8CooRef+16);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD8,refCoo6,gsCoo6,wg6);
+ //
+ resToTest=f->getLocalizationOfDiscr();
+ CPPUNIT_ASSERT_EQUAL(3,resToTest->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(13,resToTest->getNumberOfTuples());//2+3+4+4 gauss points for resp TRI3,TRI6,QUAD4,QUAD8
+ const double expected2[39]={5.1,1.55,0.0, 4.7,1.65,0.0, //TRI3
+ 2.32,1.52,0.0, 1.6,1.32,0.0, 3.52,1.26,0.0,//TRI6
+ 2.6,1.6,0.0, 2.4,1.8,0.0, 2.4,1.2,0.0, 2.3,1.46,0.0,//QUAD4
+ 2.32,2.68,0.0, 2.6,2.42,0.0, 2.8,2.46,0.0, 2.74,2.28,0.0 };//QUAD8
+ for(int i=0;i<39;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],resToTest->getIJ(0,i),1e-14);
+ resToTest->decrRef();
+ //
+ m2->decrRef();
+ f->decrRef();
+ //Testing 3D cell types
+ MEDCouplingUMesh *m3=build3DMultiTypes_1();
+ f=MEDCouplingFieldDouble::New(ON_GAUSS_PT,ONE_TIME);
+ f->setMesh(m3);
+ //
+ std::vector<double> wg7(1); wg7[0]=0.3;
+ const double tetra4CooGauss[3]={0.34, 0.16, 0.21};
+ std::vector<double> gsCoo7(tetra4CooGauss,tetra4CooGauss+3);
+ const double tetra4CooRef[12]={0.0,1.0,0.0, 0.0,0.0,1.0, 0.0,0.0,0.0, 1.0,0.0,0.0};
+ std::vector<double> refCoo7(tetra4CooRef,tetra4CooRef+12);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TETRA4,refCoo7,gsCoo7,wg7);
+ std::vector<double> wg8(1); wg8[0]=0.3;
+ const double tetra10CooGauss[3]={0.2, 0.3, 0.1};
+ std::vector<double> gsCoo8(tetra10CooGauss,tetra10CooGauss+3);
+ const double tetra10CooRef[30]={0.0,1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0, 1.0,0.0,0.0, 0.0,0.5,0.0, 0.0,0.0,0.5, 0.0,0.5,0.5, 0.5,0.5,0.0, 0.5,0.0,0.0, 0.5,0.0,0.5};
+ std::vector<double> refCoo8(tetra10CooRef,tetra10CooRef+30);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TETRA10,refCoo8,gsCoo8,wg8);
+ std::vector<double> wg9(1); wg9[0]=0.3;
+ const double pyra5CooGauss[3]={0.2, 0.3, 0.1};
+ std::vector<double> gsCoo9(pyra5CooGauss,pyra5CooGauss+3);
+ const double pyra5CooRef[15]={1.0,0.0,0.0, 0.0,1.0,0.0, -1.0,0.0,0.0, 0.0,-1.0,0.0, 0.0,0.0,1.0};
+ std::vector<double> refCoo9(pyra5CooRef,pyra5CooRef+15);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PYRA5,refCoo9,gsCoo9,wg9);
+ std::vector<double> wg10(1); wg10[0]=0.3;
+ const double pyra13CooGauss[3]={0.1, 0.2, 0.7};
+ std::vector<double> gsCoo10(pyra13CooGauss,pyra13CooGauss+3);
+ const double pyra13CooRef[39]={1.0,0.0,0.0, 0.0,1.0,0.0,-1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,1.0,0.5,0.5,0.0,-0.5,0.5,0.0,-0.5,-0.5,0.0,0.5,-0.5,0.0,0.5,0.0,0.5,0.0,0.5,0.5,-0.5,0.0,0.5,0.0,-0.5,0.5};
+ std::vector<double> refCoo10(pyra13CooRef,pyra13CooRef+39);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PYRA13,refCoo10,gsCoo10,wg10);
+ std::vector<double> wg11(1); wg11[0]=0.3;
+ const double penta6CooGauss[3]={0.2, 0.3, 0.1};
+ std::vector<double> gsCoo11(penta6CooGauss,penta6CooGauss+3);
+ const double penta6CooRef[18]={-1.0,1.0,0.0,-1.0,-0.0,1.0,-1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0};
+ std::vector<double> refCoo11(penta6CooRef,penta6CooRef+18);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PENTA6,refCoo11,gsCoo11,wg11);
+ std::vector<double> wg12(1); wg12[0]=0.3;
+ const double penta15CooGauss[3]={0.2, 0.3,0.15};
+ std::vector<double> gsCoo12(penta15CooGauss,penta15CooGauss+3);
+ const double penta15CooRef[45]={-1.0,1.0,0.0,-1.0,0.0,1.0,-1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,-1.0,0.5,0.5,-1.0,0.0,0.5,-1.0,0.5,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.5,0.5,1.0,0.0, 0.5,1.0,0.5,0.0};
+ std::vector<double> refCoo12(penta15CooRef,penta15CooRef+45);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_PENTA15,refCoo12,gsCoo12,wg12);
+ std::vector<double> wg13(1); wg13[0]=0.3;
+ const double hexa8CooGauss[3]={0.2,0.3,0.15};
+ std::vector<double> gsCoo13(hexa8CooGauss,hexa8CooGauss+3);
+ const double hexa8CooRef[24]={-1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0};
+ std::vector<double> refCoo13(hexa8CooRef,hexa8CooRef+24);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_HEXA8,refCoo13,gsCoo13,wg13);
+ std::vector<double> wg14(1); wg14[0]=0.3;
+ const double hexa20CooGauss[3]={0.11,0.3,0.55};
+ std::vector<double> gsCoo14(hexa20CooGauss,hexa20CooGauss+3);
+ const double hexa20CooRef[60]={-1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0,0.0,-1.0,-1.0,1.0,0.0,-1.0,0.0,1.0,-1.0,-1.0,0.0,-1.0,-1.0,-1.0,0.0,1.0,-1.0,0.0,1.0,1.0,0.0,-1.0,1.0,0.0,0.0,-1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,-1.0,0.0,1.0};
+ std::vector<double> refCoo14(hexa20CooRef,hexa20CooRef+60);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_HEXA20,refCoo14,gsCoo14,wg14);
+ //
+ resToTest=f->getLocalizationOfDiscr();
+ CPPUNIT_ASSERT_EQUAL(3,resToTest->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(8,resToTest->getNumberOfTuples());//2+3+4+4 gauss points for resp TRI3,TRI6,QUAD4,QUAD8
+ const double expected3[24]={1.312,3.15,1.02, 0.56,3.3,0.6, 2.18,1.1,0.2, 1.18,1.54,0.98, 1.56,0.3,3.6, 1.613,0.801,4.374, 2.6,2.4,2.3, 2.31232,2.3933985,1.553255};
+ for(int i=0;i<24;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],resToTest->getIJ(0,i),1e-14);
+ resToTest->decrRef();
+ //
+ m3->decrRef();
+ f->decrRef();
+}
+
+/*!
+ * Not activated test ! To be implemented !
+ */
+void MEDCouplingBasicsTest::testQ1Localization1()
+{
+ MEDCouplingUMesh *m=buildHexa8Mesh_1();
+ MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
+ DataArrayDouble *da=DataArrayDouble::New();
+ const double vals1[27]={1.0,3.0,4.0,1.0,3.0,4.0,3.0,2.0,5.0,1.0,3.0,4.0,1.0,3.0,4.0,3.0,2.0,5.0,1.0,3.0,4.0,1.0,3.0,4.0,3.0,2.0,5.0};
+ da->alloc(27,1);
+ std::copy(vals1,vals1+27,da->getPointer());
+ f->setMesh(m);
+ f->setArray(da);
+ da->decrRef();
+ //
+ const double point1[3]={0.25,0.75,0.25};
+ //const double points1[6]={0.25,0.75,0.25,1.0,1.0,1.0};
+ double res1[3];
+ f->getValueOn(point1,res1);
+ //
+ f->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testP2Localization1()
+{
+ MEDCouplingUMesh *m=MEDCouplingUMesh::New("testP2",2);
+ const double coords[12]={0.,2.,3.5,0.,4.5,1.5,1.2,0.32,3.4,1.,2.1,2.4};
+ const int conn[6]={0,1,2,3,4,5};
+ DataArrayDouble *coo=DataArrayDouble::New();
+ coo->alloc(6,2);
+ std::copy(coords,coords+12,coo->getPointer());
+ m->setCoords(coo);
+ coo->decrRef();
+ m->allocateCells(1);
+ m->insertNextCell(INTERP_KERNEL::NORM_TRI6,6,conn);
+ m->finishInsertingCells();
+ //
+ MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
+ f->setMesh(m);
+ DataArrayDouble *da=DataArrayDouble::New();
+ da->alloc(6,3);
+ const double vals1[18]={1.2,2.3,3.4, 2.2,3.3,4.4, 3.2,4.3,5.4, 4.2,5.3,6.4, 5.2,6.3,7.4, 6.2,7.3,8.4};
+ std::copy(vals1,vals1+18,da->getPointer());
+ f->setArray(da);
+ da->decrRef();
+ //
+ const double loc[2]={2.27,1.3};
+ DataArrayDouble *locs=f->getValueOnMulti(loc,1);
+ const double expected1[3]={6.0921164547752236, 7.1921164547752232, 8.2921164547752255};
+ for(int i=0;i<3;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],locs->getIJ(0,i),1e-12);
+ locs->decrRef();
+ //
+ m->decrRef();
+ f->decrRef();
+}
+
+void MEDCouplingBasicsTest::testP2Localization2()
+{
+ MEDCouplingUMesh *m=MEDCouplingUMesh::New("testP2_2",3);
+ const double coords[30]={0.33312787792955395, -0.35155740179580952, -0.03567564825034563, 1.307146326477638, -0.57234557776250305, -0.08608044208272235, 0.5551834466499993, 0.62324964668794192, -0.014638951108536295, 0.37761817224442129, -0.38324019806913578, 0.96283164472856886, 0.79494856035658679, -0.40628057809270046, 0.0021004190225864614, 1.023740446371799, 0.07665912970471335, -0.072889657161871096, 0.54564584619517376, 0.11132872093429744, 0.039647326652013051, 0.27164784387819052, -0.42018012100866675, 0.46563376500745146, 0.89501965094896418, -0.56148455362735061, 0.43337469695473035, 0.49118025152924394, 0.093884938060727313, 0.47216346905220891};
+ const int conn[10]={0,1,2,3,4,5,6,7,8,9};
+ DataArrayDouble *coo=DataArrayDouble::New();
+ coo->alloc(10,3);
+ std::copy(coords,coords+30,coo->getPointer());
+ m->setCoords(coo);
+ coo->decrRef();
+ m->allocateCells(1);
+ m->insertNextCell(INTERP_KERNEL::NORM_TETRA10,10,conn);
+ m->finishInsertingCells();
+ //
+ MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
+ f->setMesh(m);
+ DataArrayDouble *da=DataArrayDouble::New();
+ da->alloc(10,1);
+ const double vals1[10]={1.1,2.1,3.1,4.1,5.2,6.2,7.2,8.2,9.2,10.2};
+ std::copy(vals1,vals1+10,da->getPointer());
+ f->setArray(da);
+ da->decrRef();
+ //
+ const double loc[3]={0.64637931739890486, -0.16185896817550552, 0.22678966365273748};
+ DataArrayDouble *locs=f->getValueOnMulti(loc,1);
+ const double expected1[1]={10.0844021968047};
+ for(int i=0;i<1;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],locs->getIJ(0,i),1e-12);
+ locs->decrRef();
+ //
+ m->decrRef();
+ f->decrRef();
+}
+
+void MEDCouplingBasicsTest::testGetValueOn2()
+{
+ MEDCouplingUMesh *m=build2DTargetMesh_1();
+ MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
+ f->setMesh(m);
+ DataArrayDouble *arr=DataArrayDouble::New();
+ int nbOfCells=m->getNumberOfCells();
+ arr->alloc(nbOfCells,3);
+ f->setArray(arr);
+ arr->decrRef();
+ const double values1[15]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.};
+ std::copy(values1,values1+15,arr->getPointer());
+ const double loc[10]={-0.05,-0.05, 0.55,-0.25, 0.55,0.15, -0.05,0.45, 0.45,0.45};
+ f->checkCoherency();
+ DataArrayDouble *locs=f->getValueOnMulti(loc,5);
+ CPPUNIT_ASSERT_EQUAL(5,locs->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,locs->getNumberOfComponents());
+ for(int j=0;j<15;j++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(values1[j],locs->getIJ(0,j),1e-12);
+ locs->decrRef();
+ f->decrRef();
+ // Testing ON_NODES
+ f=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME);
+ f->setMesh(m);
+ arr=DataArrayDouble::New();
+ int nbOfNodes=m->getNumberOfNodes();
+ arr->alloc(nbOfNodes,3);
+ f->setArray(arr);
+ arr->decrRef();
+ const double values2[27]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.,12.,112.,10012.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.};
+ std::copy(values2,values2+27,arr->getPointer());
+ const double loc2[8]={0.5432,-0.2432, 0.5478,0.1528, 0.5432,-0.2432, 0.5432,-0.2432};
+ const double expected2[12]={9.0272, 109.0272, 10009.0272, 11.4124,111.4124,10011.4124, 9.0272, 109.0272, 10009.0272, 9.0272, 109.0272, 10009.0272};
+ f->checkCoherency();
+ locs=f->getValueOnMulti(loc2,4);
+ CPPUNIT_ASSERT_EQUAL(4,locs->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,locs->getNumberOfComponents());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],locs->getIJ(0,i),1e-12);
+ f->decrRef();
+ locs->decrRef();
+ //
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIGetIdsNotEqual1()
+{
+ DataArrayInt *d=DataArrayInt::New();
+ const int vals1[10]={2,3,5,6,8,5,5,6,1,-5};
+ d->alloc(10,1);
+ std::copy(vals1,vals1+10,d->getPointer());
+ DataArrayInt *d2=d->getIdsNotEqual(5);
+ CPPUNIT_ASSERT_EQUAL(7,d2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d2->getNumberOfComponents());
+ const int expected1[7]={0,1,3,4,7,8,9};
+ for(int i=0;i<7;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],d2->getIJ(0,i));
+ d->rearrange(2);
+ CPPUNIT_ASSERT_THROW(d->getIdsNotEqual(5),INTERP_KERNEL::Exception);
+ const int vals2[3]={-4,5,6};
+ std::vector<int> vals3(vals2,vals2+3);
+ d->rearrange(1);
+ DataArrayInt *d3=d->getIdsNotEqualList(vals3);
+ CPPUNIT_ASSERT_EQUAL(5,d3->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d3->getNumberOfComponents());
+ const int expected2[5]={0,1,4,8,9};
+ for(int i=0;i<5;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],d3->getIJ(0,i));
+ d3->decrRef();
+ d->decrRef();
+ d2->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIComputeOffsets1()
+{
+ DataArrayInt *d=DataArrayInt::New();
+ const int vals1[6]={3,5,1,2,0,8};
+ const int expected1[6]={0,3,8,9,11,11};
+ d->alloc(6,1);
+ std::copy(vals1,vals1+6,d->getPointer());
+ d->computeOffsets();
+ CPPUNIT_ASSERT_EQUAL(6,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],d->getIJ(0,i));
+ d->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMeshHexagonPrism1()
+{
+ const double coords[36]={
+ 0.8660254037844386, 0.5, 0.0, 0.0, 1.0, 0.0, -0.8660254037844386, 0.5, 0.0, -0.8660254037844386, -0.5, 0.0, 0.0, -1.0, 0.0, 0.8660254037844386, -0.5, 0.0,
+ 0.8660254037844386, 0.5, 2.0, 0.0, 1.0, 2.0, -0.8660254037844386, 0.5, 2.0, -0.8660254037844386, -0.5, 2.0, 0.0, -1.0, 2.0, 0.8660254037844386, -0.5, 2.0
+ };
+ const int conn[12]={1,2,3,4,5,0,7,8,9,10,11,6};
+ MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("MyFirstHexagonalPrism",3);
+ DataArrayDouble *coo=DataArrayDouble::New();
+ coo->alloc(12,3);
+ std::copy(coords,coords+36,coo->getPointer());
+ mesh->setCoords(coo);
+ mesh->allocateCells(1);
+ mesh->insertNextCell(INTERP_KERNEL::NORM_HEXGP12,12,conn);
+ mesh->finishInsertingCells();
+ coo->decrRef();
+ //
+ mesh->checkCoherency();
+ MEDCouplingFieldDouble *vols=mesh->getMeasureField(false);
+ CPPUNIT_ASSERT_EQUAL(1,vols->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,vols->getNumberOfComponents());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(-5.196152422706632,vols->getIJ(0,0),1e-12);
+ DataArrayDouble *bary=mesh->getBarycenterAndOwner();
+ CPPUNIT_ASSERT_EQUAL(1,bary->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,bary->getNumberOfComponents());
+ const double expected1[3]={0.,0.,1.};
+ for(int i=0;i<3;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],bary->getIJ(0,i),1e-12);
+ DataArrayInt *d1=DataArrayInt::New();
+ DataArrayInt *d2=DataArrayInt::New();
+ DataArrayInt *d3=DataArrayInt::New();
+ DataArrayInt *d4=DataArrayInt::New();
+ MEDCouplingUMesh *m2=mesh->buildDescendingConnectivity(d1,d2,d3,d4);
+ CPPUNIT_ASSERT_EQUAL(8,m2->getNumberOfCells());
+ const int expected4[8][6]={{1,2,3,4,5,0},{7,6,11,10,9,8},{1,7,8,2},{2,8,9,3},{3,9,10,4},{4,10,11,5},{5,11,6,0},{0,6,7,1}};
+ const INTERP_KERNEL::NormalizedCellType expected2[8]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4};
+ const int expected3[8]={6,6,4,4,4,4,4,4};
+ for(int i=0;i<8;i++)
+ {
+ CPPUNIT_ASSERT(m2->getTypeOfCell(i)==expected2[i]);
+ std::vector<int> v;
+ m2->getNodeIdsOfCell(i,v);
+ CPPUNIT_ASSERT((int)v.size()==expected3[i]);
+ CPPUNIT_ASSERT(std::equal(expected4[i],expected4[i]+expected3[i],v.begin()));
+ }
+ d1->decrRef();
+ d2->decrRef();
+ d3->decrRef();
+ d4->decrRef();
+ m2->decrRef();
+ //
+ mesh->convertAllToPoly();
+ CPPUNIT_ASSERT(INTERP_KERNEL::NORM_POLYHED==mesh->getTypeOfCell(0));
+ mesh->unPolyze();
+ CPPUNIT_ASSERT(INTERP_KERNEL::NORM_HEXGP12==mesh->getTypeOfCell(0));
+ CPPUNIT_ASSERT_EQUAL(13,mesh->getMeshLength());
+ //
+ vols->decrRef();
+ bary->decrRef();
+ mesh->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDADCheckIsMonotonic()
+{
+ DataArrayDouble *da=DataArrayDouble::New();
+ const double vals[4]={-1.,1.01,2.03,6.};
+ da->alloc(2,2);
+ std::copy(vals,vals+4,da->getPointer());
+ CPPUNIT_ASSERT_THROW(da->isMonotonic(1e-12),INTERP_KERNEL::Exception);
+ da->rearrange(1);
+ CPPUNIT_ASSERT(da->isMonotonic(1e-12));
+ da->checkMonotonic(1e-12);
+ da->setIJ(2,0,6.1);
+ CPPUNIT_ASSERT(!da->isMonotonic(1e-12));
+ CPPUNIT_ASSERT_THROW(da->checkMonotonic(1e-12),INTERP_KERNEL::Exception);
+ da->setIJ(2,0,5.99);
+ CPPUNIT_ASSERT(da->isMonotonic(1e-12));
+ CPPUNIT_ASSERT(!da->isMonotonic(1e-1));
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testCheckCoherencyDeeper1()
+{
+ MEDCouplingUMesh *m=build3DSourceMesh_1();
+ m->checkCoherency();
+ m->checkCoherency1();
+ m->getNodalConnectivity()->setIJ(8,0,-1);
+ m->checkCoherency();
+ CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception);
+ m->getNodalConnectivity()->setIJ(8,0,-6);
+ m->checkCoherency();
+ CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception);
+ m->getNodalConnectivity()->setIJ(8,0,9);//9>=NbOfNodes
+ m->checkCoherency();
+ CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception);
+ m->getNodalConnectivity()->setIJ(8,0,8);//OK
+ m->checkCoherency();
+ m->checkCoherency1();
+ const int elts[2]={1,5};
+ std::vector<int> eltsV(elts,elts+2);
+ m->convertToPolyTypes(eltsV);
+ m->checkCoherency();
+ m->checkCoherency1();
+ m->getNodalConnectivity()->setIJ(2,0,9);//9>=NbOfNodes
+ m->checkCoherency();
+ CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception);
+ m->getNodalConnectivity()->setIJ(2,0,-3);
+ m->checkCoherency();
+ CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception);
+ m->getNodalConnectivity()->setIJ(2,0,-1);
+ m->checkCoherency();
+ CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception);//Throw because cell#0 is not a polyhedron
+ m->getNodalConnectivity()->setIJ(2,0,4);
+ m->checkCoherency();
+ m->checkCoherency1();
+ m->getNodalConnectivity()->setIJ(7,0,-1);
+ m->checkCoherency();
+ m->checkCoherency1();//OK because we are in polyhedron connec
+ m->getNodalConnectivity()->setIJ(36,0,14);
+ m->checkCoherency();
+ CPPUNIT_ASSERT_THROW(m->checkCoherency1(),INTERP_KERNEL::Exception);//Throw beacause now cell 5 is a TETRA4 (14) so mimatch of number index and static type.
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUnPolyze2()
+{
+ MEDCouplingUMesh *m=MEDCouplingUMesh::New("jjj",3);
+ DataArrayDouble *coo=DataArrayDouble::New();
+ coo->alloc(4,3);
+ coo->rearrange(1);
+ coo->iota(0);
+ coo->rearrange(3);
+ m->setCoords(coo);
+ coo->decrRef();
+ m->allocateCells(2);
+ const int conn[4]={0,1,2,3};
+ m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn);
+ m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn);
+ m->finishInsertingCells();
+ std::vector<const MEDCouplingUMesh *> ms(4,m);
+ MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(ms);
+ std::vector<int> temp(1,2);
+ m2->convertToPolyTypes(temp);
+ m2->unPolyze();
+ CPPUNIT_ASSERT(INTERP_KERNEL::NORM_TETRA4==m2->getTypeOfCell(2));
+ CPPUNIT_ASSERT_EQUAL(40,m2->getMeshLength());
+ std::vector<int> temp2;
+ m2->getNodeIdsOfCell(2,temp2);
+ CPPUNIT_ASSERT(4==(int)temp2.size());
+ CPPUNIT_ASSERT(std::equal(conn,conn+4,temp2.begin()));
+ m2->checkCoherency1();
+ MEDCouplingMesh *m3=m2->deepCpy();
+ m2->unPolyze();
+ CPPUNIT_ASSERT(m3->isEqual(m2,1e-12));
+ m3->decrRef();
+ m->decrRef();
+ m2->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDACpyFrom1()
+{
+ DataArrayDouble *d=DataArrayDouble::New();
+ d->alloc(12,1);
+ d->iota(14.);
+ d->rearrange(3);
+ d->setName("Toto");
+ d->setInfoOnComponent(0,"X [m]");
+ d->setInfoOnComponent(1,"Y [m]");
+ d->setInfoOnComponent(2,"Z [m]");
+ //
+ DataArrayDouble *d1=DataArrayDouble::New();
+ CPPUNIT_ASSERT(!d->isEqual(*d1,1e-12));
+ d1->cpyFrom(*d);
+ CPPUNIT_ASSERT(d->isEqual(*d1,1e-12));
+ d1->cpyFrom(*d);
+ CPPUNIT_ASSERT(d->isEqual(*d1,1e-12));
+ d1->rearrange(2);
+ CPPUNIT_ASSERT(!d->isEqual(*d1,1e-12));
+ d1->cpyFrom(*d);
+ CPPUNIT_ASSERT(d->isEqual(*d1,1e-12));
+ //
+ DataArrayInt *d2=d->convertToIntArr();
+ DataArrayInt *d4=DataArrayInt::New();
+ CPPUNIT_ASSERT(!d2->isEqual(*d4));
+ d4->cpyFrom(*d2);
+ CPPUNIT_ASSERT(d2->isEqual(*d4));
+ d4->cpyFrom(*d2);
+ CPPUNIT_ASSERT(d2->isEqual(*d4));
+ d4->rearrange(2);
+ CPPUNIT_ASSERT(!d2->isEqual(*d4));
+ d4->cpyFrom(*d2);
+ CPPUNIT_ASSERT(d2->isEqual(*d4));
+ //
+ d->decrRef();
+ d1->decrRef();
+ d2->decrRef();
+ d4->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAITransformWithIndArr1()
+{
+ const int tab1[4]={17,18,22,19};
+ const int tab2[12]={0,1,1,3,3,0,1,3,2,2,3,0};
+ const int expected[12]={17,18,18,19,19,17,18,19,22,22,19,17};
+ DataArrayInt *d=DataArrayInt::New();
+ d->alloc(4,1);
+ std::copy(tab1,tab1+4,d->getPointer());
+ DataArrayInt *d1=DataArrayInt::New();
+ d1->alloc(12,1);
+ std::copy(tab2,tab2+12,d1->getPointer());
+ //
+ d1->transformWithIndArr(d->getConstPointer(),d->getConstPointer()+d->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(12,d1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d1->getNumberOfComponents());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected[i],d1->getIJ(i,0));
+ //
+ d->decrRef();
+ d1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIBuildPermArrPerLevel1()
+{
+ const int arr[12]={2,0,1,1,0,1,2,0,1,1,0,0};
+ const int expected1[12]={10,0,5,6,1,7,11,2,8,9,3,4};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(12,1);
+ std::copy(arr,arr+12,da->getPointer());
+ DataArrayInt *da2=da->buildPermArrPerLevel();
+ CPPUNIT_ASSERT_EQUAL(12,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0));
+ da->decrRef();
+ da2->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIOperations1()
+{
+ const int arr1[12]={-1,-2,4,7,3,2,6,6,4,3,0,1};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(4,3);
+ std::copy(arr1,arr1+12,da->getPointer());
+ DataArrayInt *da1=DataArrayInt::New();
+ da1->alloc(12,1);
+ da1->iota(2);
+ CPPUNIT_ASSERT_THROW(DataArrayInt::Add(da,da1),INTERP_KERNEL::Exception);//not same number of tuples/Components
+ da1->rearrange(3);
+ DataArrayInt *da2=DataArrayInt::Add(da,da1);
+ CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());
+ const int expected1[12]={1,1,8,12,9,9,14,15,14,14,12,14};
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(0,i));
+ da2->decrRef();
+ da1->substractEqual(da);
+ const int expected2[12]={3,5,0,-2,3,5,2,3,6,8,12,12};
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],da1->getIJ(0,i));
+ da1->rearrange(1); da1->iota(2); da1->rearrange(3);
+ da1->addEqual(da);
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],da1->getIJ(0,i));
+ da1->rearrange(1); da1->iota(2); da1->rearrange(3);
+ da2=DataArrayInt::Multiply(da,da1);
+ CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());
+ const int expected3[12]={-2,-6,16,35,18,14,48,54,40,33,0,13};
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected3[i],da2->getIJ(0,i));
+ da2->decrRef();
+ da->divideEqual(da1);
+ CPPUNIT_ASSERT_EQUAL(4,da->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da->getNumberOfComponents());
+ const int expected4[12]={0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0};
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected4[i],da->getIJ(0,i));
+ std::copy(arr1,arr1+12,da->getPointer());
+ da1->multiplyEqual(da);
+ CPPUNIT_ASSERT_EQUAL(4,da1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da1->getNumberOfComponents());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected3[i],da1->getIJ(0,i));
+ da1->rearrange(1); da1->iota(2); da1->rearrange(3);
+ da2=DataArrayInt::Divide(da,da1);
+ CPPUNIT_ASSERT_EQUAL(4,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da2->getNumberOfComponents());
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected4[i],da2->getIJ(0,i));
+ da2->decrRef();
+ da1->applyInv(321);
+ CPPUNIT_ASSERT_EQUAL(4,da1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da1->getNumberOfComponents());
+ const int expected5[12]={160,107,80,64,53,45,40,35,32,29,26,24};
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected5[i],da1->getIJ(0,i));
+ da1->applyDivideBy(2);
+ CPPUNIT_ASSERT_EQUAL(4,da1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,da1->getNumberOfComponents());
+ const int expected6[12]={80,53,40,32,26,22,20,17,16,14,13,12};
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected6[i],da1->getIJ(0,i));
+ const int expected7[12]={3,4,5,4,5,1,6,3,2,0,6,5};
+ da1->applyModulus(7);
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected7[i],da1->getIJ(0,i));
+ da1->applyLin(1,1);
+ const int expected8[12]={3,3,3,3,3,1,3,3,0,0,3,3};
+ da1->applyRModulus(3);
+ for(int i=0;i<12;i++)
+ CPPUNIT_ASSERT_EQUAL(expected8[i],da1->getIJ(0,i));
+ //
+ da1->decrRef();
+ da->decrRef();
+}
+
+void MEDCouplingBasicsTest::testEmulateMEDMEMBDC1()
+{
+ MEDCouplingUMesh *m1=0;
+ MEDCouplingUMesh *m=buildPointe_1(m1);
+ DataArrayInt *da1=DataArrayInt::New();
+ DataArrayInt *da2=DataArrayInt::New();
+ DataArrayInt *da3=0;
+ DataArrayInt *da4=0;
+ DataArrayInt *da5=0;
+ DataArrayInt *da0=0;
+ MEDCouplingUMesh *m2=m->emulateMEDMEMBDC(m1,da1,da2,da3,da4,da5,da0);
+ const int expected0[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46};
+ const int expected1[6]={1,32,29,23,41,36};
+ CPPUNIT_ASSERT_EQUAL(47,da0->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da0->getNumberOfComponents());
+ for(int i=0;i<47;i++)
+ CPPUNIT_ASSERT_EQUAL(expected0[i],da0->getIJ(0,i));
+ CPPUNIT_ASSERT_EQUAL(6,da5->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da5->getNumberOfComponents());
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],da5->getIJ(0,i));
+ const int expected2[70]={0,1,2,3,4,0,5,6,7,4,8,9,1,7,10,11,12,13,14,5,15,16,17,8,18,19,20,10,21,22,23,2,13,24,25,21,16,26,27,12,19,28,29,15,22,30,31,18,36,26,28,30,24,37,32,33,34,35,38,36,39,40,41,42,37,38,43,44,45,46};
+ CPPUNIT_ASSERT_EQUAL(70,da1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da1->getNumberOfComponents());
+ for(int i=0;i<70;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],da1->getIJ(0,i));
+ const int expected3[17]={0,4,8,12,16,20,24,28,32,36,40,44,48,53,58,64,70};
+ CPPUNIT_ASSERT_EQUAL(17,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ for(int i=0;i<17;i++)
+ CPPUNIT_ASSERT_EQUAL(expected3[i],da2->getIJ(0,i));
+ const int expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,53,54,55,56,58,60,62,63,64,65,66,67,68,69,70};
+ //const int expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,54,56,57,58,59,60,62,63,64,65,66,67,68,69,70};
+ CPPUNIT_ASSERT_EQUAL(48,da4->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da4->getNumberOfComponents());
+ for(int i=0;i<48;i++)
+ CPPUNIT_ASSERT_EQUAL(expected4[i],da4->getIJ(0,i));
+ const int expected5[70]={0,1,0,3,0,7,0,1,2,1,4,1,2,3,2,5,2,3,6,3,4,9,4,8,4,5,10,5,9,5,6,11,6,10,6,7,8,7,11,7,8,12,8,9,12,9,10,12,10,11,12,11,13,13,13,13,12,14,13,15,14,15,14,14,14,14,15,15,15,15};
+ CPPUNIT_ASSERT_EQUAL(70,da3->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da3->getNumberOfComponents());
+ for(int i=0;i<70;i++)
+ CPPUNIT_ASSERT_EQUAL(expected5[i],da3->getIJ(0,i));
+ //
+ da0->decrRef();
+ da1->decrRef();
+ da2->decrRef();
+ da3->decrRef();
+ da4->decrRef();
+ da5->decrRef();
+ //
+ m2->decrRef();
+ m1->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testGetLevArrPerCellTypes1()
+{
+ MEDCouplingUMesh *m1=0;
+ MEDCouplingUMesh *m=buildPointe_1(m1);
+ m1->decrRef();
+ DataArrayInt *d0=DataArrayInt::New();
+ DataArrayInt *d1=DataArrayInt::New();
+ DataArrayInt *d2=DataArrayInt::New();
+ DataArrayInt *d3=DataArrayInt::New();
+ m1=m->buildDescendingConnectivity(d0,d1,d2,d3);
+ d0->decrRef(); d1->decrRef(); d2->decrRef(); d3->decrRef();
+ INTERP_KERNEL::NormalizedCellType order[2]={INTERP_KERNEL::NORM_TRI3,INTERP_KERNEL::NORM_QUAD4};
+ DataArrayInt *da1=0;
+ DataArrayInt *da0=m1->getLevArrPerCellTypes(order,order+2,da1);
+ const int expected0[47]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1};
+ const int expected1[47]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46};
+ CPPUNIT_ASSERT_EQUAL(47,da0->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da0->getNumberOfComponents());
+ for(int i=0;i<47;i++)
+ CPPUNIT_ASSERT_EQUAL(expected0[i],da0->getIJ(0,i));
+ CPPUNIT_ASSERT_EQUAL(2,da1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da1->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(36,da1->getIJ(0,0));//36 TRI3
+ CPPUNIT_ASSERT_EQUAL(11,da1->getIJ(1,0));//11 QUAD4
+ //
+ DataArrayInt *da2=da0->buildPermArrPerLevel();
+ //
+ CPPUNIT_ASSERT_EQUAL(47,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ for(int i=0;i<47;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(0,i));
+ da2->decrRef();
+ da0->decrRef();
+ da1->decrRef();
+ //
+ m->decrRef();
+ m1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testSortCellsInMEDFileFrmt1()
+{
+ MEDCouplingUMesh *m1=0;
+ MEDCouplingUMesh *m=buildPointe_1(m1);
+ MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCpy();
+ m->setCoords(0);
+ const int vals[16]={0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13};
+ DataArrayInt *da=DataArrayInt::New();
+ da->alloc(16,1);
+ std::copy(vals,vals+16,da->getPointer());
+ DataArrayInt *daa=da->invertArrayN2O2O2N(16);
+ m->renumberCells(daa->getConstPointer(),false);
+ daa->decrRef();
+ DataArrayInt *da2=m->sortCellsInMEDFileFrmt();
+ CPPUNIT_ASSERT(m2->isEqual(m2,1e-12));
+ CPPUNIT_ASSERT(da->isEqual(*da2));
+ m2->decrRef();
+ da2->decrRef();
+ da->decrRef();
+ m1->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testBuildPartAndReduceNodes1()
+{
+ MEDCouplingMesh *m=build2DTargetMesh_1();
+ const int arr[2]={1,0};
+ DataArrayInt *da;
+ MEDCouplingMesh *m2=m->buildPartAndReduceNodes(arr,arr+2,da);
+ CPPUNIT_ASSERT_EQUAL(5,m2->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(2,m2->getNumberOfCells());
+ MEDCouplingFieldDouble *f=m2->getMeasureField(true);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,f->getArray()->getIJ(0,0),1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,f->getArray()->getIJ(1,0),1e-12);
+ f->decrRef();
+ da->decrRef();
+ m2->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAITransformWithIndArrR1()
+{
+ const int tab1[6]={2,4,5,3,6,7};
+ const int tab2[12]={-1,-1,0,1,2,3,4,5,-1,-1,-1,-1};
+ const int expected[6]={0,3,1,2,4,5};
+ DataArrayInt *d=DataArrayInt::New();
+ d->alloc(6,1);
+ std::copy(tab1,tab1+6,d->getPointer());
+ DataArrayInt *d1=DataArrayInt::New();
+ d1->alloc(12,1);
+ std::copy(tab2,tab2+12,d1->getPointer());
+ //
+ DataArrayInt *d3=d->transformWithIndArrR(d1->getConstPointer(),d1->getConstPointer()+d1->getNbOfElems());
+ CPPUNIT_ASSERT_EQUAL(6,d3->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d3->getNumberOfComponents());
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(expected[i],d3->getIJ(i,0));
+ d3->decrRef();
+ //
+ d->decrRef();
+ d1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAISplitByValueRange1()
+{
+ const int val1[9]={6,5,0,3,2,7,8,1,4};
+ const int val2[3]={0,4,9};
+ DataArrayInt *d=DataArrayInt::New();
+ d->alloc(9,1);
+ std::copy(val1,val1+9,d->getPointer());
+ DataArrayInt *e=0,*f=0,*g=0;
+ d->splitByValueRange(val2,val2+3,e,f,g);
+ CPPUNIT_ASSERT_EQUAL(9,e->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,e->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(9,f->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,f->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(2,g->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,g->getNumberOfComponents());
+ //
+ const int expected1[9]={1,1,0,0,0,1,1,0,1};
+ const int expected2[9]={2,1,0,3,2,3,4,1,0};
+ for(int i=0;i<9;i++)
+ {
+ CPPUNIT_ASSERT_EQUAL(expected1[i],e->getIJ(i,0));
+ CPPUNIT_ASSERT_EQUAL(expected2[i],f->getIJ(i,0));
+ }
+ CPPUNIT_ASSERT_EQUAL(0,g->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,g->getIJ(1,0));
+ //
+ e->decrRef();
+ f->decrRef();
+ g->decrRef();
+ //
+ d->setIJ(6,0,9);
+ CPPUNIT_ASSERT_THROW(d->splitByValueRange(val2,val2+3,e,f,g),INTERP_KERNEL::Exception);
+ //
+ d->decrRef();
+}
+
+void MEDCouplingBasicsTest::testUMeshSplitProfilePerType1()
+{
+ const int val0[5]={2,0,1,3,4};
+ MEDCouplingUMesh *m=build2DTargetMesh_1();
+ m->renumberCells(val0,false);
+ std::vector<int> code;
+ std::vector<DataArrayInt *> idsInPflPerType;
+ std::vector<DataArrayInt *> pfls;
+ //
+ const int val1[3]={0,2,3};
+ DataArrayInt *d=DataArrayInt::New();
+ d->alloc(3,1);
+ d->setName("sup");
+ std::copy(val1,val1+3,d->getPointer());
+ m->splitProfilePerType(d,code,idsInPflPerType,pfls);
+ CPPUNIT_ASSERT_EQUAL(6,(int)code.size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType.size());
+ const int expected1[6]={3,1,0, 4,2,1};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],code[i]);
+ CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[1]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getIJ(1,0));
+ idsInPflPerType[0]->decrRef();
+ idsInPflPerType[1]->decrRef();
+ CPPUNIT_ASSERT_EQUAL(2,(int)pfls.size());
+ CPPUNIT_ASSERT(std::string("sup")==pfls[0]->getName());
+ CPPUNIT_ASSERT_EQUAL(1,pfls[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,pfls[0]->getIJ(0,0));
+ CPPUNIT_ASSERT(std::string("sup")==pfls[1]->getName());
+ CPPUNIT_ASSERT_EQUAL(2,pfls[1]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,pfls[1]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,pfls[1]->getIJ(1,0));
+ pfls[0]->decrRef();
+ pfls[1]->decrRef();
+ d->decrRef();
+ idsInPflPerType.clear();
+ pfls.clear();
+ code.clear();
+ //
+ const int val2[4]={0,2,3,4};// all quad4 are selected here ! So no profile for Quads
+ d=DataArrayInt::New();
+ d->alloc(4,1);
+ std::copy(val2,val2+4,d->getPointer());
+ m->splitProfilePerType(d,code,idsInPflPerType,pfls);
+ CPPUNIT_ASSERT_EQUAL(6,(int)code.size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType.size());
+ const int expected2[6]={3,1,0, 4,3,-1};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(expected2[i],code[i]);
+ CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(3,idsInPflPerType[1]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[1]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(3,idsInPflPerType[1]->getIJ(2,0));
+ idsInPflPerType[0]->decrRef();
+ idsInPflPerType[1]->decrRef();
+ CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size());
+ CPPUNIT_ASSERT_EQUAL(1,pfls[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,pfls[0]->getIJ(0,0));
+ pfls[0]->decrRef();
+ d->decrRef();
+ idsInPflPerType.clear();
+ pfls.clear();
+ code.clear();
+ //
+ const int val3[3]={1,0,2};// all tri3 are selected here but not in the same order ! Profile requested for Tri3
+ d=DataArrayInt::New();
+ d->alloc(3,1);
+ std::copy(val3,val3+3,d->getPointer());
+ m->splitProfilePerType(d,code,idsInPflPerType,pfls);
+ CPPUNIT_ASSERT_EQUAL(6,(int)code.size());
+ CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType.size());
+ const int expected3[6]={3,2,0, 4,1,1};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_EQUAL(expected3[i],code[i]);
+ CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[0]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[1]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getIJ(0,0));
+ idsInPflPerType[0]->decrRef();
+ idsInPflPerType[1]->decrRef();
+ CPPUNIT_ASSERT_EQUAL(2,(int)pfls.size());
+ CPPUNIT_ASSERT_EQUAL(2,pfls[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,pfls[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(0,pfls[0]->getIJ(1,0));
+ CPPUNIT_ASSERT_EQUAL(0,pfls[1]->getIJ(0,0));
+ pfls[0]->decrRef();
+ pfls[1]->decrRef();
+ d->decrRef();
+ idsInPflPerType.clear();
+ pfls.clear();
+ code.clear();
+ //
+ const int val4[2]={3,4};// all tri3 are selected here but not in the same order ! Profile requested for Tri3
+ d=DataArrayInt::New();
+ d->alloc(2,1);
+ std::copy(val4,val4+2,d->getPointer());
+ m->splitProfilePerType(d,code,idsInPflPerType,pfls);
+ CPPUNIT_ASSERT_EQUAL(3,(int)code.size());
+ CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType.size());
+ const int expected4[3]={4,2,0};
+ for(int i=0;i<3;i++)
+ CPPUNIT_ASSERT_EQUAL(expected4[i],code[i]);
+ CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[0]->getIJ(1,0));
+ idsInPflPerType[0]->decrRef();
+ CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size());
+ CPPUNIT_ASSERT_EQUAL(2,pfls[0]->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,pfls[0]->getIJ(0,0));
+ CPPUNIT_ASSERT_EQUAL(2,pfls[0]->getIJ(1,0));
+ pfls[0]->decrRef();
+ d->decrRef();
+ idsInPflPerType.clear();
+ pfls.clear();
+ code.clear();
+ //
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIBuildExplicitArrByRanges1()
+{
+ DataArrayInt *d=DataArrayInt::New();
+ d->alloc(3,1);
+ const int vals1[3]={0,2,3};
+ std::copy(vals1,vals1+3,d->getPointer());
+ DataArrayInt *e=DataArrayInt::New();
+ e->alloc(6,1);
+ const int vals2[6]={0,3,6,10,14,20};
+ std::copy(vals2,vals2+6,e->getPointer());
+ //
+ DataArrayInt *f=d->buildExplicitArrByRanges(e);
+ CPPUNIT_ASSERT_EQUAL(11,f->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,f->getNumberOfComponents());
+ const int expected1[11]={0,1,2,6,7,8,9,10,11,12,13};
+ for(int i=0;i<11;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],f->getIJ(i,0));
+ //
+ f->decrRef();
+ e->decrRef();
+ d->decrRef();
+}
+
+void MEDCouplingBasicsTest::testDAIComputeOffsets2()
+{
+ DataArrayInt *d=DataArrayInt::New();
+ const int vals1[6]={3,5,1,2,0,8};
+ const int expected1[7]={0,3,8,9,11,11,19};
+ d->alloc(6,1);
+ std::copy(vals1,vals1+6,d->getPointer());
+ d->computeOffsets2();
+ CPPUNIT_ASSERT_EQUAL(7,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ for(int i=0;i<7;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],d->getIJ(0,i));
+ d->decrRef();
+}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
int connITT[201]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1029, 1058, 1087, 1116, 1145, 1174, 1203,
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingBasicsTest.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingMemArray.hxx"
#include "Interpolation2D.txx"
-#include "Interpolation3DSurf.txx"
+#include "Interpolation3DSurf.hxx"
#include "Interpolation3D.txx"
#include "InterpolationCC.txx"
#include "InterpolationCU.txx"
-#include "Interpolation2DCurve.txx"
+#include "Interpolation2DCurve.hxx"
#include "Interpolation1D.txx"
#include "MEDCouplingNormalizedUnstructuredMesh.txx"
INTERP_KERNEL::Interpolation3D myInterpolator;
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
- myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
- CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(8.e6,sumAll(res),1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[0][0],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(41666.66666666667,res[0][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[0][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[0][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[0][10],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(41666.66666666667,res[1][2],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[1][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[1][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[2][0],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[2][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[2][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[2][9],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[2][11],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(395833.3333333333,res[3][0],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[3][2],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333331,res[3][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[3][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(395833.3333333333,res[3][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[4][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[4][4],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[4][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[4][9],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[4][10],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[5][2],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333331,res[5][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[5][4],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(395833.3333333333,res[5][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(395833.3333333333,res[5][10],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[6][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(250000,res[6][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(541666.6666666667,res[6][9],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[6][11],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333331,res[7][0],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(479166.6666666667,res[7][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(333333.3333333333,res[7][2],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(624999.9999999997,res[7][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(479166.6666666667,res[7][4],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(479166.6666666667,res[7][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333333,res[7][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333331,res[7][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333333,res[7][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333333,res[7][9],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333331,res[7][10],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(479166.6666666667,res[7][11],1e-7);
+ INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
+ for ( int i = 0; i < 4; ++i )
+ {
+ myInterpolator.setSplittingPolicy( sp[i] );
+ res.clear();
+ myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
+ CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(8.e6,sumAll(res),1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[0][0],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(41666.66666666667,res[0][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[0][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[0][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[0][10],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(41666.66666666667,res[1][2],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[1][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[1][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[2][0],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[2][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[2][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[2][9],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[2][11],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(395833.3333333333,res[3][0],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[3][2],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333331,res[3][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[3][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(395833.3333333333,res[3][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[4][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[4][4],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[4][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333333,res[4][9],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[4][10],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[5][2],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(20833.33333333331,res[5][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[5][4],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(395833.3333333333,res[5][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(395833.3333333333,res[5][10],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[6][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(250000,res[6][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(541666.6666666667,res[6][9],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[6][11],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333331,res[7][0],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(479166.6666666667,res[7][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(333333.3333333333,res[7][2],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(624999.9999999997,res[7][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(479166.6666666667,res[7][4],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(479166.6666666667,res[7][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333333,res[7][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333331,res[7][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333333,res[7][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333333,res[7][9],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(83333.33333333331,res[7][10],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(479166.6666666667,res[7][11],1e-7);
+ }
//clean up
sourceMesh->decrRef();
targetMesh->decrRef();
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
- myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
- CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][9],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][4],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][5],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][11],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
+ for ( int i = 0; i < 4; ++i )
+ {
+ myInterpolator.setSplittingPolicy( sp[i] );
+ res.clear();
+ myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
+ CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][9],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][4],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][5],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][11],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ }
//clean up
sourceMesh->decrRef();
targetMesh->decrRef();
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
- myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
- CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][9],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][4],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][5],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][11],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
+ for ( int i = 0; i < 4; ++i )
+ {
+ myInterpolator.setSplittingPolicy( sp[i] );
+ res.clear();
+ myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
+ CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][9],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][4],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][5],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][11],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ }
//clean up
sourceMesh->decrRef();
targetMesh->decrRef();
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
- myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
- CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][9],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][4],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][5],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][11],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
+ for ( int i = 0; i < 4; ++i )
+ {
+ myInterpolator.setSplittingPolicy( sp[i] );
+ res.clear();
+ myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
+ CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][9],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][4],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][5],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][11],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ }
//clean up
sourceMesh->decrRef();
targetMesh->decrRef();
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
- myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
- CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][10],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][9],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][4],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][5],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][11],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
+ for ( int i = 0; i < 4; ++i )
+ {
+ myInterpolator.setSplittingPolicy( sp[i] );
+ res.clear();
+ myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0");
+ CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][10],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][9],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][4],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][5],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][11],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ }
//clean up
sourceMesh->decrRef();
targetMesh->decrRef();
INTERP_KERNEL::Interpolation3D myInterpolator;
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
- myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
- CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(244444.4444444445,res[0][4],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[0][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(291666.6666666666,res[0][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[0][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[1][0],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(140277.7777777778,res[1][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(119444.4444444444,res[1][2],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[1][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(119444.4444444444,res[1][4],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[1][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(26388.88888888889,res[1][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(348611.1111111111,res[2][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888888,res[2][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(244444.4444444444,res[3][2],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333334,res[3][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(291666.6666666666,res[3][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[3][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(536111.111111111,res[4][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(297222.2222222221,res[4][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(223611.1111111111,res[5][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[5][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[5][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(26388.88888888892,res[5][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[6][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(536111.1111111109,res[7][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(297222.2222222221,res[7][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.1111111111,res[8][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.11111111111,res[8][2],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666666,res[8][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.11111111111,res[8][4],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[8][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[8][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1466666.666666668,res[8][7],1e-7);
+ INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
+ for ( int i = 0; i < 4; ++i )
+ {
+ myInterpolator.setSplittingPolicy( sp[i] );
+ res.clear();
+ myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
+ CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(244444.4444444445,res[0][4],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[0][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(291666.6666666666,res[0][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[0][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[1][0],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(140277.7777777778,res[1][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(119444.4444444444,res[1][2],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[1][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(119444.4444444444,res[1][4],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[1][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(26388.88888888889,res[1][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(348611.1111111111,res[2][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888888,res[2][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(244444.4444444444,res[3][2],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333334,res[3][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(291666.6666666666,res[3][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[3][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(536111.111111111,res[4][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(297222.2222222221,res[4][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(223611.1111111111,res[5][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[5][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[5][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(26388.88888888892,res[5][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[6][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(536111.1111111109,res[7][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(297222.2222222221,res[7][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.1111111111,res[8][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.11111111111,res[8][2],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666666,res[8][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.11111111111,res[8][4],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[8][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[8][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1466666.666666668,res[8][7],1e-7);
+ }
//clean up
sourceMesh->decrRef();
targetMesh->decrRef();
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
- myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
- CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][4],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][2],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][5],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[8][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(9.,sumAll(res),1e-12);
+ INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
+ for ( int i = 0; i < 4; ++i )
+ {
+ myInterpolator.setSplittingPolicy( sp[i] );
+ res.clear();
+ myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1");
+ CPPUNIT_ASSERT_EQUAL(9,(int)res.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[0][4],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][2],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][5],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[6][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[7][3],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[8][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(9.,sumAll(res),1e-12);
+ }
//clean up
sourceMesh->decrRef();
targetMesh->decrRef();
INTERP_KERNEL::Interpolation3D myInterpolator;
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
- myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
- CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[0][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(140277.7777777778,res[1][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(223611.1111111111,res[1][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.1111111111,res[1][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(119444.4444444444,res[2][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(244444.4444444445,res[2][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.11111111111,res[2][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[3][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[3][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[3][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(536111.1111111109,res[3][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[3][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(244444.4444444445,res[4][0],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(119444.4444444445,res[4][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.11111111111,res[4][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[5][0],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[5][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(536111.1111111109,res[5][4],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[5][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666666,res[5][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(291666.6666666666,res[6][0],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(26388.88888888889,res[6][1],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(348611.1111111112,res[6][2],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(291666.6666666667,res[6][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666666,res[6][8],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[7][0],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[7][2],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[7][3],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(297222.2222222221,res[7][4],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(26388.88888888892,res[7][5],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[7][6],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(297222.2222222222,res[7][7],1e-7);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1466666.666666668,res[7][8],1e-7);
+ INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
+ for ( int i = 0; i < 4; ++i )
+ {
+ myInterpolator.setSplittingPolicy( sp[i] );
+ res.clear();
+ myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
+ CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[0][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(140277.7777777778,res[1][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(223611.1111111111,res[1][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.1111111111,res[1][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(119444.4444444444,res[2][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(244444.4444444445,res[2][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.11111111111,res[2][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[3][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[3][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[3][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(536111.1111111109,res[3][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666667,res[3][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(244444.4444444445,res[4][0],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(119444.4444444445,res[4][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(11111.11111111111,res[4][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(145833.3333333333,res[5][0],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[5][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(536111.1111111109,res[5][4],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(125000,res[5][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666666,res[5][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(291666.6666666666,res[6][0],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(26388.88888888889,res[6][1],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(348611.1111111112,res[6][2],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(291666.6666666667,res[6][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(166666.6666666666,res[6][8],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[7][0],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[7][2],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(151388.8888888889,res[7][3],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(297222.2222222221,res[7][4],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(26388.88888888892,res[7][5],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[7][6],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(297222.2222222222,res[7][7],1e-7);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1466666.666666668,res[7][8],1e-7);
+ }
//clean up
sourceMesh->decrRef();
targetMesh->decrRef();
std::vector<std::map<int,double> > res;
myInterpolator.setPrecision(1e-12);
myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator);
- myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
- CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(3.75,res[0][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.25,res[0][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[1][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][5],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[1][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[2][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][3],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[2][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[3][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][7],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[3][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[4][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[4][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[5][1],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][4],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[5][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[6][0],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[6][2],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[6][3],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[6][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1.25,res[7][6],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(3.75,res[7][8],1e-12);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
+ for ( int i = 0; i < 4; ++i )
+ {
+ myInterpolator.setSplittingPolicy( sp[i] );
+ res.clear();
+ myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
+ CPPUNIT_ASSERT_EQUAL(8,(int)res.size());
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3.75,res[0][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.25,res[0][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[1][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[1][5],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[1][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[2][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[2][3],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[2][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[3][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[3][7],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[3][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[4][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[4][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[4][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[5][1],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,res[5][4],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.5,res[5][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[6][0],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[6][2],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[6][3],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[6][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1.25,res[7][6],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3.75,res[7][8],1e-12);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(21.,sumAll(res),1e-12);
+ }
//clean up
sourceMesh->decrRef();
targetMesh->decrRef();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDCouplingRemapperTest.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldTemplate.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingRemapper.hxx"
meshTF->decrRef();
}
+void MEDCouplingRemapperTest::testPrepareEx1()
+{
+ MEDCouplingUMesh *sourceMesh=MEDCouplingBasicsTest::build2DSourceMesh_1();
+ MEDCouplingUMesh *targetMesh=build2DTargetMesh_3();
+ //
+ MEDCouplingRemapper remapper;
+ remapper.setPrecision(1e-12);
+ remapper.setIntersectionType(INTERP_KERNEL::Triangulation);
+ MEDCouplingFieldTemplate *srcFt=MEDCouplingFieldTemplate::New(ON_CELLS);
+ MEDCouplingFieldTemplate *trgFt=MEDCouplingFieldTemplate::New(ON_CELLS);
+ srcFt->setMesh(sourceMesh);
+ trgFt->setMesh(targetMesh);
+ CPPUNIT_ASSERT_EQUAL(1,remapper.prepareEx(srcFt,trgFt));
+ srcFt->decrRef();
+ trgFt->decrRef();
+ MEDCouplingFieldDouble *srcField=MEDCouplingFieldDouble::New(ON_CELLS);
+ srcField->setNature(ConservativeVolumic);
+ srcField->setMesh(sourceMesh);
+ DataArrayDouble *array=DataArrayDouble::New();
+ array->alloc(sourceMesh->getNumberOfCells(),1);
+ srcField->setArray(array);
+ double *ptr=array->getPointer();
+ for(int i=0;i<sourceMesh->getNumberOfCells();i++)
+ ptr[i]=(double)(i+7);
+ array->decrRef();
+ MEDCouplingFieldDouble *trgfield=remapper.transferField(srcField,4.220173);
+ const double *values=trgfield->getArray()->getConstPointer();
+ const double valuesExpected[4]={7.75, 7.0625, 4.220173,8.0};
+ CPPUNIT_ASSERT_EQUAL(4,trgfield->getArray()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,trgfield->getArray()->getNumberOfComponents());
+ for(int i0=0;i0<4;i0++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i0],values[i0],1e-12);
+ trgfield->decrRef();
+ srcField->decrRef();
+ sourceMesh->decrRef();
+ targetMesh->decrRef();
+}
+
MEDCouplingUMesh *MEDCouplingRemapperTest::build1DTargetMesh_2()
{
double targetCoords[20]={
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MEDCOUPLINGREMAPPERTEST_HXX__
CPPUNIT_TEST( testNatureOfField );
CPPUNIT_TEST( testExtruded );
CPPUNIT_TEST( testExtruded2 );
+ CPPUNIT_TEST( testPrepareEx1 );
CPPUNIT_TEST_SUITE_END();
public:
void test2DInterpP0P0_1();
void testNatureOfField();
void testExtruded();
void testExtruded2();
+ void testPrepareEx1();
private:
static MEDCouplingUMesh *build1DTargetMesh_2();
static MEDCouplingUMesh *build2DTargetMesh_3();
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
TestMEDCoupling_LDFLAGS = @CPPUNIT_LIBS@ ../libmedcoupling.la ../../INTERP_KERNEL/libinterpkernel.la
dist_TestMEDCoupling_SOURCES = TestMEDCoupling.cxx MEDCouplingBasicsTest.hxx MEDCouplingBasicsTest0.cxx MEDCouplingBasicsTest1.cxx \
- MEDCouplingBasicsTest2.cxx MEDCouplingBasicsTestInterp.cxx MEDCouplingBasicsTestData1.hxx
+ MEDCouplingBasicsTest2.cxx MEDCouplingBasicsTest3.cxx MEDCouplingBasicsTestInterp.cxx MEDCouplingBasicsTestData1.hxx \
+ MEDCouplingBasicsTest4.cxx
TestMEDCouplingRemapper_CPPFLAGS=@CPPUNIT_INCLUDES@ @PTHREAD_CFLAGS@ -I$(srcdir)/.. -I$(srcdir)/../../INTERP_KERNEL/Bases -I$(srcdir)/../../INTERP_KERNELTest -I$(srcdir)/../../INTERP_KERNEL -I$(srcdir)/../../INTERP_KERNEL/Geometric2D
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "CppUnitTest.hxx"
#include "MEDCouplingBasicsTest.hxx"
CPPUNIT_TEST_SUITE_REGISTRATION( ParaMEDMEM::MEDCouplingBasicsTest );
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "CppUnitTest.hxx"
#include "MEDCouplingRemapperTest.hxx"
CPPUNIT_TEST_SUITE_REGISTRATION( ParaMEDMEM::MEDCouplingRemapperTest );
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
from MEDCoupling import *
targetMesh=MEDCouplingUMesh.New();
targetMesh.setMeshDimension(0);
targetMesh.allocateCells(8);
- targetMesh.insertNextCell(NORM_POINT0,0,[]);
- targetMesh.insertNextCell(NORM_POINT0,0,[]);
- targetMesh.insertNextCell(NORM_POINT0,0,[]);
- targetMesh.insertNextCell(NORM_POINT0,0,[]);
- targetMesh.insertNextCell(NORM_POINT0,0,[]);
- targetMesh.insertNextCell(NORM_POINT0,0,[]);
- targetMesh.insertNextCell(NORM_POINT0,0,[]);
- targetMesh.insertNextCell(NORM_POINT0,0,[]);
+ targetMesh.insertNextCell(NORM_POINT1,1,[0]);
+ targetMesh.insertNextCell(NORM_POINT1,1,[1]);
+ targetMesh.insertNextCell(NORM_POINT1,1,[2]);
+ targetMesh.insertNextCell(NORM_POINT1,1,[3]);
+ targetMesh.insertNextCell(NORM_POINT1,1,[4]);
+ targetMesh.insertNextCell(NORM_POINT1,1,[5]);
+ targetMesh.insertNextCell(NORM_POINT1,1,[7]);
+ targetMesh.insertNextCell(NORM_POINT1,1,[6]);
targetMesh.finishInsertingCells();
myCoords=DataArrayDouble.New();
myCoords.setValues(targetCoords,9,3);
pass
def testMeshM1D(self):
meshM1D=MEDCouplingUMesh.New();
- self.assertRaises(Exception,meshM1D.getMeshDimension);
- self.assertRaises(Exception,meshM1D.getNumberOfNodes);
- self.assertRaises(Exception,meshM1D.getNumberOfCells);
- self.assertRaises(Exception,meshM1D.setMeshDimension,-2)
- self.assertRaises(Exception,meshM1D.setMeshDimension,-10)
+ self.assertRaises(InterpKernelException,meshM1D.getMeshDimension);
+ self.assertRaises(InterpKernelException,meshM1D.getNumberOfNodes);
+ self.assertRaises(InterpKernelException,meshM1D.getNumberOfCells);
+ self.assertRaises(InterpKernelException,meshM1D.setMeshDimension,-2)
+ self.assertRaises(InterpKernelException,meshM1D.setMeshDimension,-10)
meshM1D.setMeshDimension(-1);
meshM1D.checkCoherency();
self.assertEqual(meshM1D.getMeshDimension(),-1);
self.assertEqual(meshM1D.getNumberOfCells(),1);
- self.assertRaises(Exception,meshM1D.getNumberOfNodes);
- self.assertRaises(Exception,meshM1D.getSpaceDimension);
+ self.assertRaises(InterpKernelException,meshM1D.getNumberOfNodes);
+ self.assertRaises(InterpKernelException,meshM1D.getSpaceDimension);
cpy=meshM1D.clone(True);
self.assertTrue(cpy.isEqual(meshM1D,1e-12));
fieldOnCells=MEDCouplingFieldDouble.New(ON_CELLS);
pass
def testRevNodal(self):
mesh=MEDCouplingDataForTest.build2DTargetMesh_1()
- revNodal=DataArrayInt.New();
- revNodalIndx=DataArrayInt.New();
- mesh.getReverseNodalConnectivity(revNodal,revNodalIndx);
+ revNodal,revNodalIndx=mesh.getReverseNodalConnectivity();
revNodalExpected=[0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4];
revNodalIndexExpected=[0,1,3,5,7,12,14,15,17,18];
self.assertEqual(revNodal.getNbOfElems(),18)
self.assertEqual(4,subMesh.getNodalConnectivityIndex().getNbOfElems());
self.assertEqual(subConn2[0:14],list(subMesh.getNodalConnectivity().getValues()));
self.assertEqual(subConnIndex2[0:4],list(subMesh.getNodalConnectivityIndex().getValues()));
- subMesh=subMesh.buildPartOfMySelf(range(3),True);
- self.assertEqual("PartOf_Toto",subMesh.getName());
+ dd=DataArrayInt.New()
+ dd.alloc(3,1)
+ dd.iota(0)
+ dd.setName("coucou")
+ subMesh=subMesh.buildPartOfMySelf(dd,True);
+ self.assertEqual("coucou",subMesh.getName());
pass
def testBuildPartOfMySelfNode(self):
mesh=MEDCouplingDataForTest.build2DTargetMesh_1();
self.assertEqual(subConn[0:5],list(subMesh.getNodalConnectivity().getValues()));
self.assertEqual(subConnIndex[0:2],list(subMesh.getNodalConnectivityIndex().getValues()));
#
- subMesh=mesh.buildPartOfMySelfNode(tab1[0:2],False);
+ ddd=DataArrayInt.New()
+ ddd.setValues(tab1[0:2],2,1)
+ ddd.setName("ddd")
+ subMesh=mesh.buildPartOfMySelfNode(ddd,False);
+ self.assertEqual("ddd",subMesh.getName())
self.assertTrue(isinstance(subMesh,MEDCouplingUMesh))
self.assertEqual(2,len(subMesh.getAllTypes()));
self.assertEqual(NORM_TRI3,subMesh.getAllTypes()[0]);
m3=m2.buildPartOfMySelf(cells1,True);
self.assertTrue(isinstance(m3,MEDCouplingUMesh))
m4=MEDCouplingDataForTest.build2DSourceMesh_1();
- m5=MEDCouplingUMesh.mergeUMeshes(m1,m3);
- m6=MEDCouplingUMesh.mergeUMeshes(m5,m4);
+ m5=MEDCouplingUMesh.MergeUMeshes(m1,m3);
+ m6=MEDCouplingUMesh.MergeUMeshes(m5,m4);
#
self.assertEqual(10,m6.getNumberOfCells());
self.assertEqual(22,m6.getNumberOfNodes());
field.setNature(IntegralGlobConstraint);
field=MEDCouplingFieldDouble.New(ON_NODES,NO_TIME);
field.setNature(ConservativeVolumic);
- self.assertRaises(Exception,field.setNature,Integral);
- self.assertRaises(Exception,field.setNature,IntegralGlobConstraint);
+ self.assertRaises(InterpKernelException,field.setNature,Integral);
+ self.assertRaises(InterpKernelException,field.setNature,IntegralGlobConstraint);
pass
def testBuildSubMeshData(self):
ret1,di=fieldCells.buildSubMeshData(elts);
self.assertTrue(isinstance(ret1,MEDCouplingUMesh))
self.assertEqual(3,ret1.getNumberOfCells());
- self.assertEqual(6,ret1.getNumberOfNodes());
+ self.assertEqual(9,ret1.getNumberOfNodes());
self.assertEqual(3,di.getNumberOfTuples());
self.assertEqual(1,di.getNumberOfComponents());
toCheck=di.getValues();
center=[0.,0.,0.]
vector=[0.,1.,0.]
m2.rotate(center,vector,-pi/2.);
- m3=m1.buildExtrudedMeshFromThis(m2,0);
+ m3=m1.buildExtrudedMesh(m2,0);
#
m4=MEDCouplingExtrudedMesh.New(m3,m1,0);
self.assertEqual(15,m4.getNumberOfCells());
#play with polygons and polyedrons
cells=[2,3]
m1.convertToPolyTypes(cells);
- m3=m1.buildExtrudedMeshFromThis(m2,0);
+ m3=m1.buildExtrudedMesh(m2,0);
self.assertEqual(NORM_HEXA8,m3.getTypeOfCell(0));
self.assertEqual(NORM_PENTA6,m3.getTypeOfCell(1));
self.assertEqual(NORM_POLYHED,m3.getTypeOfCell(2));
center=[0.,0.,0.]
vector=[0.,1.,0.]
m2.rotate(center,vector,-pi/2.);
- m3=m1.buildExtrudedMeshFromThis(m2,0);
+ m3=m1.buildExtrudedMesh(m2,0);
expected1=[1,3,2,0,6,5,7,10,11,8,12,9,14,13,4]
rexpected1=[3, 0, 2, 1, 14, 5, 4, 6, 9, 11, 7, 8, 10, 13, 12]
m3.renumberCells(expected1,False);
m3=MEDCouplingDataForTest.build2DTargetMesh_1();
m3.tryToShareSameCoords(m2,1e-12);
meshes=[m1,m2,m3]
- m4=MEDCouplingUMesh.mergeUMeshesOnSameCoords(meshes);
+ m4=MEDCouplingUMesh.MergeUMeshesOnSameCoords(meshes);
m4.checkCoherency();
self.assertEqual(15,m4.getNumberOfCells());
cells1=[0,1,2,3,4]
m2.translate(vec);
f1=m1.getMeasureField(True);
f2=m2.getMeasureField(True);
- f3=MEDCouplingFieldDouble.mergeFields(f1,f2);
+ f3=MEDCouplingFieldDouble.MergeFields(f1,f2);
f3.checkCoherency();
m4=MEDCouplingDataForTest.build2DTargetMeshMerged_1();
self.assertTrue(f3.getMesh().isEqual(m4,1.e-12));
self.assertTrue(abs(0.5-values4[0])<1.e-12);
self.assertTrue(abs(1.-values4[1])<1.e-12);
#
- self.assertRaises(Exception,m.fillFromAnalytic,ON_NODES,1,"1./(x-0.2)");
+ self.assertRaises(InterpKernelException,m.fillFromAnalytic,ON_NODES,1,"1./(x-0.2)");
pass
def testFillFromAnalytic2(self):
f4.checkCoherency();
self.assertEqual(f4.getTypeOfField(),ON_NODES);
self.assertEqual(f4.getTimeDiscretization(),ONE_TIME);
- self.assertRaises(Exception,f1.__add__,f4);
+ self.assertRaises(InterpKernelException,f1.__add__,f4);
f5=f4.buildNewTimeReprFromThis(NO_TIME,False);
self.assertEqual(f5.getTypeOfField(),ON_NODES);
self.assertEqual(f5.getTimeDiscretization(),NO_TIME);
f4.checkCoherency();
self.assertEqual(f4.getTypeOfField(),ON_NODES);
self.assertEqual(f4.getTimeDiscretization(),ONE_TIME);
- self.assertRaises(Exception,f1.__add__,f4);
+ self.assertRaises(InterpKernelException,f1.__add__,f4);
f5=f4.buildNewTimeReprFromThis(NO_TIME,True);
self.assertEqual(f5.getTypeOfField(),ON_NODES);
self.assertEqual(f5.getTimeDiscretization(),NO_TIME);
#
f1=m.buildOrthogonalField();
# to avoid valgrind leaks
- # self.assertRaises(Exception,f2.__imul__,f1);
+ # self.assertRaises(InterpKernelException,f2.__imul__,f1);
pass
def testOperationsOnFields4(self):
f1.setMesh(m);
array=DataArrayDouble.New();
f1.setArray(array);
- self.assertRaises(Exception,f1.setEndArray,array);
- self.assertRaises(Exception,f1.getEndArray);
+ self.assertRaises(InterpKernelException,f1.setEndArray,array);
+ self.assertRaises(InterpKernelException,f1.getEndArray);
arr1=[0.,10.,20.,1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.]
arr2=[5.,15.,25.,6.,16.,26.,7.,17.,27.,8.,18.,28.,9.,19.,29.]
array.setValues(arr1,nbOfCells,3);
self.assertTrue(abs(arr1[4]-res[1])<1.e-12);
self.assertTrue(abs(arr1[5]-res[2])<1.e-12);
res=None
- self.assertRaises(Exception,f1.getValueOn,pos,3.2)
+ self.assertRaises(InterpKernelException,f1.getValueOn,pos,3.2)
f2=MEDCouplingFieldDouble.New(ON_CELLS,LINEAR_TIME);
f2.setMesh(m);
f2.setArray(f1.getArray());
f2.setStartTime(2.,3,0);
f2.setEndTime(4.,13,0);
- self.assertRaises(Exception,f2.checkCoherency)
+ self.assertRaises(InterpKernelException,f2.checkCoherency)
array2=DataArrayDouble.New();
array2.setValues(arr2,nbOfCells,3);
f2.setEndArray(array2);
f1=targetMesh.fillFromAnalytic(ON_NODES,1,"x+y+z");
tmp=f1.getArray()
tmp.setIJ(1,0,1000.);
- self.assertRaises(Exception,f1.mergeNodes,1.e-10)
+ self.assertRaises(InterpKernelException,f1.mergeNodes,1.e-10)
pass
def testCheckConsecutiveCellTypes(self):
m1=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
v=m1.splitByType();
self.assertEqual(3,len(v));
- m2=MEDCouplingUMesh.mergeUMeshesOnSameCoords(v);
+ m2=MEDCouplingUMesh.MergeUMeshesOnSameCoords(v);
m2.setName(m1.getName());
self.assertTrue(m1.isEqual(m2,1.e-12));
pass
self.assertTrue(isinstance(m5,MEDCouplingUMesh))
meshes=[m3,m4,m5]
#
- m7,corr=MEDCouplingUMesh.fuseUMeshesOnSameCoords(meshes,0);
+ m7,corr=MEDCouplingUMesh.FuseUMeshesOnSameCoords(meshes,0);
self.assertEqual(4,m7.getNumberOfCells());
self.assertEqual(3,len(corr));
expectedVals1=[3,3,2]
vals=arr.getValues();
self.assertEqual(expectedVals2[i],list(vals));
pass
- arr2,fidsOfGroups=DataArrayInt.makePartition(corr,m7.getNumberOfCells());
+ arr2,fidsOfGroups=DataArrayInt.MakePartition(corr,m7.getNumberOfCells());
fidExp=[5,1,3,4]
fidsGrp=[[1,3,5],[3,4,5],[4,5]]
self.assertEqual(3,len(fidsOfGroups));
part2=[5,6,4,7]
m4=m1.buildPartOfMySelf(part2,True);
meshes=[m1,m3,m3,m4]
- m5,corr=MEDCouplingUMesh.fuseUMeshesOnSameCoords(meshes,0);
+ m5,corr=MEDCouplingUMesh.FuseUMeshesOnSameCoords(meshes,0);
self.assertEqual(18,m5.getNumberOfCells());
exp2=[
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],
pos=[0.,0.,0.4,0.4,0.,0.4,0.1,0.1,0.25,0.,0.65,0.]
#2D basic
t1,t2=targetMesh.getCellsContainingPoints(pos,6,1e-12);
- self.assertEqual(6,len(t1));
- self.assertEqual(7,len(t2));
+ self.assertEqual(6,t1.getNumberOfTuples());
+ self.assertEqual(1,t1.getNumberOfComponents());
+ self.assertEqual(7,t2.getNumberOfTuples());
+ self.assertEqual(1,t2.getNumberOfComponents());
expectedValues1=[0,4,3,0,1,2]
expectedValues2=[0,1,2,3,4,5,6]
- self.assertEqual(list(t1),expectedValues1);
- self.assertEqual(list(t2),expectedValues2);
+ self.assertEqual(list(t1.getValues()),expectedValues1);
+ self.assertEqual(list(t2.getValues()),expectedValues2);
#2D with no help of bounding box.
center=[0.2,0.2]
- MEDCouplingPointSet.rotate2DAlg(center,0.78539816339744830962,6,pos);
+ MEDCouplingPointSet.Rotate2DAlg(center,0.78539816339744830962,6,pos);
targetMesh.rotate(center,[],0.78539816339744830962);
t1=None
t2=None
t1,t2=targetMesh.getCellsContainingPoints(pos,6,1e-12);
- self.assertEqual(6,len(t1));
- self.assertEqual(7,len(t2));
- self.assertEqual(list(t1),expectedValues1);
- self.assertEqual(list(t2),expectedValues2);
+ self.assertEqual(6,t1.getNumberOfTuples());
+ self.assertEqual(7,t2.getNumberOfTuples());
+ self.assertEqual(list(t1.getValues()),expectedValues1);
+ self.assertEqual(list(t2.getValues()),expectedValues2);
#2D outside
pos1bis=[-0.3303300858899107,-0.11819805153394641]
self.assertEqual(-1,targetMesh.getCellContainingPoint(pos1bis,1e-12));
m1=MEDCouplingDataForTest.build2DTargetMesh_1();
m2=MEDCouplingDataForTest.build2DSourceMesh_1();
#self.assertEqual(m1.getCoords()!=m2.getCoords());
- self.assertRaises(Exception,m1.tryToShareSameCoords,m2,1e-12)
+ self.assertRaises(InterpKernelException,m1.tryToShareSameCoords,m2,1e-12)
pass
def testFindNodeOnPlane(self):
expected=[0,1,2,3,4,5,6,7]
val=da.getValues();
self.assertEqual(expected,list(val));
+ #
+ ddd=DataArrayInt.New()
+ ddd.setValues(n,len(n),1)
+ m3dSurf=mesh.buildFacePartOfMySelfNode(ddd,True);
+ self.assertTrue(isinstance(m3dSurf,MEDCouplingUMesh))
+ me=MEDCouplingExtrudedMesh.New(mesh,m3dSurf,0);
+ da=me.getMesh3DIds();
+ self.assertEqual(8,me.getNumberOfCells());
+ expected=[0,1,2,3,4,5,6,7]
+ val=da.getValues();
+ self.assertEqual(expected,list(val));
pass
def testRenumberCells(self):
m=MEDCouplingDataForTest.build2DTargetMesh_1();
f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,NO_TIME);
f.setMesh(m);
+ self.assertEqual(5,f.getNumberOfMeshPlacesExpected());
self.assertEqual(0,f.getNbOfGaussLocalization());
f.setGaussLocalizationOnType(NORM_TRI3,_refCoo1,_gsCoo1,_wg1);
- self.assertRaises(Exception,f.setGaussLocalizationOnType,NORM_QUAD4,_refCoo1,_gsCoo1,_wg1)
+ self.assertRaises(InterpKernelException,f.setGaussLocalizationOnType,NORM_QUAD4,_refCoo1,_gsCoo1,_wg1)
self.assertEqual(1,f.getNbOfGaussLocalization());
refCoo2=[ 0.,0., 1.,0., 1.,1., 0.,1. ]
_refCoo2=refCoo2
#
f.clearGaussLocalizations();
self.assertEqual(0,f.getNbOfGaussLocalization());
- self.assertRaises(Exception,f.checkCoherency);
+ self.assertRaises(InterpKernelException,f.checkCoherency);
ids1=[0,1,3,4]
- self.assertRaises(Exception,f.setGaussLocalizationOnCells,ids1,_refCoo2,_gsCoo1,_wg1);
+ self.assertRaises(InterpKernelException,f.setGaussLocalizationOnCells,ids1,_refCoo2,_gsCoo1,_wg1);
self.assertEqual(0,f.getNbOfGaussLocalization());
ids2=[0,4]
f.setGaussLocalizationOnCells(ids2,_refCoo2,_gsCoo1,_wg1);
self.assertEqual(1,f.getNbOfGaussLocalization());
self.assertEqual(0,f.getGaussLocalizationIdOfOneCell(0));
- self.assertRaises(Exception,f.getGaussLocalizationIdOfOneCell,1);
+ self.assertRaises(InterpKernelException,f.getGaussLocalizationIdOfOneCell,1);
ids3=[1,2]
f.setGaussLocalizationOnCells(ids3,_refCoo1,_gsCoo1,_wg1);
self.assertEqual(2,f.getNbOfGaussLocalization());
self.assertEqual(0,f.getGaussLocalizationIdOfOneCell(0));
self.assertEqual(1,f.getGaussLocalizationIdOfOneCell(1));
self.assertEqual(1,f.getGaussLocalizationIdOfOneCell(2));
- self.assertRaises(Exception,f.checkCoherency);#<- cell 3 has no localization
+ self.assertRaises(InterpKernelException,f.checkCoherency);#<- cell 3 has no localization
ids4=[3]
_gsCoo2=_gsCoo1;
_wg2=_wg1;
self.assertEqual(3,f.getNbOfGaussLocalization());
tmpIds=f.getCellIdsHavingGaussLocalization(0);
self.assertEqual(ids2,list(tmpIds));
- self.assertRaises(Exception,f.checkCoherency);#<- it's always not ok because undelying array not with the good size.
+ self.assertRaises(InterpKernelException,f.checkCoherency);#<- it's always not ok because undelying array not with the good size.
array2=f.getArray().substr(0,10);
f.setArray(array2);
f.checkCoherency();#<- here it is OK
m=MEDCouplingDataForTest.build2DTargetMesh_1();
f=MEDCouplingFieldDouble.New(ON_GAUSS_NE,NO_TIME);
f.setMesh(m);
+ self.assertEqual(5,f.getNumberOfMeshPlacesExpected());
f.setName("MyFirstFieldOnNE");
f.setDescription("MyDescriptionNE");
array=DataArrayDouble.New();
def testCellOrientation1(self):
m=MEDCouplingDataForTest.build2DTargetMesh_1();
vec=[0.,0.,1.]
- self.assertRaises(Exception,m.are2DCellsNotCorrectlyOriented,vec,False);
+ self.assertRaises(InterpKernelException,m.are2DCellsNotCorrectlyOriented,vec,False);
m.changeSpaceDimension(3);
res1=m.are2DCellsNotCorrectlyOriented(vec,False);
self.assertTrue(len(res1)==0);
center=[0.,0.,0.]
vector=[0.,1.,0.]
m4.rotate(center,vector,-pi/2.);
- m5=m3.buildExtrudedMeshFromThis(m4,0);
+ m5=m3.buildExtrudedMesh(m4,0);
res1=m5.arePolyhedronsNotCorrectlyOriented();
self.assertEqual(15,len(res1));
m5.orientCorrectlyPolyhedrons();
m=MEDCouplingDataForTest.build2DTargetMesh_1();
f=MEDCouplingFieldDouble.New(ON_NODES,NO_TIME);
f.setMesh(m);
+ self.assertEqual(9,f.getNumberOfMeshPlacesExpected());
arr=DataArrayDouble.New();
nbOfNodes=m.getNumberOfNodes();
values1=[7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.,12.,112.,10012.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.]
#Third test : cell permutation by keeping the first the middle and the last as it is.
renum=[0,2,1,3,4,5,6,8,7,9]
mesh2.renumberCells(renum,False);
- self.assertRaises(Exception,mesh1.checkGeoEquivalWith,mesh2,0,1e-12);#deepEqual fails
+ self.assertRaises(InterpKernelException,mesh1.checkGeoEquivalWith,mesh2,0,1e-12);#deepEqual fails
self.assertTrue(cellCor==None);
self.assertTrue(nodeCor==None);
cellCor,nodeCor=mesh1.checkGeoEquivalWith(mesh2,1,1e-12);#fastEqual do not see anything
mesh2.renumberNodes(renum2,11);
cellCor=None
nodeCor=None
- self.assertRaises(Exception,mesh1.checkGeoEquivalWith,mesh2,0,1e-12);#deepEqual fails
+ self.assertRaises(InterpKernelException,mesh1.checkGeoEquivalWith,mesh2,0,1e-12);#deepEqual fails
self.assertTrue(cellCor==None);
self.assertTrue(nodeCor==None);
cellCor,nodeCor=mesh1.checkGeoEquivalWith(mesh2,1,1e-12);#fastEqual do not see anything
mesh2.renumberNodes(renum2,11);
cellCor=None
nodeCor=None
- self.assertRaises(Exception,mesh1.checkGeoEquivalWith,mesh2,0,1e-12)
+ self.assertRaises(InterpKernelException,mesh1.checkGeoEquivalWith,mesh2,0,1e-12)
self.assertTrue(cellCor==None);
self.assertTrue(nodeCor==None);
- self.assertRaises(Exception,mesh1.checkGeoEquivalWith,mesh2,1,1e-12)
+ self.assertRaises(InterpKernelException,mesh1.checkGeoEquivalWith,mesh2,1,1e-12)
self.assertTrue(cellCor==None);
self.assertTrue(nodeCor==None);
cellCor,nodeCor=mesh2.checkGeoEquivalWith(mesh1,10,1e-12);#deepEqual with geo permutations
nbOfCells=m.getNumberOfCells();
f=MEDCouplingFieldDouble.New(ON_CELLS,LINEAR_TIME);
f.setMesh(m);
+ self.assertEqual(5,f.getNumberOfMeshPlacesExpected());
f.setName("a");
f.setDescription("b");
a1=DataArrayDouble.New();
#self.assertTrue(m.getCoords()==m2.getCoords());
self.assertTrue(m2.isEqual(m,1e-12));
renum1=[1,2,0,5,8,7,4,3,6]
- m.renumberNodes(renum1,9);
+ r1=DataArrayInt.New()
+ r1.setValues(renum1,len(renum1),1)
+ m.renumberNodes(r1,9);
#self.assertTrue(m.getCoords()!=m2.getCoords());
self.assertTrue(not m2.isEqual(m,1e-12));
m.tryToShareSameCoordsPermute(m2,1e-12);
self.assertAlmostEqual(expected1[i],f1.getIJ(i,0),12);
pass
self.assertAlmostEqual(expected1[0],f2.getIJ(0,0),12);
- self.assertRaises(Exception,m1.tryToShareSameCoordsPermute,m2,1e-12);# <- here in this order the sharing is impossible.
+ self.assertRaises(InterpKernelException,m1.tryToShareSameCoordsPermute,m2,1e-12);# <- here in this order the sharing is impossible.
# Let's go for deeper test of tryToShareSameCoordsPermute
m2.tryToShareSameCoordsPermute(m1,1e-12);
f1=m1.getMeasureField(False);
#self.assertTrue(f1.getMesh()==mesh1);
f1.changeUnderlyingMesh(mesh2,10,1e-12);
#self.assertTrue(f1.getMesh()==mesh2);
- expected2=[7.,107.,9.,109.,17.,117.,10.,110.,11.,111.,12.,112.,13.,113.,15.,115.,14.,114.,16.,116.,8.,108.]
+ expected2=[7.,107.,17.,117.,8.,108.,10.,110.,11.,111.,12.,112.,13.,113.,15.,115.,14.,114.,16.,116.,9.,109.]
for i in xrange(22):
self.assertAlmostEqual(expected2[i],f1.getArray().getIJ(0,i),12);
pass
self.assertEqual(2,f1.getNumberOfComponents());
self.assertEqual(20,f1.getNumberOfValues());
#
- renum=[0,2,1,3,4,5,6,8,7,9]
+ renum=[0,2,3,1,4,5,6,8,7,9]
mesh2.renumberCells(renum,False);
#
f2=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
f2.setMesh(mesh2);
array=DataArrayDouble.New();
- arr2=[7.1,107.1,9.1,109.1,8.1,108.1,10.1,110.1,11.1,111.1,12.1,112.1,13.1,113.1,15.1,115.1,14.1,114.1,16.1,116.1]
+ arr2=[7.1,107.1,10.1,110.1,8.1,108.1,9.1,109.1,11.1,111.1,12.1,112.1,13.1,113.1,15.1,115.1,14.1,114.1,16.1,116.1]
array.setValues(arr2,mesh2.getNumberOfCells(),2);
f2.setArray(array);
#
#
part1=[2,1,4]
f2=f1.buildSubPart(part1);
+ f2.zipCoords()
self.failUnlessEqual(3,f2.getNumberOfTuples());
self.failUnlessEqual(2,f2.getNumberOfComponents());
expected1=[5.,105.,4.,104.,7.,107.]
1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7]
array.setValues(arr2,mesh1.getNumberOfNodes(),6);
f1.setArray(array);
- self.assertRaises(Exception,f1.checkCoherency);#no end array specified !
+ self.assertRaises(InterpKernelException,f1.checkCoherency);#no end array specified !
#
f2=f1.determinant();
self.assertEqual(LINEAR_TIME,f2.getTimeDiscretization());
self.assertTrue(not mesh1.isEqual(mesh2,1e-12));
self.assertTrue(mesh1.isEqualWithoutConsideringStr(mesh2,1e-12));
da1,da2=mesh1.checkGeoEquivalWith(mesh2,2,1e-12);
- self.assertRaises(Exception,mesh1.checkGeoEquivalWith,mesh2,0,1e-12);
+ self.assertRaises(InterpKernelException,mesh1.checkGeoEquivalWith,mesh2,0,1e-12);
mesh2.setName("");
self.assertTrue(mesh1.isEqual(mesh2,1e-12));
self.assertTrue(mesh1.isEqualWithoutConsideringStr(mesh2,1e-12));
def testFillFromAnalytic3(self):
m=MEDCouplingDataForTest.build2DTargetMesh_1()
f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME)
- self.assertRaises(Exception,f1.fillFromAnalytic,1,"y+x");
+ self.assertRaises(InterpKernelException,f1.fillFromAnalytic,1,"y+x");
f1.setMesh(m)
f1.setName("myField");
f1.fillFromAnalytic(1,"y+x");
#
f1=MEDCouplingFieldDouble.New(ON_NODES,NO_TIME);
f1.setMesh(m);
- self.assertRaises(Exception,f1.fillFromAnalytic,1,"1./(x-0.2)");
+ self.assertRaises(InterpKernelException,f1.fillFromAnalytic,1,"1./(x-0.2)");
pass
def testFieldDoubleOpEqual1(self):
m=MEDCouplingDataForTest.build2DTargetMesh_1();
f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
- self.assertRaises(Exception,f1.assign,0.07);
+ self.assertRaises(InterpKernelException,f1.assign,0.07);
f1.setMesh(m);
f1.assign(0.07);
f1.checkCoherency();
m3_1=m2.buildPartOfMySelf(cells1,True);
m3=m3_1;
m4=MEDCouplingDataForTest.build2DSourceMesh_1();
- m5=MEDCouplingUMesh.mergeUMeshes(m1,m3);
- m6=MEDCouplingUMesh.mergeUMeshes(m5,m4);
+ m5=MEDCouplingUMesh.MergeUMeshes(m1,m3);
+ m6=MEDCouplingUMesh.MergeUMeshes(m5,m4);
#
self.assertEqual(10,m6.getNumberOfCells());
self.assertEqual(22,m6.getNumberOfNodes());
pos1=[5.,30.,2.]
self.assertEqual(16,m.getCellContainingPoint(pos1,1e-12));
#
- elems=m2.giveElemsInBoundingBox([3.5,6.,12.2,25.,0.,1.5],1e-7)
+ elems=m2.getCellsInBoundingBox([3.5,6.,12.2,25.,0.,1.5],1e-7)
self.assertEqual([1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17],elems)
#
pt=[2.4,12.7,-3.4]
1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7, 1.2,2.3,3.4,4.5,5.6,6.7]
array.setValues(arr2,mesh1.getNumberOfNodes(),6);
f1.setArray(array);
- self.assertRaises(Exception,f1.checkCoherency);#no end array specified !
+ self.assertRaises(InterpKernelException,f1.checkCoherency);#no end array specified !
#
f2=f1.determinant();
self.assertEqual(LINEAR_TIME,f2.getTimeDiscretization());
arr5V=[2,3,6]
arr6V=[2,7,5]
arr7V=[2,1,4,6]
- self.assertRaises(Exception,a2.keepSelectedComponents,arr5V);
- self.assertRaises(Exception,a2.keepSelectedComponents,arr6V);
- self.assertRaises(Exception,a2.setSelectedComponents,a1,arr7V);
+ self.assertRaises(InterpKernelException,a2.keepSelectedComponents,arr5V);
+ self.assertRaises(InterpKernelException,a2.keepSelectedComponents,arr6V);
+ self.assertRaises(InterpKernelException,a2.setSelectedComponents,a1,arr7V);
arr7V=arr7V[0:3]
- self.assertRaises(Exception,a2.setSelectedComponents,a1,arr7V);
+ self.assertRaises(InterpKernelException,a2.setSelectedComponents,a1,arr7V);
#
pass
tmp=DataArrayDouble.New();
vals=[0.2,0.2,0.1,0.2,0.2,0.2]
tmp.setValues(vals,3,2);
- tmp2=DataArrayDouble.aggregate(coords,tmp);
+ tmp2=DataArrayDouble.Aggregate(coords,tmp);
mesh.setCoords(tmp2);
pts=[0.2,0.2,0.1,0.3,-0.3,0.7]
c=mesh.getNodeIdsNearPoint(pts,1e-7);
self.assertEqual([4,9,11],c);
c,cI=mesh.getNodeIdsNearPoints(pts,3,1e-7);
- self.assertEqual([0,3,3,4],cI);
- self.assertEqual([4,9,11,6],c);
+ self.assertEqual([0,3,3,4],cI.getValues());
+ self.assertEqual([4,9,11,6],c.getValues());
pass
def testFieldCopyTinyAttrFrom1(self):
g=f.getCoords().applyFunc(2,"3.5*IVec+x/6*3.14159265359*JVec");
h=g.fromPolarToCart();
f.setCoords(h);
- i=c.buildExtrudedMeshFromThis(f,1);
+ i=c.buildExtrudedMesh(f,1);
self.assertEqual(52,i.getNumberOfNodes());
tmp,tmp2,tmp3=i.mergeNodes(1e-9);
self.assertTrue(tmp2);
#
center=[0.,0.]
f.rotate(center,[],pi/3);
- g=c.buildExtrudedMeshFromThis(f,0);
+ g=c.buildExtrudedMesh(f,0);
g.checkCoherency();
expected1=[ 0.4330127018922193, 0.4330127018922193, 0.649519052838329, 1.2990381056766578, 1.299038105676658, 1.948557158514987, 2.1650635094610955, 2.1650635094610964, 3.2475952641916446, 3.031088913245533, 3.0310889132455352, 4.546633369868303 ]
f1=g.getMeasureField(True);
g=f.getCoords().applyFunc(2,"3.5*IVec+x/6*3.14159265359*JVec");
h=g.fromPolarToCart();
f.setCoords(h);
- i=c.buildExtrudedMeshFromThis(f,1);
+ i=c.buildExtrudedMesh(f,1);
self.assertEqual(52,i.getNumberOfNodes());
tmp,tmp2,tmp3=i.mergeNodes(1e-9);
self.assertTrue(tmp2);
g2=h.applyFunc(3,"13.5/3.5*x*IVec+0*JVec+13.5/3.5*y*KVec");
f.setCoords(g2);
i.changeSpaceDimension(3);
- i3=i.buildExtrudedMeshFromThis(f,1);
+ i3=i.buildExtrudedMesh(f,1);
f2=i3.getMeasureField(True);
tmp,tmp2,tmp3=i.mergeNodes(1e-9);
self.assertTrue(tmp2);
self.assertEqual(int(expected1[i]),dai1.getIJ(0,i));
pass
# test of static method DataArrayDouble::meld
- da4=DataArrayDouble.meld(da1C,da3);
- tmp=DataArrayDouble.meld([da1C,da3]);
+ da4=DataArrayDouble.Meld(da1C,da3);
+ tmp=DataArrayDouble.Meld([da1C,da3]);
self.assertTrue(da4.isEqual(tmp,1e-10))
self.assertEqual(5,da4.getNumberOfComponents());
self.assertEqual(7,da4.getNumberOfTuples());
pass
# test of static method DataArrayInt::meld
dai1=da1C.convertToIntArr();
- dai4=DataArrayInt.meld(dai1,dai3);
- tmp=DataArrayInt.meld([dai1,dai3]);
+ dai4=DataArrayInt.Meld(dai1,dai3);
+ tmp=DataArrayInt.Meld([dai1,dai3]);
self.assertTrue(dai4.isEqual(tmp))
self.assertEqual(5,dai4.getNumberOfComponents());
self.assertEqual(7,dai4.getNumberOfTuples());
f2.getArray().setInfoOnComponent(1,"ccc");
f2.checkCoherency();
#
- f3=MEDCouplingFieldDouble.meldFields(f2,f1);
+ f3=MEDCouplingFieldDouble.MeldFields(f2,f1);
f3.checkCoherency();
self.assertEqual(5,f3.getNumberOfTuples());
self.assertEqual(3,f3.getNumberOfComponents());
#
f4=f2.buildNewTimeReprFromThis(NO_TIME,False);
f5=f1.buildNewTimeReprFromThis(NO_TIME,False);
- f6=MEDCouplingFieldDouble.meldFields(f4,f5);
+ f6=MEDCouplingFieldDouble.MeldFields(f4,f5);
f6.checkCoherency();
self.assertEqual(5,f6.getNumberOfTuples());
self.assertEqual(3,f6.getNumberOfComponents());
vec=[0.002,0.]
m2.translate(vec);
#
- m3=MEDCouplingUMesh.mergeUMeshes([m1,m2]);
+ m3=MEDCouplingUMesh.MergeUMeshes([m1,m2]);
da,b,newNbOfNodes=m3.mergeNodes2(0.01);
self.assertEqual(9,m3.getNumberOfNodes());
expected1=[-0.299,-0.3, 0.201,-0.3, 0.701,-0.3, -0.299,0.2, 0.201,0.2, 0.701,0.2, -0.299,0.7, 0.201,0.7, 0.701,0.7]
arr.fillWithValue(7.);
f3.setArray(arr);
#
- f4=MEDCouplingFieldDouble.mergeFields([f1,f2,f3]);
+ f4=MEDCouplingFieldDouble.MergeFields([f1,f2,f3]);
self.assertEqual(15,f4.getMesh().getNumberOfCells());
expected1=[2.,2.,2.,2.,2.,2.,2.,2.,2.,2., 5.,5.,5.,5.,5.,5.,5.,5.,5.,5., 7.,7.,7.,7.,7.,7.,7.,7.,7.,7.]
for i in xrange(30):
self.assertEqual(7,b.getNumberOfTuples());
self.assertEqual(1,b.getNumberOfComponents());
expected1=[0,1,3,5,7,8,18]
+ for i in xrange(7):
+ self.assertEqual(expected1[i],b.getIJ(0,i));
+ pass
+ b=DataArrayInt.BuildUnion([a,c]);
+ self.assertEqual(7,b.getNumberOfTuples());
+ self.assertEqual(1,b.getNumberOfComponents());
+ expected1=[0,1,3,5,7,8,18]
for i in xrange(7):
self.assertEqual(expected1[i],b.getIJ(0,i));
pass
self.assertEqual(2,b.getNumberOfTuples());
self.assertEqual(1,b.getNumberOfComponents());
expected1=[3,8]
+ for i in xrange(2):
+ self.assertEqual(expected1[i],b.getIJ(0,i));
+ pass
+ b=DataArrayInt.BuildIntersection([a,c]);
+ self.assertEqual(2,b.getNumberOfTuples());
+ self.assertEqual(1,b.getNumberOfComponents());
+ expected1=[3,8]
for i in xrange(2):
self.assertEqual(expected1[i],b.getIJ(0,i));
pass
self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
pass
arr4=[4,-1,0,6,5]
- self.assertRaises(Exception,a.selectByTupleIdSafe,arr4);
+ self.assertRaises(InterpKernelException,a.selectByTupleIdSafe,arr4);
arr5=[4,2,0,6,7]
- self.assertRaises(Exception,a.selectByTupleIdSafe,arr5);
+ self.assertRaises(InterpKernelException,a.selectByTupleIdSafe,arr5);
#
c=DataArrayInt.New();
arr3=[1,11,2,12,3,13,4,14,5,15,6,16,7,17]
for i in xrange(10):
self.assertEqual(expected2[i],d.getIJ(0,i));
pass
- self.assertRaises(Exception,c.selectByTupleIdSafe,arr4);
- self.assertRaises(Exception,c.selectByTupleIdSafe,arr5);
+ self.assertRaises(InterpKernelException,c.selectByTupleIdSafe,arr4);
+ self.assertRaises(InterpKernelException,c.selectByTupleIdSafe,arr5);
pass
def testAreCellsIncludedIn1(self):
m=MEDCouplingDataForTest.build3DTargetMesh_1();
m.rotate([0.,0.,0.],[0.3,0.6,1.2],0.37)
m.rotate([0.,0.,0.],[0.3,6,1.2],0.37)
- self.assertRaises(Exception,m.rotate,[0.,0.,0.],(0.3,6,"1.2"),0.37)
- self.assertRaises(Exception,m.rotate,[0.,"0.",0.],[0.3,0.6,1.2],0.37)
- self.assertRaises(Exception,m.rotate,[0.,0.,0.],[0.3,'0.6',1.2],0.37)
+ self.assertRaises(InterpKernelException,m.rotate,[0.,0.,0.],(0.3,6,"1.2"),0.37)
+ self.assertRaises(InterpKernelException,m.rotate,[0.,"0.",0.],[0.3,0.6,1.2],0.37)
+ self.assertRaises(InterpKernelException,m.rotate,[0.,0.,0.],[0.3,'0.6',1.2],0.37)
m2=m.buildPartOfMySelf([2,5],True)
m3=m.buildPartOfMySelf((2,5),True)
self.assertTrue(m2.isEqual(m3,1e-12))
- self.assertRaises(Exception,m.buildPartOfMySelf,[2,5.],True)
+ self.assertRaises(InterpKernelException,m.buildPartOfMySelf,[2,5.],True)
da1=m.getCoords().keepSelectedComponents([1])
da2=m.getCoords().keepSelectedComponents((1,))
self.assertTrue(da1.isEqual(da2,1e-12))
- self.assertRaises(Exception,m.getCoords().keepSelectedComponents,["1"])
+ self.assertRaises(InterpKernelException,m.getCoords().keepSelectedComponents,["1"])
pass
def testDAIBuildSubstraction1(self):
targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]
targetMesh=MEDCouplingUMesh.New();
targetMesh.allocateCells(5);
- self.assertRaises(Exception,targetMesh.insertNextCell,NORM_QUAD4,4,targetConn[0:4])
+ self.assertRaises(InterpKernelException,targetMesh.insertNextCell,NORM_QUAD4,4,targetConn[0:4])
targetMesh.setMeshDimension(2);
targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
- self.assertRaises(Exception,targetMesh.insertNextCell,NORM_TETRA4,4,targetConn[0:4])
- self.assertRaises(Exception,targetMesh.insertNextCell,NORM_SEG2,2,targetConn[0:2])
- self.assertRaises(Exception,targetMesh.insertNextCell,NORM_POINT0,1,targetConn[0:1])
+ self.assertRaises(InterpKernelException,targetMesh.insertNextCell,NORM_TETRA4,4,targetConn[0:4])
+ self.assertRaises(InterpKernelException,targetMesh.insertNextCell,NORM_SEG2,2,targetConn[0:2])
+ self.assertRaises(InterpKernelException,targetMesh.insertNextCell,NORM_POINT1,1,targetConn[0:1])
targetMesh.insertNextCell(NORM_TRI3,3,targetConn[4:7])
targetMesh.insertNextCell(NORM_TRI3,3,targetConn[7:10])
targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[10:14])
f2.checkCoherency();
#
f3=f1/f2;
- self.assertRaises(Exception,f2.__div__,f1)
+ self.assertRaises(InterpKernelException,f2.__div__,f1)
f3.checkCoherency();
f1/=f2;
- self.assertRaises(Exception,f2.__idiv__,f1)
+ #self.assertRaises(InterpKernelException,f2.__idiv__,f1) # mem leaks
self.assertTrue(f1.isEqual(f3,1e-10,1e-10));
expected1=[-0.5, 0.0, 0.0, 0.33333333333333331, 0.25, 0.0, 0.0, -0.20000000000000001, 0.117851130197758, 0.117851130197758, 0.0, -0.14285714285714285, 0.0, 0.125, 0.1111111111111111, 0.0, 0.0, 0.10000000000000001, 0.090909090909090912, 0.0, -0.083333333333333329, 0.0, 0.0, 0.076923076923076927, 0.071428571428571425, 0.0]
for i in xrange(26):
self.assertAlmostEqual(expected1[i],f3.getIJ(0,i),10);
pass
pass
+
+ def testDARearrange1(self):
+ da1=DataArrayInt.New();
+ da1.alloc(12,1);
+ da1.iota(0);
+ #
+ self.assertEqual(12,da1.getNbOfElems());
+ self.assertEqual(1,da1.getNumberOfComponents());
+ self.assertEqual(12,da1.getNumberOfTuples());
+ da1.rearrange(4);
+ self.assertEqual(12,da1.getNbOfElems());
+ self.assertEqual(4,da1.getNumberOfComponents());
+ self.assertEqual(3,da1.getNumberOfTuples());
+ for i in xrange(12):
+ self.assertEqual(i,da1.getIJ(0,i));
+ #
+ da1.rearrange(6);
+ self.assertEqual(12,da1.getNbOfElems());
+ self.assertEqual(6,da1.getNumberOfComponents());
+ self.assertEqual(2,da1.getNumberOfTuples());
+ for i in xrange(12):
+ self.assertEqual(i,da1.getIJ(0,i));
+ #
+ self.assertRaises(da1.rearrange(7),InterpKernelException);
+ #
+ da1.rearrange(12);
+ self.assertEqual(12,da1.getNbOfElems());
+ self.assertEqual(12,da1.getNumberOfComponents());
+ self.assertEqual(1,da1.getNumberOfTuples());
+ for i in xrange(12):
+ self.assertEqual(i,da1.getIJ(0,i));
+ #
+ da1.rearrange(3);
+ self.assertEqual(12,da1.getNbOfElems());
+ self.assertEqual(3,da1.getNumberOfComponents());
+ self.assertEqual(4,da1.getNumberOfTuples());
+ for i in xrange(12):
+ self.assertEqual(i,da1.getIJ(0,i));
+ #double
+ da2=da1.convertToDblArr();
+ #
+ self.assertEqual(12,da2.getNbOfElems());
+ self.assertEqual(3,da2.getNumberOfComponents());
+ self.assertEqual(4,da2.getNumberOfTuples());
+ da2.rearrange(4);
+ self.assertEqual(12,da2.getNbOfElems());
+ self.assertEqual(4,da2.getNumberOfComponents());
+ self.assertEqual(3,da2.getNumberOfTuples());
+ for i in xrange(12):
+ self.assertAlmostEqual(float(i),da2.getIJ(0,i),14);
+ #
+ da2.rearrange(6);
+ self.assertEqual(12,da2.getNbOfElems());
+ self.assertEqual(6,da2.getNumberOfComponents());
+ self.assertEqual(2,da2.getNumberOfTuples());
+ for i in xrange(12):
+ self.assertAlmostEqual(float(i),da2.getIJ(0,i),14);
+ #
+ self.assertRaises(da2.rearrange(7),InterpKernelException);
+ #
+ da2.rearrange(1);
+ self.assertTrue(ptr2==da2.getConstPointer());
+ self.assertEqual(12,da2.getNbOfElems());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ self.assertEqual(12,da2.getNumberOfTuples());
+ for i in xrange(12):
+ self.assertAlmostEqual(float(i),da2.getIJ(0,i),14);
+ #
+ da2.rearrange(3);
+ self.assertEqual(12,da2.getNbOfElems());
+ self.assertEqual(3,da2.getNumberOfComponents());
+ self.assertEqual(4,da2.getNumberOfTuples());
+ for i in xrange(12):
+ self.assertAlmostEqual(float(i),da2.getIJ(0,i),14);
+ pass
+
+ def testDARearrange1(self):
+ da1=DataArrayInt.New();
+ arr=[1,2,3,2,2,3,5,1,5,5,2,2]
+ da1.setValues(arr,4,3);
+ s=da1.getDifferentValues(True);# API different from C++ because SWIG complains...
+ expected1=[1,2,3,5]
+ self.assertEqual(expected1,s);
+ pass
+
+ def testSwigErrorProtection3(self):
+ da=DataArrayInt.New()
+ da.setValues([1,2,3,4],4,3)
+ self.assertEqual([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0],da.getValues())
+ self.assertEqual(3,da.getNumberOfComponents());
+ self.assertEqual(4,da.getNumberOfTuples());
+ da=DataArrayInt.New()
+ da.setValues((1,2,3,4,4,3),4,3)
+ self.assertEqual([1, 2, 3, 4, 4, 3, 0, 0, 0, 0, 0, 0],da.getValues())
+ self.assertEqual(3,da.getNumberOfComponents());
+ self.assertEqual(4,da.getNumberOfTuples());
+ da.setValues(10*[1]+290*[2],4,3)
+ self.assertEqual(10*[1]+[2,2],da.getValues())
+ self.assertEqual(3,da.getNumberOfComponents());
+ self.assertEqual(4,da.getNumberOfTuples());
+ #
+ da=DataArrayDouble.New()
+ da.setValues([1,2,3.,4],4,3)
+ self.assertEqual([1., 2., 3., 4., 0., 0., 0., 0., 0., 0., 0., 0.],da.getValues())
+ self.assertEqual(3,da.getNumberOfComponents());
+ self.assertEqual(4,da.getNumberOfTuples());
+ da=DataArrayDouble.New()
+ da.setValues((1,2,3,4.,4,3),4,3)
+ self.assertEqual([1., 2., 3., 4., 4., 3., 0., 0., 0., 0., 0., 0.],da.getValues())
+ self.assertEqual(3,da.getNumberOfComponents());
+ self.assertEqual(4,da.getNumberOfTuples());
+ da.setValues(10*[1]+290*[2],4,3)
+ self.assertEqual(10*[1.]+[2.,2.],da.getValues())
+ self.assertEqual(3,da.getNumberOfComponents());
+ self.assertEqual(4,da.getNumberOfTuples());
+ pass
+
+ def testDAIBuildPermutationArr1(self):
+ a=DataArrayInt.New()
+ a.setValues([4,5,6,7,8],5,1)
+ b=DataArrayInt.New()
+ b.setValues([5,4,8,6,7],5,1)
+ c=a.buildPermutationArr(b)
+ self.assertEqual([1,0,4,2,3],c.getValues())
+ self.assertTrue(a.isEqualWithoutConsideringStrAndOrder(b))
+ b.setIJ(0,0,9)
+ self.assertTrue(not a.isEqualWithoutConsideringStrAndOrder(b))
+ self.assertRaises(InterpKernelException,a.buildPermutationArr,b)
+ a.setIJ(3,0,4)
+ b.setIJ(0,0,5)
+ b.setIJ(4,0,4)#a==[4,5,6,4,8] and b==[5,4,8,6,4]
+ self.assertTrue(a.isEqualWithoutConsideringStrAndOrder(b))
+ c=a.buildPermutationArr(b)
+ self.assertEqual([1,3,4,2,3],c.getValues())
+ d=b.convertToDblArr()
+ expect3=[4,4,5,6,8]
+ b.sort()
+ self.assertEqual(expect3,b.getValues())
+ d.sort()
+ self.assertEqual(5,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ for i in xrange(5):
+ self.assertAlmostEqual(float(expect3[i]),d.getIJ(i,0),14);
+ pass
+ pass
+
+ def testAreCellsIncludedIn2(self):
+ myName="Vitoo";
+ m=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ m2=m.buildPartOfMySelf([],True);
+ self.assertEqual(0,m2.getNumberOfCells());
+ self.assertEqual(3,m2.getSpaceDimension());
+ self.assertEqual(2,m2.getMeshDimension());
+ m2.setName(myName);
+ test,tmp=m.areCellsIncludedIn(m2,0)
+ self.assertTrue(test);
+ self.assertEqual(myName,tmp.getName());
+ self.assertEqual(0,tmp.getNumberOfTuples())
+ self.assertEqual(1,tmp.getNumberOfComponents())
+ pass
+
+ def testUMeshGetPartBarycenterAndOwner1(self):
+ m1=MEDCouplingDataForTest.build2DTargetMesh_1();
+ part1=[1,0,4];
+ part=DataArrayInt.New();
+ part.setValues(part1,3,1);
+ b=m1.getPartBarycenterAndOwner(part);
+ self.assertEqual(2,b.getNumberOfComponents());
+ self.assertEqual(3,b.getNumberOfTuples());
+ expected1=[0.36666666666666665,-0.13333333333333333,-0.05,-0.05,0.45,0.45];
+ for i in xrange(6):
+ self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
+ pass
+ pass
+
+ def testUMeshGetPartMeasureField1(self):
+ m1=MEDCouplingDataForTest.build2DTargetMesh_1();
+ part1=[1,0,4];
+ part=DataArrayInt.New();
+ part.setValues(part1,3,1);
+ b=m1.getPartMeasureField(True,part);
+ self.assertEqual(1,b.getNumberOfComponents());
+ self.assertEqual(3,b.getNumberOfTuples());
+ expected1=[0.125,0.25,0.25];
+ for i in xrange(3):
+ self.assertAlmostEqual(expected1[i],b.getIJ(0,i),14);
+ pass
+ pass
+
+ def testUMeshBuildPartOrthogonalField1(self):
+ m1=MEDCouplingDataForTest.build2DTargetMesh_1();
+ m1.changeSpaceDimension(3);
+ part1=[1,0,4];
+ part=DataArrayInt.New();
+ part.setValues(part1,3,1);
+ b=m1.buildPartOrthogonalField(part);
+ self.assertEqual(3,b.getArray().getNumberOfComponents());
+ self.assertEqual(3,b.getArray().getNumberOfTuples());
+ expected1=[0.,0.,-1.,0.,0.,-1.,0.,0.,-1.];
+ for i in xrange(9):
+ self.assertAlmostEqual(expected1[i],b.getArray().getIJ(0,i),14);
+ pass
+ pass
+
+ def testUMeshGetTypesOfPart1(self):
+ m1=MEDCouplingDataForTest.build2DTargetMesh_1();
+ part1=[0,3,4];
+ p1=DataArrayInt.New()
+ p1.setValues(part1,3,1)
+ s=m1.getTypesOfPart(p1);
+ self.assertEqual([NORM_QUAD4],s);
+ part2=[2,2,2,1];
+ p2=DataArrayInt.New()
+ p2.setValues(part2,4,1)
+ s=m1.getTypesOfPart(p2);
+ self.assertEqual([NORM_TRI3],s);
+ part3=[3,2,1];
+ p3=DataArrayInt.New()
+ p3.setValues(part3,3,1)
+ s=m1.getTypesOfPart(p3);
+ self.assertEqual(s,[NORM_TRI3,NORM_QUAD4]);
+ pass
+
+ def testUMeshKeepCellIdsByType1(self):
+ m1=MEDCouplingDataForTest.build2DTargetMesh_1();
+ part1=[0,3,4]
+ p1=DataArrayInt.New()
+ p1.setValues(part1,3,1)
+ p1.setName("p1")
+ a=m1.keepCellIdsByType(NORM_TRI3,p1);
+ self.assertEqual("p1",a.getName())
+ self.assertEqual(1,a.getNumberOfComponents());
+ self.assertEqual(0,a.getNumberOfTuples());
+ #
+ part2=[3,2,0,2,4]
+ p2=DataArrayInt.New()
+ p2.setValues(part2,5,1)
+ p2.setName("p2")
+ a=m1.keepCellIdsByType(NORM_TRI3,p2);
+ self.assertEqual("p2",a.getName())
+ self.assertEqual(1,a.getNumberOfComponents());
+ self.assertEqual(2,a.getNumberOfTuples());
+ self.assertEqual(2,a.getIJ(0,0));
+ self.assertEqual(2,a.getIJ(1,0));
+ #
+ a=m1.keepCellIdsByType(NORM_QUAD4,p2);
+ self.assertEqual("p2",a.getName())
+ self.assertEqual(1,a.getNumberOfComponents());
+ self.assertEqual(3,a.getNumberOfTuples());
+ self.assertEqual(3,a.getIJ(0,0));
+ self.assertEqual(0,a.getIJ(1,0));
+ self.assertEqual(4,a.getIJ(2,0));
+ pass
+
+ def testSwigErrorDaIntSelectByTupleId1(self):
+ a=DataArrayInt.New();
+ arr1=[1,11,2,12,3,13,4,14,5,15,6,16,7,17]
+ a.setValues(arr1,7,2);
+ a.setInfoOnComponent(0,"toto");
+ a.setInfoOnComponent(1,"tata");
+ #
+ arr2=[4,2,0,6,5]
+ b=a.selectByTupleId(arr2);
+ self.assertEqual(5,b.getNumberOfTuples());
+ self.assertEqual(2,b.getNumberOfComponents());
+ self.assertTrue(b.getInfoOnComponent(0)=="toto");
+ self.assertTrue(b.getInfoOnComponent(1)=="tata");
+ expected1=[5,15,3,13,1,11,7,17,6,16]
+ self.assertEqual(expected1,b.getValues())
+ #
+ a2=DataArrayInt.New()
+ a2.setValues(arr2,5,1)
+ b=a.selectByTupleId(a2);
+ self.assertEqual(5,b.getNumberOfTuples());
+ self.assertEqual(2,b.getNumberOfComponents());
+ self.assertTrue(b.getInfoOnComponent(0)=="toto");
+ self.assertTrue(b.getInfoOnComponent(1)=="tata");
+ expected1=[5,15,3,13,1,11,7,17,6,16]
+ self.assertEqual(expected1,b.getValues())
+ pass
+
+ def testSwigErrorRenum(self):
+ da=DataArrayDouble.New()
+ da.setValues([7.,107.,8.,108.,9.,109.,10.,110.,11.,111.,12.,112.,13.,113.,14.,114.,15.,115.,16.,116.],10,2)
+ d=DataArrayInt.New()
+ d.setValues([0,2,3,1,4,5,6,8,7,9],10,1)
+ da.renumberInPlace(d)
+ da.renumber(d)
+ pass
+
+ def testSwigGetItem1(self):
+ da=DataArrayInt.New()
+ da.alloc(16,3)
+ da.rearrange(1)
+ da.iota(7)
+ da.rearrange(3)
+ da.setInfoOnComponent(0,"X [m]")
+ da.setInfoOnComponent(1,"Y [m]")
+ da.setInfoOnComponent(2,"Z [km]")
+ da2=da[5:-1]
+ self.assertEqual([22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51],da2.getValues())
+ da2=da[4]
+ self.assertEqual([19, 20, 21],da2.getValues())
+ try:
+ da2=da[4:17]
+ except InterpKernelException as e:
+ self.assertTrue(True)
+ else:
+ self.assertTrue(False)
+ pass
+ da2=da[5:-2,2]
+ self.assertEqual([24, 27, 30, 33, 36, 39, 42, 45, 48],da2.getValues())
+ da2=da[5:8,:]
+ self.assertEqual([22, 23, 24, 25, 26, 27, 28, 29, 30],da2.getValues())
+ da2=da[:]
+ self.assertTrue(da2.isEqual(da))
+ da2=da[:,:]
+ self.assertTrue(da2.isEqual(da))
+ try:
+ da2=da[:,:,:]
+ except InterpKernelException as e:
+ self.assertTrue(True)
+ else:
+ self.assertTrue(False)
+ pass
+ try:
+ da2=da[5:8,-2]
+ except InterpKernelException as e:
+ self.assertTrue(True)
+ else:
+ self.assertTrue(False)
+ pass
+ da2=da[5:8,:-2]
+ self.assertEqual([22, 25, 28],da2.getValues())
+ try:
+ da2=da[5:-18,2]
+ except InterpKernelException as e:
+ self.assertTrue(True)
+ else:
+ self.assertTrue(False)
+ pass
+ da2=da[5:5,2]
+ self.assertEqual([],da2.getValues())
+ pass
+
+ def testSwigGetItem2(self):
+ da=DataArrayDouble.New()
+ da.alloc(16,3)
+ da.rearrange(1)
+ da.iota(7)
+ da.rearrange(3)
+ da.setInfoOnComponent(0,"X [m]")
+ da.setInfoOnComponent(1,"Y [m]")
+ da.setInfoOnComponent(2,"Z [km]")
+ da2=da[5:-1]
+ self.assertEqual([22., 23., 24., 25., 26., 27., 28., 29., 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., 40., 41., 42., 43., 44., 45., 46., 47., 48., 49., 50., 51.],da2.getValues())
+ da2=da[4]
+ self.assertEqual([19., 20., 21],da2.getValues())
+ try:
+ da2=da[4:17]
+ except InterpKernelException as e:
+ self.assertTrue(True)
+ else:
+ self.assertTrue(False)
+ pass
+ da2=da[5:-2,2]
+ self.assertEqual([24., 27., 30., 33., 36., 39., 42., 45., 48.],da2.getValues())
+ da2=da[5:8,:]
+ self.assertEqual([22., 23., 24., 25., 26., 27., 28., 29., 30.],da2.getValues())
+ da2=da[:]
+ self.assertTrue(da2.isEqual(da,1e-12))
+ da2=da[:,:]
+ self.assertTrue(da2.isEqual(da,1e-12))
+ try:
+ da2=da[:,:,:]
+ except InterpKernelException as e:
+ self.assertTrue(True)
+ else:
+ self.assertTrue(False)
+ pass
+ try:
+ da2=da[5:8,-2]
+ except InterpKernelException as e:
+ self.assertTrue(True)
+ else:
+ self.assertTrue(False)
+ pass
+ da2=da[5:8,:-2]
+ self.assertEqual([22., 25., 28.],da2.getValues())
+ try:
+ da2=da[5:-18,2]
+ except InterpKernelException as e:
+ self.assertTrue(True)
+ else:
+ self.assertTrue(False)
+ pass
+ da2=da[5:5,2]
+ self.assertEqual([],da2.getValues())
+ pass
+
+ def testSwigSetItem1(self):
+ da=DataArrayInt.New()
+ da.alloc(20,1)
+ da.iota(7)
+ da.rearrange(5)
+ da.setInfoOnComponent(0,"X [m]") ; da.setInfoOnComponent(1,"Y [km]") ; da.setInfoOnComponent(2,"Y [m]")
+ da.setInfoOnComponent(3,"Z [W]") ; da.setInfoOnComponent(4,"ZZ [km]") ;
+ da[:,2]=3
+ self.assertEqual([7, 8, 3, 10, 11, 12, 13, 3, 15, 16, 17, 18, 3, 20, 21, 22, 23, 3, 25, 26],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[2]=3
+ self.assertEqual([7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 3, 3, 3, 3, 3, 22, 23, 24, 25, 26],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[[0,3]]=-1
+ self.assertEqual([-1, -1, -1, -1, -1, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, -1, -1],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[:,[1,3,4]]=-3
+ self.assertEqual([7, -3, 9, -3, -3, 12, -3, 14, -3, -3, 17, -3, 19, -3, -3, 22, -3, 24, -3, -3],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da2=DataArrayInt.New() ; da2.setValues([0,2,3],3,1)
+ da[da2]=-7
+ self.assertEqual([-7, -7, -7, -7, -7, 12, 13, 14, 15, 16, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,-2:]=-7
+ self.assertEqual([7, 8, 9, -7, -7, 12, 13, 14, 15, 16, 17, 18, 19, -7, -7, 22, 23, 24, -7, -7],da.getValues())
+ # Let's test with DAI right hand side
+ da1=DataArrayInt.New()
+ da1.setValues([25,26,27,125,126,127],2,3)
+ #
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[-2:,1:4]=da1
+ self.assertEqual([7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 25, 26, 27, 21, 22, 125, 126, 127, 26],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[1:,3]=[225,226,227]
+ self.assertEqual([7, 8, 9, 10, 11, 12, 13, 14, 225, 16, 17, 18, 19, 226, 21, 22, 23, 24, 227, 26],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[1,2:]=[225,226,227]
+ self.assertEqual([7, 8, 9, 10, 11, 12, 13, 225, 226, 227, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,-2:]=[88,99,1010,1111,1212,1313]
+ self.assertEqual([7, 8, 9, 88, 99, 12, 13, 14, 15, 16, 17, 18, 19, 1010, 1111, 22, 23, 24, 1212, 1313],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da3=DataArrayInt.New(); da3.setValues([88,99,1010,1111,1212,1313],3,2)
+ da[da2,-2:]=da3
+ self.assertEqual([7, 8, 9, 88, 99, 12, 13, 14, 15, 16, 17, 18, 19, 1010, 1111, 22, 23, 24, 1212, 1313],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,[0,2]]=da3
+ self.assertEqual([88, 8, 99, 10, 11, 12, 13, 14, 15, 16, 1010, 18, 1111, 20, 21, 1212, 23, 1313, 25, 26],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,0:3:2]=da3
+ self.assertEqual([88, 8, 99, 10, 11, 12, 13, 14, 15, 16, 1010, 18, 1111, 20, 21, 1212, 23, 1313, 25, 26],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,0:3:2]=-8
+ self.assertEqual([-8, 8, -8, 10, 11, 12, 13, 14, 15, 16, -8, 18, -8, 20, 21, -8, 23, -8, 25, 26],da.getValues())
+ pass
+
+ def testSwigSetItem2(self):
+ da=DataArrayDouble.New()
+ da.alloc(20,1)
+ da.iota(7)
+ da.rearrange(5)
+ da.setInfoOnComponent(0,"X [m]") ; da.setInfoOnComponent(1,"Y [km]") ; da.setInfoOnComponent(2,"Y [m]")
+ da.setInfoOnComponent(3,"Z [W]") ; da.setInfoOnComponent(4,"ZZ [km]") ;
+ da[:,2]=3.
+ self.assertEqual([7., 8., 3., 10., 11., 12., 13., 3., 15., 16., 17., 18., 3., 20., 21., 22., 23., 3., 25., 26.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[2]=3.
+ self.assertEqual([7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 3., 3., 3., 3., 3., 22., 23., 24., 25., 26.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[[0,3]]=-1.
+ self.assertEqual([-1., -1., -1., -1., -1., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21., -1., -1., -1., -1., -1.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[:,[1,3,4]]=-3.
+ self.assertEqual([7., -3., 9., -3., -3., 12., -3., 14., -3., -3., 17., -3., 19., -3., -3., 22., -3., 24., -3., -3.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da2=DataArrayInt.New() ; da2.setValues([0,2,3],3,1)
+ da[da2]=-7.
+ self.assertEqual([-7., -7., -7., -7., -7., 12., 13., 14., 15., 16., -7., -7., -7., -7., -7., -7., -7., -7., -7., -7.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,-2:]=-7
+ self.assertEqual([7., 8., 9., -7., -7., 12., 13., 14., 15., 16., 17., 18., 19., -7., -7., 22., 23., 24., -7., -7.],da.getValues())
+ # Let's test with DAI right hand side
+ da1=DataArrayDouble.New()
+ da1.setValues([25,26,27,125,126,127],2,3)
+ #
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[-2:,1:4]=da1
+ self.assertEqual([7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 25., 26., 27., 21., 22., 125., 126., 127., 26.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[1:,3]=[225.,226.,227.]
+ self.assertEqual([7., 8., 9., 10., 11., 12., 13., 14., 225., 16., 17., 18., 19., 226., 21., 22., 23., 24., 227., 26.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[1,2:]=[225,226,227]
+ self.assertEqual([7., 8., 9., 10., 11., 12., 13., 225., 226., 227., 17., 18., 19., 20., 21., 22., 23., 24., 25., 26.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,-2:]=[88,99,1010,1111,1212,1313]
+ self.assertEqual([7., 8., 9., 88., 99., 12., 13., 14., 15., 16., 17., 18., 19., 1010., 1111., 22., 23., 24., 1212., 1313.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da3=DataArrayDouble.New(); da3.setValues([88,99,1010,1111,1212,1313],3,2)
+ da[da2,-2:]=da3
+ self.assertEqual([7., 8., 9., 88., 99., 12., 13., 14., 15., 16., 17., 18., 19., 1010., 1111., 22., 23., 24., 1212., 1313.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,[0,2]]=da3
+ self.assertEqual([88., 8., 99., 10., 11., 12., 13., 14., 15., 16., 1010., 18., 1111., 20., 21., 1212., 23., 1313., 25., 26.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,0:3:2]=da3
+ self.assertEqual([88., 8., 99., 10., 11., 12., 13., 14., 15., 16., 1010., 18., 1111., 20., 21., 1212., 23., 1313., 25., 26.],da.getValues())
+ da.rearrange(1) ; da.iota(7) ; da.rearrange(5)
+ da[da2,0:3:2]=-8.
+ self.assertEqual([-8., 8., -8., 10., 11., 12., 13., 14., 15., 16., -8., 18., -8., 20., 21., -8., 23., -8., 25., 26.],da.getValues())
+ pass
+
+ def testSwigDADOp(self):
+ da=DataArrayDouble.New()
+ da.alloc(12,1)
+ da.iota(7.)
+ da1=DataArrayDouble.New()
+ da1.alloc(12,1)
+ da1.iota(8.)
+ da2=da+da1
+ self.assertEqual([15., 17., 19., 21., 23., 25., 27., 29., 31., 33., 35., 37.],da2.getValues())
+ da2=da+3
+ da3=3+da
+ self.assertTrue(da2.isEqual(da3,1e-12))
+ da2=da-1.
+ self.assertEqual([6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0],da2.getValues())
+ da2=1-da
+ self.assertEqual([-6.0, -7.0, -8.0, -9.0, -10.0, -11.0, -12.0, -13.0, -14.0, -15.0, -16.0, -17.0],da2.getValues())
+ da2=da*3
+ self.assertEqual([21.0, 24.0, 27.0, 30.0, 33.0, 36.0, 39.0, 42.0, 45.0, 48.0, 51.0, 54.0],da2.getValues())
+ da2=3.*da
+ self.assertEqual([21.0, 24.0, 27.0, 30.0, 33.0, 36.0, 39.0, 42.0, 45.0, 48.0, 51.0, 54.0],da2.getValues())
+ da2=da*da1
+ self.assertEqual([56.0, 72.0, 90.0, 110.0, 132.0, 156.0, 182.0, 210.0, 240.0, 272.0, 306.0, 342.0],da2.getValues())
+ da2=da/4.
+ self.assertEqual([1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.25, 4.5],da2.getValues())
+ da3=4./da
+ da4=da3*da2
+ self.assertTrue(da4.isUniform(1.,1e-12))
+ st1=da.getHiddenCppPointer()
+ da+=1
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertTrue(da.isEqual(da1,1e-12))
+ da-=8
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual(range(12),da.getValues())
+ da+=da1
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 22.0, 24.0, 26.0, 28.0, 30.0],da.getValues())
+ da*=0.5
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0],da.getValues())
+ da*=da1
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([32.0, 45.0, 60.0, 77.0, 96.0, 117.0, 140.0, 165.0, 192.0, 221.0, 252.0, 285.0],da.getValues())
+ da/=da1
+ self.assertEqual(st1,st2)
+ self.assertEqual([4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0],da.getValues())
+ da/=2
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5],da.getValues())
+ da.rearrange(3)
+ da5=DataArrayDouble.New()
+ da5.setValues([5.,4.,3.,2.],4,1)
+ da*=da5 # it works with unmathing number of compo
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([10.0, 12.5, 15.0, 14.0, 16.0, 18.0, 15.0, 16.5, 18.0, 13.0, 14.0, 15.0],da.getValues())
+ pass
+
+ def testSwigDAIOp(self):
+ da=DataArrayInt.New()
+ da.alloc(12,1)
+ da.iota(7)
+ da1=DataArrayInt.New()
+ da1.alloc(12,1)
+ da1.iota(8)
+ da2=da+da1
+ self.assertEqual([15,17,19,21,23,25,27,29,31,33,35,37],da2.getValues())
+ da2=da+3
+ da3=3+da
+ self.assertTrue(da2.isEqual(da3))
+ da2=da-1
+ self.assertEqual([6,7,8,9,10,11,12,13,14,15,16,17],da2.getValues())
+ da2=1-da
+ self.assertEqual([-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17],da2.getValues())
+ da2=da*3
+ self.assertEqual([21,24,27,30,33,36,39,42,45,48,51,54.0],da2.getValues())
+ da2=3*da
+ self.assertEqual([21,24,27,30,33,36,39,42,45,48,51,54.0],da2.getValues())
+ da2=da*da1
+ self.assertEqual([56,72,90,110,132,156,182,210,240,272,306,342.0],da2.getValues())
+ da2=da/4
+ self.assertEqual([1,2,2,2,2,3,3,3,3,4,4,4],da2.getValues())
+ da3=4/da
+ da4=da3*da2
+ self.assertTrue(da4.isUniform(0))
+ st1=da.getHiddenCppPointer()
+ da+=1
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertTrue(da.isEqual(da1))
+ da-=8
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual(range(12),da.getValues())
+ da+=da1
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([8,10,12,14,16,18,20,22,24,26,28,30],da.getValues())
+ da/=2
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([4,5,6,7,8,9,10,11,12,13,14,15],da.getValues())
+ da*=da1
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([32,45,60,77,96,117,140,165,192,221,252,285],da.getValues())
+ da/=da1
+ self.assertEqual(st1,st2)
+ self.assertEqual([4,5,6,7,8,9,10,11,12,13,14,15],da.getValues())
+ da/=2
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([2,2, 3,3, 4,4, 5,5, 6,6, 7,7],da.getValues())
+ da.rearrange(3)
+ da5=DataArrayInt.New()
+ da5.setValues([5,4,3,2],4,1)
+ da*=da5 # it works with unmathing number of compo
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([10,10, 15,12,16,16,15,15, 18,12,14,14],da.getValues())
+ da%=6
+ st2=da.getHiddenCppPointer()
+ self.assertEqual(st1,st2)
+ self.assertEqual([4,4,3,0,4,4,3,3,0,0,2,2],da.getValues())
+ pass
+
+ def testSwigDAIOp2(self):
+ da=DataArrayInt.New()
+ st=da.getHiddenCppPointer()
+ da.alloc(10,3)
+ da.rearrange(1)
+ da.iota(0)
+ da.rearrange(3)
+ da[:,1]+=4
+ da[-2:,2]+=10
+ da[-2:,2]+=10
+ da[:,2]+=da[:,0]
+ da[da[0],:]=7
+ self.assertEqual(st,da.getHiddenCppPointer())
+ self.assertEqual(da.getValues(),[7,7,7,3,8,8,7,7,7,9,14,20,12,17,26,7,7,7,18,23,38,21,26,44,24,29,70,27,32,76])
+ pass
+
+ def testDAIAggregateMulti1(self):
+ a=DataArrayInt.New()
+ a.setValues(range(4),2,2)
+ a.setName("aa")
+ b=DataArrayInt.New()
+ b.setValues(range(6),3,2)
+ c=DataArrayInt.Aggregate([a,b])
+ self.assertEqual(range(4)+range(6),c.getValues())
+ self.assertEqual("aa",c.getName())
+ self.assertEqual(5,c.getNumberOfTuples())
+ self.assertEqual(2,c.getNumberOfComponents())
+ pass
+
+ def testMergeUMeshes2(self):
+ m1=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ m2=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ m3=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ #
+ vec1=[0,2,3]
+ m2_2=m2.buildPartOfMySelf(vec1,False);
+ vec2=[1,1]
+ m3_2=m3.buildPartOfMySelf(vec2,False);
+ #
+ ms=[m1,m2_2,m3_2];
+ #
+ m4=MEDCouplingUMesh.MergeUMeshes(ms);
+ m4.checkCoherency();
+ self.assertEqual(10,m4.getNumberOfCells());
+ self.assertEqual(20,m4.getNumberOfNodes());
+ self.assertEqual(45,m4.getMeshLength());
+ #
+ vec3=[0,1,2,3,4]
+ m4_1=m4.buildPartOfMySelf(vec3,False);
+ m4_1.setName(m1.getName());
+ self.assertTrue(m4_1.isEqual(m1,1e-12));
+ #
+ vec4=[5,6,7]
+ m4_2=m4.buildPartOfMySelf(vec4,False);
+ cellCor,nodeCor=m4_2.checkGeoEquivalWith(m2_2,10,1e-12);
+ #
+ vec5=[8,9]
+ m4_3=m4.buildPartOfMySelf(vec5,False);
+ self.assertEqual(2,m4_3.getNumberOfCells());
+ self.assertEqual(3,m4_3.getNumberOfNodes());
+ m3_2.zipCoords();
+ m4_3.setName(m3_2.getName());
+ self.assertTrue(m4_3.isEqual(m3_2,1e-12));
+ #
+ pass
+
+ def testBuild0DMeshFromCoords1(self):
+ sourceCoords=[-0.3,-0.3,0., 0.7,-0.3,0., -0.3,0.7,0., 0.7,0.7,0.]
+ coo=DataArrayDouble.New();
+ coo.setValues(sourceCoords,4,3);
+ coo.setName("My0D");
+ m=MEDCouplingUMesh.Build0DMeshFromCoords(coo);
+ m.checkCoherency();
+ self.assertEqual(4,m.getNumberOfNodes());
+ self.assertEqual(4,m.getNumberOfCells());
+ self.assertEqual(3,m.getSpaceDimension());
+ self.assertEqual(0,m.getMeshDimension());
+ types1=m.getAllTypes();
+ self.assertEqual([NORM_POINT1],types1);
+ for i in xrange(4):
+ conn=m.getNodeIdsOfCell(i);
+ self.assertEqual([i],conn);
+ self.assertTrue(NORM_POINT1==m.getTypeOfCell(i));
+ pass
+ self.assertEqual(m.getName(),"My0D");
+ pass
+
+ def testDescriptionInMeshTimeUnit1(self):
+ text1="totoTTEDD";
+ m=MEDCouplingDataForTest.build2DTargetMesh_1();
+ m.setDescription(text1);
+ self.assertEqual(m.getDescription(),text1);
+ m2=m.deepCpy();
+ self.assertTrue(m.isEqual(m2,1e-12));
+ self.assertEqual(m2.getDescription(),text1);
+ m2.setDescription("ggg");
+ self.assertTrue(not m.isEqual(m2,1e-12));
+ #
+ f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+ f.setTimeUnit(text1);
+ self.assertEqual(f.getTimeUnit(),text1);
+ f2=f.deepCpy();
+ self.assertEqual(f2.getTimeUnit(),text1);
+ #
+ pass
+
+ def testMultiFields1(self):
+ mfs=MEDCouplingDataForTest.buildMultiFields_1();
+ ms=mfs.getMeshes();
+ dms,refs=mfs.getDifferentMeshes()
+ das=mfs.getArrays();
+ das2,refs2=mfs.getDifferentArrays()
+ self.assertEqual(5,len(mfs.getFields()))
+ self.assertEqual(1,len(mfs.getFields()[0].getArrays()));
+ self.assertEqual(2,len(mfs.getFields()[1].getArrays()));
+ self.assertEqual(1,len(mfs.getFields()[2].getArrays()));
+ self.assertEqual(1,len(mfs.getFields()[3].getArrays()));
+ self.assertEqual(1,len(mfs.getFields()[4].getArrays()));
+ self.assertEqual(5,len(ms));
+ self.assertEqual(2,len(dms));
+ self.assertEqual(6,len(das));
+ self.assertEqual(5,len(das2));
+ mfs2=mfs.deepCpy();
+ self.assertTrue(mfs.isEqual(mfs2,1e-12,1e-12))
+ pass
+
+ def testFieldOverTime1(self):
+ fs=MEDCouplingDataForTest.buildMultiFields_2();
+ self.assertRaises(InterpKernelException,MEDCouplingFieldOverTime.New,fs);
+ f4bis=fs[4].buildNewTimeReprFromThis(ONE_TIME,False);
+ fs[4]=f4bis;
+ self.assertRaises(InterpKernelException,MEDCouplingFieldOverTime.New,fs);
+ f4bis.setTime(2.7,20,21);
+ fot=MEDCouplingFieldOverTime.New(fs);
+ dt=fot.getDefinitionTimeZone();
+ hs=dt.getHotSpotsTime();
+ self.assertEqual(6,len(hs));
+ expected1=[0.2,0.7,1.2,1.35,1.7,2.7]
+ for i in xrange(6):
+ self.assertAlmostEqual(expected1[i],hs[i],12);
+ pass
+ meshId,arrId,arrIdInField,fieldId=dt.getIdsOnTimeRight(0.2);
+ self.assertEqual(0,meshId);
+ self.assertEqual(0,arrId);
+ self.assertEqual(0,arrIdInField);
+ self.assertEqual(0,fieldId);
+ #
+ meshId,arrId,arrIdInField,fieldId=dt.getIdsOnTimeRight(0.7);
+ self.assertEqual(0,meshId);
+ self.assertEqual(1,arrId);
+ self.assertEqual(0,arrIdInField);
+ self.assertEqual(1,fieldId);
+ #
+ meshId,arrId,arrIdInField,fieldId=dt.getIdsOnTimeLeft(1.2);#**** WARNING left here
+ self.assertEqual(0,meshId);
+ self.assertEqual(2,arrId);
+ self.assertEqual(1,arrIdInField);
+ self.assertEqual(1,fieldId);
+ #
+ meshId,arrId,arrIdInField,fieldId=dt.getIdsOnTimeRight(1.2);#**** WARNING right again here
+ self.assertEqual(1,meshId);
+ self.assertEqual(3,arrId);
+ self.assertEqual(0,arrIdInField);
+ self.assertEqual(2,fieldId);
+ #
+ meshId,arrId,arrIdInField,fieldId=dt.getIdsOnTimeRight(1.35);
+ self.assertEqual(1,meshId);
+ self.assertEqual(3,arrId);
+ self.assertEqual(0,arrIdInField);
+ self.assertEqual(2,fieldId);
+ #
+ meshId,arrId,arrIdInField,fieldId=dt.getIdsOnTimeRight(1.7);
+ self.assertEqual(0,meshId);
+ self.assertEqual(3,arrId);
+ self.assertEqual(0,arrIdInField);
+ self.assertEqual(3,fieldId);
+ #
+ meshId,arrId,arrIdInField,fieldId=dt.getIdsOnTimeRight(2.7);
+ self.assertEqual(1,meshId);
+ self.assertEqual(4,arrId);
+ self.assertEqual(0,arrIdInField);
+ self.assertEqual(4,fieldId);
+ #
+ dt2=MEDCouplingDefinitionTime();
+ self.assertTrue(not dt2.isEqual(dt));
+ dt2.assign(dt);
+ dt2.assign(dt);#to check memory management
+ self.assertTrue(dt2.isEqual(dt));
+ #
+ dt3=MEDCouplingDefinitionTime();
+ #
+ pass
+
+ def testDAICheckAndPreparePermutation1(self):
+ vals1=[9,10,0,6,4,11,3,7];
+ expect1=[5,6,0,3,2,7,1,4];
+ vals2=[9,10,0,6,10,11,3,7];
+ da=DataArrayInt.New();
+ da.setValues(vals1,8,1);
+ da2=da.checkAndPreparePermutation();
+ self.assertEqual(8,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ for i in xrange(8):
+ self.assertEqual(expect1[i],da2.getIJ(i,0));
+ pass
+ #
+ da=DataArrayInt.New();
+ da.alloc(8,1);
+ da.iota(0);
+ da2=da.checkAndPreparePermutation();
+ self.assertEqual(8,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ self.assertTrue(da2.isIdentity());
+ #
+ da=DataArrayInt.New();
+ da.alloc(8,1);
+ da.setValues(vals2,8,1);
+ self.assertRaises(InterpKernelException,da.checkAndPreparePermutation);
+ pass
+
+ def testDAIChangeSurjectiveFormat1(self):
+ vals1=[0,3,2,3,2,2,1,2]
+ expected1=[0,1,2,6,8]
+ expected2=[0, 6, 2,4,5,7, 1,3]
+ da=DataArrayInt.New();
+ da.setValues(vals1,8,1);
+ #
+ da2,da2I=da.changeSurjectiveFormat(4);
+ self.assertEqual(5,da2I.getNumberOfTuples());
+ self.assertEqual(8,da2.getNumberOfTuples());
+ self.assertEqual(expected1,da2I.getValues());
+ self.assertEqual(expected2,da2.getValues());
+ #
+ self.assertRaises(InterpKernelException,da.changeSurjectiveFormat,3);
+ #
+ pass
+
+ def testUMeshGetCellIdsLyingOnNodes1(self):
+ m=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ nodeIds1=[1,2,3,4,6]
+ nodeIds2=[6,7]
+ da=m.getCellIdsLyingOnNodes(nodeIds1,True);
+ self.assertEqual(1,da.getNumberOfTuples());
+ self.assertEqual(1,da.getNumberOfComponents());
+ self.assertEqual(1,da.getIJ(0,0));
+ da2=DataArrayInt.New()
+ da2.setValues(nodeIds2,2,1)
+ da=m.getCellIdsLyingOnNodes(da2,False);
+ self.assertEqual(2,da.getNumberOfTuples());
+ self.assertEqual(1,da.getNumberOfComponents());
+ self.assertEqual(3,da.getIJ(0,0));
+ self.assertEqual(4,da.getIJ(1,0));
+ pass
+
+ def testUMeshFindCellsIdsOnBoundary1(self):
+ m=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ da5=m.findCellsIdsOnBoundary();
+ self.assertEqual(5,da5.getNumberOfTuples());
+ self.assertTrue(da5.isIdentity());
+ pass
+
+ def testMeshSetTime1(self):
+ m1=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ m2=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ #
+ self.assertTrue(m1.isEqual(m2,1e-12));
+ m1.setTime(3.14,6,7);
+ tmp3,tmp1,tmp2=m1.getTime();
+ self.assertEqual(6,tmp1);
+ self.assertEqual(7,tmp2);
+ self.assertAlmostEqual(3.14,tmp3,12);
+ self.assertTrue(not m1.isEqual(m2,1e-12));
+ m2.setTime(3.14,6,7);
+ self.assertTrue(m1.isEqual(m2,1e-12));
+ m1.setTimeUnit("ms");
+ self.assertTrue(m1.getTimeUnit()=="ms");
+ m1.setTimeUnit("us");
+ self.assertTrue(m1.getTimeUnit()=="us");
+ self.assertTrue(not m1.isEqual(m2,1e-12));
+ m2.setTimeUnit("us");
+ self.assertTrue(m1.isEqual(m2,1e-12));
+ m2.setTime(3.14,6,8);
+ self.assertTrue(not m1.isEqual(m2,1e-12));
+ m2.setTime(3.14,7,7);
+ self.assertTrue(not m1.isEqual(m2,1e-12));
+ m2.setTime(3.15,6,7);
+ self.assertTrue(not m1.isEqual(m2,1e-12));
+ #
+ m1.setTime(10.34,55,12);
+ m3=m1.deepCpy();
+ self.assertTrue(m1.isEqual(m3,1e-12));
+ tmp3,tmp1,tmp2=m3.getTime();
+ self.assertEqual(55,tmp1);
+ self.assertEqual(12,tmp2);
+ self.assertAlmostEqual(10.34,tmp3,12);
+ #
+ # testing CMesh
+ coo1=[0.,1.,2.,3.5]
+ a=DataArrayDouble.New();
+ a.setValues(coo1,4,1);
+ b=MEDCouplingCMesh.New();
+ b.setCoordsAt(0,a);
+ #
+ b.setTime(5.67,8,100);
+ tmp3,tmp1,tmp2=b.getTime();
+ self.assertEqual(8,tmp1);
+ self.assertEqual(100,tmp2);
+ self.assertAlmostEqual(5.67,tmp3,12);
+ c=b.deepCpy();
+ self.assertTrue(c.isEqual(b,1e-12));
+ tmp3,tmp1,tmp2=c.getTime();
+ self.assertEqual(8,tmp1);
+ self.assertEqual(100,tmp2);
+ self.assertAlmostEqual(5.67,tmp3,12);
+ pass
+
+ def testApplyFuncTwo1(self):
+ m1=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+ f1.setMesh(m1);
+ #
+ vals=[1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.,5.,15.,25.]
+ da=DataArrayDouble.New();
+ da.setValues(vals,5,3);
+ f1.setArray(da);
+ #
+ self.assertRaises(InterpKernelException,da.applyFunc2,1,"y+z");
+ da.setInfoOnComponent(0,"x [m]");
+ da.setInfoOnComponent(1,"y [mm]");
+ da.setInfoOnComponent(2,"z [km]");
+ da2=da.applyFunc2(1,"y+z");
+ self.assertEqual(1,da2.getNumberOfComponents());
+ self.assertEqual(5,da2.getNumberOfTuples());
+ expected1=[32.,34.,36.,38.,40.]
+ for i in xrange(5):
+ self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),12);
+ pass
+ da2=da.applyFunc(1,"y+z");
+ expected2=[12.,14.,16.,18.,20.]
+ for i in xrange(5):
+ self.assertAlmostEqual(expected2[i],da2.getIJ(0,i),12);
+ pass
+ #
+ self.assertEqual(3,f1.getNumberOfComponents());
+ self.assertEqual(5,f1.getNumberOfTuples());
+ f1.applyFunc2(1,"y+z");
+ self.assertEqual(1,f1.getNumberOfComponents());
+ self.assertEqual(5,f1.getNumberOfTuples());
+ for i in xrange(5):
+ self.assertAlmostEqual(expected1[i],f1.getArray().getIJ(0,i),12);
+ pass
+ #
+ pass
+
+ def testApplyFuncThree1(self):
+ m1=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+ f1.setMesh(m1);
+ #
+ vals=[1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.,5.,15.,25.]
+ da=DataArrayDouble.New();
+ da.setValues(vals,5,3);
+ f1.setArray(da);
+ #
+ vs=3*[None];
+ vs[0]="x"; vs[1]="Y"; vs[2]="z";
+ self.assertRaises(InterpKernelException,da.applyFunc3,1,vs,"y+z");
+ vs[1]="y";
+ da2=da.applyFunc3(1,vs,"y+z");
+ expected1=[32.,34.,36.,38.,40.]
+ for i in xrange(5):
+ self.assertAlmostEqual(expected1[i],da2.getIJ(0,i),12);
+ pass
+ f1.setArray(da);
+ self.assertEqual(3,f1.getNumberOfComponents());
+ self.assertEqual(5,f1.getNumberOfTuples());
+ f1.applyFunc3(1,vs,"y+z");
+ self.assertEqual(1,f1.getNumberOfComponents());
+ self.assertEqual(5,f1.getNumberOfTuples());
+ for i in xrange(5):
+ self.assertAlmostEqual(expected1[i],f1.getArray().getIJ(0,i),12);
+ pass
+ pass
+
+ def testFillFromAnalyticTwo1(self):
+ m1=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ self.assertRaises(InterpKernelException,m1.fillFromAnalytic2,ON_NODES,1,"y+z");
+ m1.getCoords().setInfoOnComponent(0,"x [m]");
+ m1.getCoords().setInfoOnComponent(1,"y");
+ m1.getCoords().setInfoOnComponent(2,"z");
+ f1=m1.fillFromAnalytic2(ON_NODES,1,"y+z");
+ self.assertEqual(1,f1.getNumberOfComponents());
+ self.assertEqual(9,f1.getNumberOfTuples());
+ expected1=[0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2]
+ for i in xrange(9):
+ self.assertAlmostEqual(expected1[i],f1.getArray().getIJ(0,i),12);
+ pass
+ pass
+
+ def testFillFromAnalyticThree1(self):
+ m1=MEDCouplingDataForTest.build3DSurfTargetMesh_1();
+ vs=3*[None];
+ vs[0]="x"; vs[1]="Y"; vs[2]="z";
+ self.assertRaises(InterpKernelException,m1.fillFromAnalytic3,ON_NODES,1,vs,"y+z");
+ vs[1]="y";
+ f1=m1.fillFromAnalytic3(ON_NODES,1,vs,"y+z");
+ self.assertEqual(1,f1.getNumberOfComponents());
+ self.assertEqual(9,f1.getNumberOfTuples());
+ expected1=[0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2]
+ for i in xrange(9):
+ self.assertAlmostEqual(expected1[i],f1.getArray().getIJ(0,i),12);
+ pass
+ pass
+
+ def testDAUnitVar1(self):
+ da=DataArrayDouble.New();
+ da.alloc(1,3);
+ da.setInfoOnComponent(0,"XPS [m]");
+ st1=da.getVarOnComponent(0);
+ self.assertTrue(st1=="XPS");
+ st2=da.getUnitOnComponent(0);
+ self.assertTrue(st2=="m");
+ #
+ da.setInfoOnComponent(0,"XPS [m]");
+ st1=da.getVarOnComponent(0);
+ self.assertTrue(st1=="XPS");
+ st2=da.getUnitOnComponent(0);
+ self.assertTrue(st2=="m");
+ #
+ da.setInfoOnComponent(0,"XPP [m]");
+ st1=da.getVarOnComponent(0);
+ self.assertTrue(st1=="XPP");
+ st2=da.getUnitOnComponent(0);
+ self.assertTrue(st2=="m");
+ #
+ da.setInfoOnComponent(0,"XPP kdep kefer [ m ]");
+ st1=da.getVarOnComponent(0);
+ self.assertTrue(st1=="XPP kdep kefer");
+ st2=da.getUnitOnComponent(0);
+ self.assertTrue(st2==" m ");
+ #
+ da.setInfoOnComponent(0," XPP k[ dep k]efer [ m^ 2/s^3*kJ ]");
+ st1=da.getVarOnComponent(0);
+ self.assertTrue(st1==" XPP k[ dep k]efer");
+ st2=da.getUnitOnComponent(0);
+ self.assertTrue(st2==" m^ 2/s^3*kJ ");
+ #
+ da.setInfoOnComponent(0," XPP kefer ");
+ st1=da.getVarOnComponent(0);
+ self.assertTrue(st1==" XPP kefer ");
+ st2=da.getUnitOnComponent(0);
+ self.assertTrue(st2=="");
+ #
+ da.setInfoOnComponent(0,"temperature( bof)");
+ st1=da.getVarOnComponent(0);
+ self.assertTrue(st1=="temperature( bof)");
+ st2=da.getUnitOnComponent(0);
+ self.assertTrue(st2=="");
+ #
+ da.setInfoOnComponent(0,"kkk [m]");
+ da.setInfoOnComponent(1,"ppp [m^2/kJ]");
+ da.setInfoOnComponent(2,"abcde [MW/s]");
+ #
+ vs=da.getVarsOnComponent();
+ self.assertEqual(3,len(vs));
+ self.assertTrue(vs[0]=="kkk");
+ self.assertTrue(vs[1]=="ppp");
+ self.assertTrue(vs[2]=="abcde");
+ vs=da.getUnitsOnComponent();
+ self.assertEqual(3,len(vs));
+ self.assertTrue(vs[0]=="m");
+ self.assertTrue(vs[1]=="m^2/kJ");
+ self.assertTrue(vs[2]=="MW/s");
+ pass
+
+ def testGaussCoordinates1(self):
+ #Testing 1D cell types
+ m1=MEDCouplingDataForTest.build1DMultiTypes_1();
+ f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,ONE_TIME);
+ f.setMesh(m1);
+ wg1=[0.3];
+ gsCoo1=[0.2];
+ refCoo1=[-1.0,1.0];
+ f.setGaussLocalizationOnType(NORM_SEG2,refCoo1,gsCoo1,wg1);
+ wg2=wg1;
+ gsCoo2=[0.2];
+ refCoo2=[-1.0,1.0,0.0];
+ f.setGaussLocalizationOnType(NORM_SEG3,refCoo2,gsCoo2,wg2);
+ #
+ resToTest=f.getLocalizationOfDiscr();
+ self.assertEqual(3,resToTest.getNumberOfComponents());
+ self.assertEqual(2,resToTest.getNumberOfTuples());
+ expected1=[0.6,0.6,0.6, 0.6,0.6,0.6]
+ for i in xrange(6):
+ self.assertAlmostEqual(expected1[i],resToTest.getIJ(0,i),14);
+ pass
+ #
+ #Testing 2D cell types
+ m2=MEDCouplingDataForTest.build2DMultiTypes_1();
+ f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,ONE_TIME);
+ f.setMesh(m2);
+ wg3=[0.3,0.3];
+ tria3CooGauss=[ 0.1, 0.8, 0.2, 0.7 ]
+ gsCoo3=tria3CooGauss
+ tria3CooRef=[ 0.0, 0.0, 1.0 , 0.0, 0.0, 1.0 ]
+ refCoo3=tria3CooRef;
+ f.setGaussLocalizationOnType(NORM_TRI3,refCoo3,gsCoo3,wg3);
+ wg4=[0.3,0.3,0.3];
+ tria6CooGauss=[ 0.3, 0.2, 0.2, 0.1, 0.2, 0.4 ]
+ gsCoo4=tria6CooGauss;
+ tria6CooRef=[0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.5, 0.0, 0.5, 0.5, 0.0, 0.5]
+ refCoo4=tria6CooRef;
+ f.setGaussLocalizationOnType(NORM_TRI6,refCoo4,gsCoo4,wg4);
+ wg5=[0.3,0.3,0.3,0.3];
+ quad4CooGauss=[ 0.3, 0.2, 0.2, 0.1, 0.2, 0.4, 0.15, 0.27 ]
+ gsCoo5=quad4CooGauss;
+ quad4CooRef=[-1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0]
+ refCoo5=quad4CooRef;
+ f.setGaussLocalizationOnType(NORM_QUAD4,refCoo5,gsCoo5,wg5);
+ wg6=[0.3,0.3,0.3,0.3];
+ quad8CooGauss=[ 0.34, 0.16, 0.21, 0.3, 0.23, 0.4, 0.14, 0.37 ]
+ gsCoo6=quad8CooGauss;
+ quad8CooRef=[ -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0, 1.0, 0.0, 0.0, 1.0, -1.0, 0.0]
+ refCoo6=quad8CooRef;
+ f.setGaussLocalizationOnType(NORM_QUAD8,refCoo6,gsCoo6,wg6);
+ #
+ resToTest=f.getLocalizationOfDiscr();
+ self.assertEqual(3,resToTest.getNumberOfComponents());
+ self.assertEqual(13,resToTest.getNumberOfTuples());#2+3+4+4 gauss points for resp TRI3,TRI6,QUAD4,QUAD8
+ expected2=[5.1,1.55,0.0, 4.7,1.65,0.0,
+ 2.32,1.52,0.0, 1.6,1.32,0.0, 3.52,1.26,0.0,#TRI6
+ 2.6,1.6,0.0, 2.4,1.8,0.0, 2.4,1.2,0.0, 2.3,1.46,0.0,#QUAD4
+ 2.32,2.68,0.0, 2.6,2.42,0.0, 2.8,2.46,0.0, 2.74,2.28,0.0 ];#QUAD8
+ for i in xrange(39):
+ self.assertAlmostEqual(expected2[i],resToTest.getIJ(0,i),14);
+ pass
+ #
+ #Testing 3D cell types
+ m3=MEDCouplingDataForTest.build3DMultiTypes_1();
+ f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,ONE_TIME);
+ f.setMesh(m3);
+ #
+ wg7=[0.3];
+ tetra4CooGauss=[0.34, 0.16, 0.21]
+ gsCoo7=tetra4CooGauss;
+ tetra4CooRef=[0.0,1.0,0.0, 0.0,0.0,1.0, 0.0,0.0,0.0, 1.0,0.0,0.0]
+ refCoo7=tetra4CooRef;
+ f.setGaussLocalizationOnType(NORM_TETRA4,refCoo7,gsCoo7,wg7);
+ wg8=[0.3];
+ tetra10CooGauss=[0.2, 0.3, 0.1]
+ gsCoo8=tetra10CooGauss;
+ tetra10CooRef=[0.0,1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0, 1.0,0.0,0.0, 0.0,0.5,0.0, 0.0,0.0,0.5, 0.0,0.5,0.5, 0.5,0.5,0.0, 0.5,0.0,0.0, 0.5,0.0,0.5]
+ refCoo8=tetra10CooRef;
+ f.setGaussLocalizationOnType(NORM_TETRA10,refCoo8,gsCoo8,wg8);
+ wg9=[0.3];
+ pyra5CooGauss=[0.2, 0.3, 0.1]
+ gsCoo9=pyra5CooGauss;
+ pyra5CooRef=[1.0,0.0,0.0, 0.0,1.0,0.0, -1.0,0.0,0.0, 0.0,-1.0,0.0, 0.0,0.0,1.0]
+ refCoo9=pyra5CooRef;
+ f.setGaussLocalizationOnType(NORM_PYRA5,refCoo9,gsCoo9,wg9);
+ wg10=[0.3];
+ pyra13CooGauss=[0.1, 0.2, 0.7]
+ gsCoo10=pyra13CooGauss;
+ pyra13CooRef=[1.0,0.0,0.0, 0.0,1.0,0.0,-1.0,0.0,0.0,0.0,-1.0,0.0,0.0,0.0,1.0,0.5,0.5,0.0,-0.5,0.5,0.0,-0.5,-0.5,0.0,0.5,-0.5,0.0,0.5,0.0,0.5,0.0,0.5,0.5,-0.5,0.0,0.5,0.0,-0.5,0.5]
+ refCoo10=pyra13CooRef;
+ f.setGaussLocalizationOnType(NORM_PYRA13,refCoo10,gsCoo10,wg10);
+ wg11=[0.3];
+ penta6CooGauss=[0.2, 0.3, 0.1]
+ gsCoo11=penta6CooGauss;
+ penta6CooRef=[-1.0,1.0,0.0,-1.0,-0.0,1.0,-1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0]
+ refCoo11=penta6CooRef;
+ f.setGaussLocalizationOnType(NORM_PENTA6,refCoo11,gsCoo11,wg11);
+ wg12=[0.3];
+ penta15CooGauss=[0.2, 0.3,0.15]
+ gsCoo12=penta15CooGauss;
+ penta15CooRef=[-1.0,1.0,0.0,-1.0,0.0,1.0,-1.0,0.0,0.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,0.0,0.0,-1.0,0.5,0.5,-1.0,0.0,0.5,-1.0,0.5,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0,0.5,0.5,1.0,0.0, 0.5,1.0,0.5,0.0]
+ refCoo12=penta15CooRef;
+ f.setGaussLocalizationOnType(NORM_PENTA15,refCoo12,gsCoo12,wg12);
+ wg13=[0.3];
+ hexa8CooGauss=[0.2,0.3,0.15]
+ gsCoo13=hexa8CooGauss;
+ hexa8CooRef=[-1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0]
+ refCoo13=hexa8CooRef;
+ f.setGaussLocalizationOnType(NORM_HEXA8,refCoo13,gsCoo13,wg13);
+ wg14=[0.3];
+ hexa20CooGauss=[0.11,0.3,0.55]
+ gsCoo14=hexa20CooGauss;
+ hexa20CooRef=[-1.0,-1.0,-1.0,1.0,-1.0,-1.0,1.0,1.0,-1.0,-1.0,1.0,-1.0,-1.0,-1.0,1.0,1.0,-1.0,1.0,1.0,1.0,1.0,-1.0,1.0,1.0,0.0,-1.0,-1.0,1.0,0.0,-1.0,0.0,1.0,-1.0,-1.0,0.0,-1.0,-1.0,-1.0,0.0,1.0,-1.0,0.0,1.0,1.0,0.0,-1.0,1.0,0.0,0.0,-1.0,1.0,1.0,0.0,1.0,0.0,1.0,1.0,-1.0,0.0,1.0]
+ refCoo14=hexa20CooRef;
+ f.setGaussLocalizationOnType(NORM_HEXA20,refCoo14,gsCoo14,wg14);
+ #
+ resToTest=f.getLocalizationOfDiscr();
+ self.assertEqual(3,resToTest.getNumberOfComponents());
+ self.assertEqual(8,resToTest.getNumberOfTuples());#2+3+4+4 gauss points for resp TRI3,TRI6,QUAD4,QUAD8
+ expected3=[1.312,3.15,1.02, 0.56,3.3,0.6, 2.18,1.1,0.2, 1.18,1.54,0.98, 1.56,0.3,3.6, 1.613,0.801,4.374, 2.6,2.4,2.3, 2.31232,2.3933985,1.553255]
+ for i in xrange(24):
+ self.assertAlmostEqual(expected3[i],resToTest.getIJ(0,i),14);
+ pass
+ #
+ pass
+
+ def testP2Localization1(self):
+ m=MEDCouplingUMesh.New("testP2",2);
+ coords=[0.,2.,3.5,0.,4.5,1.5,1.2,0.32,3.4,1.,2.1,2.4]
+ conn=[0,1,2,3,4,5]
+ coo=DataArrayDouble.New();
+ coo.setValues(coords,6,2);
+ m.setCoords(coo);
+ m.allocateCells(1);
+ m.insertNextCell(NORM_TRI6,6,conn[0:6])
+ m.finishInsertingCells();
+ #
+ f=MEDCouplingFieldDouble.New(ON_NODES,ONE_TIME);
+ f.setMesh(m);
+ da=DataArrayDouble.New();
+ vals1=[1.2,2.3,3.4, 2.2,3.3,4.4, 3.2,4.3,5.4, 4.2,5.3,6.4, 5.2,6.3,7.4, 6.2,7.3,8.4]
+ da.setValues(vals1,6,3);
+ f.setArray(da);
+ #
+ loc=[2.27,1.3]
+ locs=f.getValueOnMulti(loc);
+ expected1=[6.0921164547752236, 7.1921164547752232, 8.2921164547752255]
+ for i in xrange(3):
+ self.assertAlmostEqual(expected1[i],locs.getIJ(0,i),12);
+ pass
+ pass
+
+ def testP2Localization2(self):
+ m=MEDCouplingUMesh.New("testP2_2",3);
+ coords=[0.33312787792955395, -0.35155740179580952, -0.03567564825034563, 1.307146326477638, -0.57234557776250305, -0.08608044208272235, 0.5551834466499993, 0.62324964668794192, -0.014638951108536295, 0.37761817224442129, -0.38324019806913578, 0.96283164472856886, 0.79494856035658679, -0.40628057809270046, 0.0021004190225864614, 1.023740446371799, 0.07665912970471335, -0.072889657161871096, 0.54564584619517376, 0.11132872093429744, 0.039647326652013051, 0.27164784387819052, -0.42018012100866675, 0.46563376500745146, 0.89501965094896418, -0.56148455362735061, 0.43337469695473035, 0.49118025152924394, 0.093884938060727313, 0.47216346905220891]
+ conn=[0,1,2,3,4,5,6,7,8,9]
+ coo=DataArrayDouble.New();
+ coo.setValues(coords,10,3);
+ m.setCoords(coo);
+ m.allocateCells(1);
+ m.insertNextCell(NORM_TETRA10,10,conn[0:10])
+ m.finishInsertingCells();
+ #
+ f=MEDCouplingFieldDouble.New(ON_NODES,ONE_TIME);
+ f.setMesh(m);
+ da=DataArrayDouble.New();
+ vals1=[1.1,2.1,3.1,4.1,5.2,6.2,7.2,8.2,9.2,10.2]
+ da.setValues(vals1,10,1);
+ f.setArray(da);
+ #
+ loc=[0.64637931739890486, -0.16185896817550552, 0.22678966365273748]
+ locs=f.getValueOnMulti(loc);
+ expected1=[10.0844021968047]
+ for i in xrange(1):
+ self.assertAlmostEqual(expected1[i],locs.getIJ(0,i),12);
+ pass
+ pass
+
+ def testGetValueOn2(self):
+ m=MEDCouplingDataForTest.build2DTargetMesh_1();
+ f=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
+ f.setMesh(m);
+ arr=DataArrayDouble.New();
+ nbOfCells=m.getNumberOfCells();
+ f.setArray(arr);
+ values1=[7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.]
+ arr.setValues(values1,nbOfCells,3);
+ loc=[-0.05,-0.05, 0.55,-0.25, 0.55,0.15, -0.05,0.45, 0.45,0.45]
+ f.checkCoherency();
+ locs=f.getValueOnMulti(loc);
+ self.assertEqual(5,locs.getNumberOfTuples());
+ self.assertEqual(3,locs.getNumberOfComponents());
+ for j in xrange(15):
+ self.assertAlmostEqual(values1[j],locs.getIJ(0,j),12);
+ pass
+ # Testing ON_NODES
+ f=MEDCouplingFieldDouble.New(ON_NODES,NO_TIME);
+ f.setMesh(m);
+ arr=DataArrayDouble.New();
+ nbOfNodes=m.getNumberOfNodes();
+ f.setArray(arr);
+ values2=[7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.,12.,112.,10012.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.]
+ arr.setValues(values2,nbOfNodes,3);
+ loc2=[0.5432,-0.2432, 0.5478,0.1528, 0.5432,-0.2432, 0.5432,-0.2432]
+ expected2=[9.0272, 109.0272, 10009.0272, 11.4124,111.4124,10011.4124, 9.0272, 109.0272, 10009.0272, 9.0272, 109.0272, 10009.0272]
+ f.checkCoherency();
+ loc3=DataArrayDouble.New()
+ loc3.setValues(loc2,4,2);
+ locs=f.getValueOnMulti(loc3);
+ self.assertEqual(4,locs.getNumberOfTuples());
+ self.assertEqual(3,locs.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertAlmostEqual(expected2[i],locs.getIJ(0,i),12);
+ pass
+ #
+ pass
+
+ def testDAIGetIdsNotEqual1(self):
+ d=DataArrayInt.New();
+ vals1=[2,3,5,6,8,5,5,6,1,-5]
+ d.setValues(vals1,10,1);
+ d2=d.getIdsNotEqual(5);
+ self.assertEqual(7,d2.getNumberOfTuples());
+ self.assertEqual(1,d2.getNumberOfComponents());
+ expected1=[0,1,3,4,7,8,9]
+ for i in xrange(7):
+ self.assertEqual(expected1[i],d2.getIJ(0,i));
+ pass
+ d.rearrange(2);
+ self.assertRaises(InterpKernelException,d.getIdsNotEqual,5);
+ vals2=[-4,5,6]
+ vals3=vals2;
+ d.rearrange(1);
+ d3=d.getIdsNotEqualList(vals3);
+ self.assertEqual(5,d3.getNumberOfTuples());
+ self.assertEqual(1,d3.getNumberOfComponents());
+ expected2=[0,1,4,8,9]
+ for i in xrange(5):
+ self.assertEqual(expected2[i],d3.getIJ(0,i));
+ pass
+ pass
+
+ def testDAIComputeOffsets1(self):
+ d=DataArrayInt.New();
+ vals1=[3,5,1,2,0,8]
+ expected1=[0,3,8,9,11,11]
+ d.setValues(vals1,6,1);
+ d.computeOffsets();
+ self.assertEqual(6,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ for i in xrange(6):
+ self.assertEqual(expected1[i],d.getIJ(0,i));
+ pass
+ pass
+
+ def testUMeshHexagonPrism1(self):
+ coords=[0.8660254037844386, 0.5, 0.0, 0.0, 1.0, 0.0, -0.8660254037844386, 0.5, 0.0, -0.8660254037844386, -0.5, 0.0, 0.0, -1.0, 0.0, 0.8660254037844386, -0.5, 0.0,
+ 0.8660254037844386, 0.5, 2.0, 0.0, 1.0, 2.0, -0.8660254037844386, 0.5, 2.0, -0.8660254037844386, -0.5, 2.0, 0.0, -1.0, 2.0, 0.8660254037844386, -0.5, 2.0];
+ conn=[1,2,3,4,5,0,7,8,9,10,11,6]
+ mesh=MEDCouplingUMesh.New("MyFirstHexagonalPrism",3);
+ coo=DataArrayDouble.New();
+ coo.setValues(coords,12,3);
+ mesh.setCoords(coo);
+ mesh.allocateCells(1);
+ mesh.insertNextCell(NORM_HEXGP12,12,conn[0:12])
+ mesh.finishInsertingCells();
+ #
+ mesh.checkCoherency();
+ vols=mesh.getMeasureField(False);
+ self.assertEqual(1,vols.getNumberOfTuples());
+ self.assertEqual(1,vols.getNumberOfComponents());
+ self.assertAlmostEqual(-5.196152422706632,vols.getIJ(0,0),12);
+ bary=mesh.getBarycenterAndOwner();
+ self.assertEqual(1,bary.getNumberOfTuples());
+ self.assertEqual(3,bary.getNumberOfComponents());
+ expected1=[0.,0.,1.]
+ for i in xrange(3):
+ self.assertAlmostEqual(expected1[i],bary.getIJ(0,i),12);
+ pass
+ d1=DataArrayInt.New();
+ d2=DataArrayInt.New();
+ d3=DataArrayInt.New();
+ d4=DataArrayInt.New();
+ m2=mesh.buildDescendingConnectivity(d1,d2,d3,d4);
+ self.assertEqual(8,m2.getNumberOfCells());
+ expected4=[[1,2,3,4,5,0],[7,6,11,10,9,8],[1,7,8,2],[2,8,9,3],[3,9,10,4],[4,10,11,5],[5,11,6,0],[0,6,7,1]];
+ expected2=[NORM_POLYGON, NORM_POLYGON, NORM_QUAD4, NORM_QUAD4, NORM_QUAD4, NORM_QUAD4, NORM_QUAD4, NORM_QUAD4];
+ expected3=[6,6,4,4,4,4,4,4]
+ for i in xrange(8):
+ self.assertTrue(m2.getTypeOfCell(i)==expected2[i]);
+ v=m2.getNodeIdsOfCell(i);
+ self.assertTrue(len(v)==expected3[i]);
+ self.assertEqual(expected4[i],v);
+ #
+ mesh.convertAllToPoly();
+ self.assertTrue(NORM_POLYHED==mesh.getTypeOfCell(0));
+ mesh.unPolyze();
+ self.assertTrue(NORM_HEXGP12==mesh.getTypeOfCell(0));
+ self.assertEqual(13,mesh.getMeshLength());
+ #
+ pass
+
+ def testDADCheckIsMonotonic(self):
+ da=DataArrayDouble.New();
+ da.setValues([-1.,1.01,2.03,6.],2,2);
+ self.assertRaises(InterpKernelException,da.isMonotonic,1e-12);
+ da.rearrange(1);
+ self.assertTrue(da.isMonotonic(1e-12));
+ da.checkMonotonic(1e-12);
+ da.setIJ(2,0,6.1);
+ self.assertTrue(not da.isMonotonic(1e-12));
+ self.assertRaises(InterpKernelException,da.checkMonotonic,1e-12);
+ da.setIJ(2,0,5.99);
+ self.assertTrue(da.isMonotonic(1e-12));
+ self.assertTrue(not da.isMonotonic(1e-1));
+ pass
+
+ def testCheckCoherencyDeeper1(self):
+ m=MEDCouplingDataForTest.build3DSourceMesh_1();
+ m.checkCoherency();
+ m.checkCoherency1();
+ m.getNodalConnectivity().setIJ(8,0,-1);
+ m.checkCoherency();
+ self.assertRaises(InterpKernelException,m.checkCoherency1);
+ m.getNodalConnectivity().setIJ(8,0,-6);
+ m.checkCoherency();
+ self.assertRaises(InterpKernelException,m.checkCoherency1);
+ m.getNodalConnectivity().setIJ(8,0,9);#9>=NbOfNodes
+ m.checkCoherency();
+ self.assertRaises(InterpKernelException,m.checkCoherency1);
+ m.getNodalConnectivity().setIJ(8,0,8);#OK
+ m.checkCoherency();
+ m.checkCoherency1();
+ elts=[1,5]
+ m.convertToPolyTypes(elts);
+ m.checkCoherency();
+ m.checkCoherency1();
+ m.getNodalConnectivity().setIJ(2,0,9);#9>=NbOfNodes
+ m.checkCoherency();
+ self.assertRaises(InterpKernelException,m.checkCoherency1);
+ m.getNodalConnectivity().setIJ(2,0,-3);
+ m.checkCoherency();
+ self.assertRaises(InterpKernelException,m.checkCoherency1);
+ m.getNodalConnectivity().setIJ(2,0,-1);
+ m.checkCoherency();
+ self.assertRaises(InterpKernelException,m.checkCoherency1);#Throw because cell#0 is not a polyhedron
+ m.getNodalConnectivity().setIJ(2,0,4);
+ m.checkCoherency();
+ m.checkCoherency1();
+ m.getNodalConnectivity().setIJ(7,0,-1);
+ m.checkCoherency();
+ m.checkCoherency1();#OK because we are in polyhedron connec
+ m.getNodalConnectivity().setIJ(36,0,14);
+ m.checkCoherency();
+ self.assertRaises(InterpKernelException,m.checkCoherency1);#Throw beacause now cell 5 is a TETRA4 (14) so mimatch of number index and static type.
+ pass
+
+ def testUnPolyze2(self):
+ m=MEDCouplingUMesh.New("jjj",3);
+ coo=DataArrayDouble.New();
+ coo.alloc(4,3);
+ coo.rearrange(1);
+ coo.iota(0);
+ coo.rearrange(3);
+ m.setCoords(coo);
+ m.allocateCells(2);
+ m.insertNextCell(NORM_TETRA4,4,[0,1,2,3]);
+ m.insertNextCell(NORM_TETRA4,4,[0,1,2,3]);
+ m.finishInsertingCells();
+ m2=MEDCouplingUMesh.MergeUMeshesOnSameCoords(4*[m]);
+ m2.convertToPolyTypes([2]);
+ m2.unPolyze();
+ self.assertEqual(NORM_TETRA4,m2.getTypeOfCell(2));
+ self.assertEqual(40,m2.getMeshLength());
+ temp2=m2.getNodeIdsOfCell(2);
+ self.assertEqual(temp2,[0,1,2,3]);
+ m2.checkCoherency1();
+ m3=m2.deepCpy();
+ m2.unPolyze();
+ self.assertTrue(m3.isEqual(m2,1e-12));
+ pass
+
+ def testDACpyFrom1(self):
+ d=DataArrayDouble.New();
+ d.alloc(12,1);
+ d.iota(14.);
+ d.rearrange(3);
+ d.setName("Toto");
+ d.setInfoOnComponent(0,"X [m]");
+ d.setInfoOnComponent(1,"Y [m]");
+ d.setInfoOnComponent(2,"Z [m]");
+ #
+ d1=DataArrayDouble.New();
+ self.assertTrue(not d.isEqual(d1,1e-12));
+ d1.cpyFrom(d);
+ self.assertTrue(d.isEqual(d1,1e-12));
+ d1.cpyFrom(d);
+ self.assertTrue(d.isEqual(d1,1e-12));
+ d1.rearrange(2);
+ self.assertTrue(not d.isEqual(d1,1e-12));
+ d1.cpyFrom(d);
+ self.assertTrue(d.isEqual(d1,1e-12));
+ #
+ d2=d.convertToIntArr();
+ d4=DataArrayInt.New();
+ self.assertTrue(not d2.isEqual(d4));
+ d4.cpyFrom(d2);
+ self.assertTrue(d2.isEqual(d4));
+ d4.cpyFrom(d2);
+ self.assertTrue(d2.isEqual(d4));
+ d4.rearrange(2);
+ self.assertTrue(not d2.isEqual(d4));
+ d4.cpyFrom(d2);
+ self.assertTrue(d2.isEqual(d4));
+ pass
+
+ def testDAITransformWithIndArr1(self):
+ tab1=[17,18,22,19]
+ tab2=[0,1,1,3,3,0,1,3,2,2,3,0]
+ expected=[17,18,18,19,19,17,18,19,22,22,19,17]
+ d=DataArrayInt.New();
+ d.setValues(tab1,4,1);
+ d1=DataArrayInt.New();
+ d1.setValues(tab2,12,1);
+ d2=d1[:]
+ #
+ d1.transformWithIndArr(d);
+ self.assertEqual(12,d1.getNumberOfTuples());
+ self.assertEqual(1,d1.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(expected[i],d1.getIJ(i,0));
+ pass
+ #
+ d1=d2
+ d1.transformWithIndArr(tab1)
+ self.assertEqual(12,d1.getNumberOfTuples());
+ self.assertEqual(1,d1.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(expected[i],d1.getIJ(i,0));
+ pass
+ pass
+
+ def testDAIBuildPermArrPerLevel1(self):
+ arr=[2,0,1,1,0,1,2,0,1,1,0,0]
+ expected1=[10,0,5,6,1,7,11,2,8,9,3,4]
+ da=DataArrayInt.New();
+ da.setValues(arr,12,1);
+ da2=da.buildPermArrPerLevel();
+ self.assertEqual(12,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(expected1[i],da2.getIJ(i,0));
+ pass
+ pass
+
+ def testDAIOperations1(self):
+ arr1=[-1,-2,4,7,3,2,6,6,4,3,0,1]
+ da=DataArrayInt.New();
+ da.setValues(arr1,4,3);
+ da1=DataArrayInt.New();
+ da1.alloc(12,1);
+ da1.iota(2);
+ self.assertRaises(InterpKernelException,DataArrayInt.Add,da,da1);#not same number of tuples/Components
+ da1.rearrange(3);
+ da2=DataArrayInt.Add(da,da1);
+ self.assertEqual(4,da2.getNumberOfTuples());
+ self.assertEqual(3,da2.getNumberOfComponents());
+ expected1=[1,1,8,12,9,9,14,15,14,14,12,14]
+ for i in xrange(12):
+ self.assertEqual(expected1[i],da2.getIJ(0,i));
+ pass
+ da1.substractEqual(da);
+ expected2=[3,5,0,-2,3,5,2,3,6,8,12,12]
+ for i in xrange(12):
+ self.assertEqual(expected2[i],da1.getIJ(0,i));
+ pass
+ da1.rearrange(1); da1.iota(2); da1.rearrange(3);
+ da1.addEqual(da);
+ for i in xrange(12):
+ self.assertEqual(expected1[i],da1.getIJ(0,i));
+ pass
+ da1.rearrange(1); da1.iota(2); da1.rearrange(3);
+ da2=DataArrayInt.Multiply(da,da1);
+ self.assertEqual(4,da2.getNumberOfTuples());
+ self.assertEqual(3,da2.getNumberOfComponents());
+ expected3=[-2,-6,16,35,18,14,48,54,40,33,0,13]
+ for i in xrange(12):
+ self.assertEqual(expected3[i],da2.getIJ(0,i));
+ pass
+ da.divideEqual(da1);
+ self.assertEqual(4,da.getNumberOfTuples());
+ self.assertEqual(3,da.getNumberOfComponents());
+ expected4=[0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
+ for i in xrange(12):
+ self.assertEqual(expected4[i],da.getIJ(0,i));
+ pass
+ da.setValues(arr1,4,3);
+ da1.multiplyEqual(da);
+ self.assertEqual(4,da1.getNumberOfTuples());
+ self.assertEqual(3,da1.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(expected3[i],da1.getIJ(0,i));
+ pass
+ da1.rearrange(1); da1.iota(2); da1.rearrange(3);
+ da2=DataArrayInt.Divide(da,da1);
+ self.assertEqual(4,da2.getNumberOfTuples());
+ self.assertEqual(3,da2.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(expected4[i],da2.getIJ(0,i));
+ pass
+ da1.applyInv(321);
+ self.assertEqual(4,da1.getNumberOfTuples());
+ self.assertEqual(3,da1.getNumberOfComponents());
+ expected5=[160,107,80,64,53,45,40,35,32,29,26,24]
+ for i in xrange(12):
+ self.assertEqual(expected5[i],da1.getIJ(0,i));
+ pass
+ da1.applyDivideBy(2);
+ self.assertEqual(4,da1.getNumberOfTuples());
+ self.assertEqual(3,da1.getNumberOfComponents());
+ expected6=[80,53,40,32,26,22,20,17,16,14,13,12]
+ for i in xrange(12):
+ self.assertEqual(expected6[i],da1.getIJ(0,i));
+ pass
+ expected7=[3,4,5,4,5,1,6,3,2,0,6,5]
+ da1.applyModulus(7);
+ for i in xrange(12):
+ self.assertEqual(expected7[i],da1.getIJ(0,i));
+ pass
+ da1.applyLin(1,1);
+ expected8=[3,3,3,3,3,1,3,3,0,0,3,3]
+ da1.applyRModulus(3);
+ for i in xrange(12):
+ self.assertEqual(expected8[i],da1.getIJ(0,i));
+ pass
+ pass
+
+ def testEmulateMEDMEMBDC1(self):
+ m,m1=MEDCouplingDataForTest.buildPointe_1();
+ m2,da1,da2,da3,da4,da5,da0=m.emulateMEDMEMBDC(m1)
+ expected0=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46]
+ expected1=[1,32,29,23,41,36]
+ self.assertEqual(47,da0.getNumberOfTuples());
+ self.assertEqual(1,da0.getNumberOfComponents());
+ for i in xrange(47):
+ self.assertEqual(expected0[i],da0.getIJ(0,i));
+ pass
+ self.assertEqual(6,da5.getNumberOfTuples());
+ self.assertEqual(1,da5.getNumberOfComponents());
+ for i in xrange(6):
+ self.assertEqual(expected1[i],da5.getIJ(0,i));
+ pass
+ expected2=[0,1,2,3,4,0,5,6,7,4,8,9,1,7,10,11,12,13,14,5,15,16,17,8,18,19,20,10,21,22,23,2,13,24,25,21,16,26,27,12,19,28,29,15,22,30,31,18,36,26,28,30,24,37,32,33,34,35,38,36,39,40,41,42,37,38,43,44,45,46]
+ self.assertEqual(70,da1.getNumberOfTuples());
+ self.assertEqual(1,da1.getNumberOfComponents());
+ for i in xrange(70):
+ self.assertEqual(expected2[i],da1.getIJ(0,i));
+ pass
+ expected3=[0,4,8,12,16,20,24,28,32,36,40,44,48,53,58,64,70]
+ self.assertEqual(17,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ for i in xrange(17):
+ self.assertEqual(expected3[i],da2.getIJ(0,i));
+ pass
+ expected4=[0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,53,54,55,56,58,60,62,63,64,65,66,67,68,69,70]
+ #expected4=[0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,54,56,57,58,59,60,62,63,64,65,66,67,68,69,70];
+ self.assertEqual(48,da4.getNumberOfTuples());
+ self.assertEqual(1,da4.getNumberOfComponents());
+ for i in xrange(48):
+ self.assertEqual(expected4[i],da4.getIJ(0,i));
+ pass
+ expected5=[0,1,0,3,0,7,0,1,2,1,4,1,2,3,2,5,2,3,6,3,4,9,4,8,4,5,10,5,9,5,6,11,6,10,6,7,8,7,11,7,8,12,8,9,12,9,10,12,10,11,12,11,13,13,13,13,12,14,13,15,14,15,14,14,14,14,15,15,15,15]
+ self.assertEqual(70,da3.getNumberOfTuples());
+ self.assertEqual(1,da3.getNumberOfComponents());
+ for i in xrange(70):
+ self.assertEqual(expected5[i],da3.getIJ(0,i));
+ pass
+ pass
+
+ def testGetLevArrPerCellTypes1(self):
+ m,m1=MEDCouplingDataForTest.buildPointe_1();
+ m1,d0,d1,d2,d3=m.buildDescendingConnectivity();
+ order=[NORM_TRI3,NORM_QUAD4];
+ da0,da1=m1.getLevArrPerCellTypes(order);
+ expected0=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1]
+ expected1=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,36,37,32,33,34,35,38,39,40,41,42,43,44,45,46]
+ self.assertEqual(47,da0.getNumberOfTuples());
+ self.assertEqual(1,da0.getNumberOfComponents());
+ for i in xrange(47):
+ self.assertEqual(expected0[i],da0.getIJ(0,i));
+ pass
+ self.assertEqual(2,da1.getNumberOfTuples());
+ self.assertEqual(1,da1.getNumberOfComponents());
+ self.assertEqual(36,da1.getIJ(0,0));#36 TRI3
+ self.assertEqual(11,da1.getIJ(1,0));#11 QUAD4
+ #
+ da2=da0.buildPermArrPerLevel();
+ #
+ self.assertEqual(47,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ for i in xrange(47):
+ self.assertEqual(expected1[i],da2.getIJ(0,i));
+ pass
+ pass
+
+ def testSortCellsInMEDFileFrmt1(self):
+ m,m1=MEDCouplingDataForTest.buildPointe_1();
+ m2=m.deepCpy()
+ da=DataArrayInt.New()
+ da.setValues([0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13],16,1)
+ daa=da.invertArrayN2O2O2N(16)
+ m.renumberCells(daa,False)
+ da2=m.sortCellsInMEDFileFrmt()
+ self.assertEqual(da2.getValues(),[0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13])
+ self.assertTrue(m.isEqual(m2,1e-12))
+ self.assertTrue(da.isEqual(da2))
+ pass
+
+ def testBuildPartAndReduceNodes1(self):
+ m=MEDCouplingDataForTest.build2DTargetMesh_1();
+ arr=[1,0]
+ m2,da=m.buildPartAndReduceNodes(arr);
+ self.assertEqual(5,m2.getNumberOfNodes());
+ self.assertEqual(2,m2.getNumberOfCells());
+ f=m2.getMeasureField(True);
+ self.assertAlmostEqual(0.125,f.getArray().getIJ(0,0),12);
+ self.assertAlmostEqual(0.25,f.getArray().getIJ(1,0),12);
+ #
+ arr2=DataArrayInt.New()
+ arr2.setValues(arr,2,1)
+ m2,da=m.buildPartAndReduceNodes(arr2);
+ self.assertEqual(5,m2.getNumberOfNodes());
+ self.assertEqual(2,m2.getNumberOfCells());
+ f=m2.getMeasureField(True);
+ self.assertAlmostEqual(0.125,f.getArray().getIJ(0,0),12);
+ self.assertAlmostEqual(0.25,f.getArray().getIJ(1,0),12);
+ pass
+
+ def testDAITransformWithIndArrR1(self):
+ tab1=[2,4,5,3,6,7]
+ tab2=[-1,-1,0,1,2,3,4,5,-1,-1,-1,-1]
+ expected=[0,3,1,2,4,5]
+ d=DataArrayInt.New();
+ d.setValues(tab1,6,1);
+ d1=DataArrayInt.New();
+ d1.setValues(tab2,12,1);
+ d2=d1[:]
+ #
+ d3=d.transformWithIndArrR(d1);
+ self.assertEqual(6,d3.getNumberOfTuples());
+ self.assertEqual(1,d3.getNumberOfComponents());
+ for i in xrange(6):
+ self.assertEqual(expected[i],d3.getIJ(i,0));
+ pass
+ #
+ d1=d2
+ d3=d.transformWithIndArrR(tab2)
+ self.assertEqual(6,d3.getNumberOfTuples());
+ self.assertEqual(1,d3.getNumberOfComponents());
+ for i in xrange(6):
+ self.assertEqual(expected[i],d3.getIJ(i,0));
+ pass
+ pass
+
+ def testDAISplitByValueRange1(self):
+ val1=[6,5,0,3,2,7,8,1,4]
+ val2=[0,4,9]
+ d=DataArrayInt.New();
+ d.setValues(val1,9,1);
+ e,f,g=d.splitByValueRange(val2);
+ self.assertEqual(9,e.getNumberOfTuples());
+ self.assertEqual(1,e.getNumberOfComponents());
+ self.assertEqual(9,f.getNumberOfTuples());
+ self.assertEqual(1,f.getNumberOfComponents());
+ self.assertEqual(2,g.getNumberOfTuples());
+ self.assertEqual(1,g.getNumberOfComponents());
+ #
+ expected1=[1,1,0,0,0,1,1,0,1]
+ expected2=[2,1,0,3,2,3,4,1,0]
+ for i in xrange(9):
+ self.assertEqual(expected1[i],e.getIJ(i,0));
+ self.assertEqual(expected2[i],f.getIJ(i,0));
+ pass
+ self.assertEqual(0,g.getIJ(0,0));
+ self.assertEqual(1,g.getIJ(1,0));
+ #
+ d.setIJ(6,0,9);
+ self.assertRaises(InterpKernelException,d.splitByValueRange,val2);
+ pass
+
+ def testUMeshSplitProfilePerType1(self):
+ val0=[2,0,1,3,4]
+ m=MEDCouplingDataForTest.build2DTargetMesh_1();
+ m.renumberCells(val0,False);
+ #
+ val1=[0,2,3]
+ d=DataArrayInt.New();
+ d.setValues(val1,3,1);
+ d.setName("sup")
+ code,idsInPflPerType,pfls=m.splitProfilePerType(d);
+ self.assertEqual(6,len(code));
+ self.assertEqual(2,len(idsInPflPerType));
+ expected1=[3,1,0, 4,2,1]
+ for i in xrange(6):
+ self.assertEqual(expected1[i],code[i]);
+ pass
+ self.assertEqual(2,len(idsInPflPerType));
+ self.assertEqual(1,idsInPflPerType[0].getNumberOfTuples());
+ self.assertEqual(0,idsInPflPerType[0].getIJ(0,0));
+ self.assertEqual(2,idsInPflPerType[1].getNumberOfTuples());
+ self.assertEqual(1,idsInPflPerType[1].getIJ(0,0));
+ self.assertEqual(2,idsInPflPerType[1].getIJ(1,0));
+ #
+ self.assertEqual(2,len(pfls));
+ self.assertEqual("sup",pfls[0].getName())
+ self.assertEqual(1,pfls[0].getNumberOfTuples());
+ self.assertEqual(0,pfls[0].getIJ(0,0));
+ self.assertEqual("sup",pfls[1].getName())
+ self.assertEqual(2,pfls[1].getNumberOfTuples());
+ self.assertEqual(0,pfls[1].getIJ(0,0));
+ self.assertEqual(1,pfls[1].getIJ(1,0));
+ #
+ val2=[0,2,3,4]
+ d=DataArrayInt.New();
+ d.setValues(val2,4,1);
+ code,idsInPflPerType,pfls=m.splitProfilePerType(d);
+ self.assertEqual(6,len(code));
+ self.assertEqual(2,len(idsInPflPerType));
+ expected2=[3,1,0, 4,3,-1]
+ for i in xrange(6):
+ self.assertEqual(expected2[i],code[i]);
+ pass
+ self.assertEqual(2,len(idsInPflPerType));
+ self.assertEqual(1,idsInPflPerType[0].getNumberOfTuples());
+ self.assertEqual(0,idsInPflPerType[0].getIJ(0,0));
+ self.assertEqual(3,idsInPflPerType[1].getNumberOfTuples());
+ self.assertEqual(1,idsInPflPerType[1].getIJ(0,0));
+ self.assertEqual(2,idsInPflPerType[1].getIJ(1,0));
+ self.assertEqual(3,idsInPflPerType[1].getIJ(2,0));
+ #
+ self.assertEqual(1,len(pfls));
+ self.assertEqual(1,pfls[0].getNumberOfTuples());
+ self.assertEqual(0,pfls[0].getIJ(0,0));
+ #
+ val3=[1,0,2]
+ d=DataArrayInt.New();
+ d.setValues(val3,3,1);
+ code,idsInPflPerType,pfls=m.splitProfilePerType(d);
+ self.assertEqual(6,len(code));
+ self.assertEqual(2,len(idsInPflPerType));
+ expected3=[3,2,0, 4,1,1]
+ for i in xrange(6):
+ self.assertEqual(expected3[i],code[i]);
+ pass
+ self.assertEqual(2,len(idsInPflPerType));
+ self.assertEqual(2,idsInPflPerType[0].getNumberOfTuples());
+ self.assertEqual(0,idsInPflPerType[0].getIJ(0,0));
+ self.assertEqual(1,idsInPflPerType[0].getIJ(1,0));
+ self.assertEqual(1,idsInPflPerType[1].getNumberOfTuples());
+ self.assertEqual(2,idsInPflPerType[1].getIJ(0,0));
+ #
+ self.assertEqual(2,len(pfls));
+ self.assertEqual(2,pfls[0].getNumberOfTuples());
+ self.assertEqual(1,pfls[0].getIJ(0,0));
+ self.assertEqual(0,pfls[0].getIJ(1,0));
+ self.assertEqual(0,pfls[1].getIJ(0,0));
+ #
+ val4=[3,4]
+ d=DataArrayInt.New();
+ d.setValues(val4,2,1);
+ code,idsInPflPerType,pfls=m.splitProfilePerType(d);
+ self.assertEqual(3,len(code));
+ self.assertEqual(1,len(idsInPflPerType));
+ expected4=[4,2,0]
+ for i in xrange(3):
+ self.assertEqual(expected4[i],code[i]);
+ pass
+ self.assertEqual(1,len(idsInPflPerType));
+ self.assertEqual(2,idsInPflPerType[0].getNumberOfTuples());
+ self.assertEqual(0,idsInPflPerType[0].getIJ(0,0));
+ self.assertEqual(1,idsInPflPerType[0].getIJ(1,0));
+ #
+ self.assertEqual(1,len(pfls));
+ self.assertEqual(2,pfls[0].getNumberOfTuples());
+ self.assertEqual(1,pfls[0].getIJ(0,0));
+ self.assertEqual(2,pfls[0].getIJ(1,0));
+ pass
+
+ def testDAIBuildExplicitArrByRanges1(self):
+ d=DataArrayInt.New();
+ vals1=[0,2,3]
+ d.setValues(vals1,3,1);
+ e=DataArrayInt.New();
+ vals2=[0,3,6,10,14,20]
+ e.setValues(vals2,6,1);
+ #
+ f=d.buildExplicitArrByRanges(e);
+ self.assertEqual(11,f.getNumberOfTuples());
+ self.assertEqual(1,f.getNumberOfComponents());
+ expected1=[0,1,2,6,7,8,9,10,11,12,13]
+ for i in xrange(11):
+ self.assertEqual(expected1[i],f.getIJ(i,0));
+ pass
+ pass
+
+ def testDAIComputeOffsets2(self):
+ d=DataArrayInt.New();
+ vals1=[3,5,1,2,0,8]
+ expected1=[0,3,8,9,11,11,19]
+ d.setValues(vals1,6,1);
+ d.computeOffsets2();
+ self.assertEqual(7,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ for i in xrange(7):
+ self.assertEqual(expected1[i],d.getIJ(0,i));
+ pass
+ pass
def setUp(self):
pass
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
from MEDCoupling import *
myCoords.setValues(targetCoords,9,2);
targetMesh.setCoords(myCoords);
return targetMesh;
+
def build2DSourceMesh_1(cls):
sourceCoords=[-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7]
sourceConn=[0,3,1,0,2,3]
targetMesh.setCoords(myCoords);
return targetMesh
+ def build3DSourceMesh_1(self):
+ sourceCoords=[ 0.0, 0.0, 200.0, 0.0, 0.0, 0.0, 0.0, 200.0, 200.0, 0.0, 200.0, 0.0, 200.0, 0.0, 200.0,
+ 200.0, 0.0, 0.0, 200.0, 200.0, 200.0, 200.0, 200.0, 0.0, 100.0, 100.0, 100.0]
+ sourceConn=[8,1,7,3, 6,0,8,2, 7,4,5,8, 6,8,4,7, 6,8,0,4, 6,8,7,3, 8,1,3,0, 4,1,5,8, 1,7,5,8, 0,3,8,2, 8,1,0,4, 3,6,8,2]
+ sourceMesh=MEDCouplingUMesh.New();
+ sourceMesh.setMeshDimension(3);
+ sourceMesh.allocateCells(12);
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[0:4])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[4:8])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[8:12])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[12:16])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[16:20])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[20:24])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[24:28])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[28:32])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[32:36])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[36:40])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[40:44])
+ sourceMesh.insertNextCell(NORM_TETRA4,4,sourceConn[44:48])
+ sourceMesh.finishInsertingCells();
+ myCoords=DataArrayDouble.New();
+ myCoords.setValues(sourceCoords,9,3);
+ sourceMesh.setCoords(myCoords);
+ return sourceMesh;
+
+
def build3DSurfTargetMesh_1(self):
targetCoords=[-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5]
targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4]
def build3DExtrudedUMesh_1(self):
coords=[
- 0.,0.,0., 1.,1.,0., 1.,1.25,0., 0.,1.,0., 1.,1.5,0., 2.,0.,0., 2.,1.,0., 1.,2.,0., 0.,2.,0., 3.,1.,0.,
+ 0.,0.,0., 1.,1.,0., 1.,1.25,0., 1.,0.,0., 1.,1.5,0., 2.,0.,0., 2.,1.,0., 1.,2.,0., 0.,2.,0., 3.,1.,0.,
3.,2.,0., 0.,1.,0., 1.,3.,0., 2.,2.,0., 2.,3.,0.,
- 0.,0.,1., 1.,1.,1., 1.,1.25,1., 0.,1.,1., 1.,1.5,1., 2.,0.,1., 2.,1.,1., 1.,2.,1., 0.,2.,1., 3.,1.,1.,
+ 0.,0.,1., 1.,1.,1., 1.,1.25,1., 1.,0.,1., 1.,1.5,1., 2.,0.,1., 2.,1.,1., 1.,2.,1., 0.,2.,1., 3.,1.,1.,
3.,2.,1., 0.,1.,1., 1.,3.,1., 2.,2.,1., 2.,3.,1.,
- 0.,0.,2., 1.,1.,2., 1.,1.25,2., 0.,1.,2., 1.,1.5,2., 2.,0.,2., 2.,1.,2., 1.,2.,2., 0.,2.,2., 3.,1.,2.,
+ 0.,0.,2., 1.,1.,2., 1.,1.25,2., 1.,0.,2., 1.,1.5,2., 2.,0.,2., 2.,1.,2., 1.,2.,2., 0.,2.,2., 3.,1.,2.,
3.,2.,2., 0.,1.,2., 1.,3.,2., 2.,2.,2., 2.,3.,2.,
- 0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
+ 0.,0.,3., 1.,1.,3., 1.,1.25,3., 1.,0.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3.,
3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.]
conn=[
targetMesh.setCoords(myCoords);
return targetMesh;
+ def buildMultiFields_1(cls):
+ m1=MEDCouplingDataForTest.build2DTargetMesh_1();
+ m1.setName("m1");
+ m2=MEDCouplingDataForTest.build2DTargetMesh_1();
+ m2.setName("m2");
+ vals0=[-0.7,-1.,-2.,-3.,-4.];
+ vals1=[0.,1.,2.,3.,4.,0.1,0.2,0.3,0.4];
+ vals1_1=[170.,171.,172.,173.,174.,170.1,170.2,170.3,170.4];
+ vals2=[5.,6.,7.,8.,9.];
+ vals4=[15.,16.,17.,18.,19.];
+ d0=DataArrayDouble.New();
+ d0.setValues(vals0,5,1);
+ d1=DataArrayDouble.New();
+ d1.setValues(vals1,9,1);
+ d1_1=DataArrayDouble.New();
+ d1_1.setValues(vals1_1,9,1);
+ d2=DataArrayDouble.New();
+ d2.setValues(vals2,5,1);
+ d4=DataArrayDouble.New();
+ d4.setValues(vals4,5,1);
+ d0.setName("d0"); d1.setName("d1"); d1_1.setName("d1_1"); d2.setName("d2"); d4.setName("d4");
+ d0.setInfoOnComponent(0,"c1");
+ d1.setInfoOnComponent(0,"c6");
+ d1_1.setInfoOnComponent(0,"c9");
+ d2.setInfoOnComponent(0,"c5");
+ d4.setInfoOnComponent(0,"c7");
+ f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+ f0.setMesh(m1);
+ f0.setArray(d0);
+ f0.setTime(0.2,5,6);
+ f0.setName("f0");
+ f1=MEDCouplingFieldDouble.New(ON_NODES,LINEAR_TIME);
+ f1.setMesh(m1);
+ f1.setArrays([d1,d1_1]);
+ f1.setStartTime(0.7,7,8);
+ f1.setEndTime(1.2,9,10);
+ f1.setName("f1");
+ f2=MEDCouplingFieldDouble.New(ON_CELLS,CONST_ON_TIME_INTERVAL);
+ f2.setMesh(m2);
+ f2.setArray(d2);
+ f2.setTime(1.2,11,12);
+ f2.setEndTime(1.5,13,14);
+ f2.setName("f2");
+ f3=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+ f3.setMesh(m1);
+ f3.setArray(d2);
+ f3.setTime(1.7,15,16);
+ f3.setName("f3");
+ f4=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
+ f4.setMesh(m2);
+ f4.setArray(d4);
+ f4.setName("f4");
+ ret=MEDCouplingMultiFields.New([f0,f1,f2,f3,f4]);
+ return ret;
+
+ def buildMultiFields_2(cls):
+ m1=MEDCouplingDataForTest.build2DTargetMesh_1();
+ m1.setName("m1");
+ m2=MEDCouplingDataForTest.build2DTargetMesh_1();
+ m2.setName("m2");
+ vals0=[-0.7,-1.,-2.,-3.,-4.];
+ vals1=[0.,1.,2.,3.,4.];
+ vals1_1=[170.,171.,172.,173.,174.];
+ vals2=[5.,6.,7.,8.,9.];
+ vals4=[15.,16.,17.,18.,19.];
+ d0=DataArrayDouble.New();
+ d0.setValues(vals0,5,1);
+ d1=DataArrayDouble.New();
+ d1.setValues(vals1,5,1);
+ d1_1=DataArrayDouble.New();
+ d1_1.setValues(vals1_1,5,1);
+ d2=DataArrayDouble.New();
+ d2.setValues(vals2,5,1);
+ d4=DataArrayDouble.New();
+ d4.setValues(vals4,5,1);
+ d0.setName("d0"); d1.setName("d1"); d1_1.setName("d1_1"); d2.setName("d2"); d4.setName("d4");
+ d0.setInfoOnComponent(0,"c1");
+ d1.setInfoOnComponent(0,"c6");
+ d1_1.setInfoOnComponent(0,"c9");
+ d2.setInfoOnComponent(0,"c5");
+ d4.setInfoOnComponent(0,"c7");
+ f0=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+ f0.setMesh(m1);
+ f0.setArray(d0);
+ f0.setTime(0.2,5,6);
+ f0.setName("f0");
+ f1=MEDCouplingFieldDouble.New(ON_CELLS,LINEAR_TIME);
+ f1.setMesh(m1);
+ f1.setArrays([d1,d1_1]);
+ f1.setStartTime(0.7,7,8);
+ f1.setEndTime(1.2,9,10);
+ f1.setName("f1");
+ f2=MEDCouplingFieldDouble.New(ON_CELLS,CONST_ON_TIME_INTERVAL);
+ f2.setMesh(m2);
+ f2.setArray(d2);
+ f2.setTime(1.2,11,12);
+ f2.setEndTime(1.5,13,14);
+ f2.setName("f2");
+ f3=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+ f3.setMesh(m1);
+ f3.setArray(d2);
+ f3.setTime(1.7,15,16);
+ f3.setName("f3");
+ f4=MEDCouplingFieldDouble.New(ON_CELLS,NO_TIME);
+ f4.setMesh(m2);
+ f4.setArray(d4);
+ f4.setName("f4");
+ return [f0,f1,f2,f3,f4]
+
+ def build1DMultiTypes_1(self):
+ mesh=MEDCouplingUMesh.New("Multi1DMesh",1);
+ coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
+ conn=[0,2, 0,2,1]
+ mesh.allocateCells(2);
+ mesh.insertNextCell(NORM_SEG2,2,conn[0:2])
+ mesh.insertNextCell(NORM_SEG3,3,conn[2:5])
+ mesh.finishInsertingCells();
+ mesh.setCoords(coo);
+ return mesh;
+
+ def build2DMultiTypes_1(self):
+ mesh=MEDCouplingUMesh.New("Multi2DMesh",2);
+ coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
+ conn=[3,4,5, 3,4,5,6,7,8, 0,9,10,11, 0,9,10,11,12,13,14,15]
+ mesh.allocateCells(4);
+ mesh.insertNextCell(NORM_TRI3,3,conn[0:3])
+ mesh.insertNextCell(NORM_TRI6,6,conn[3:9])
+ mesh.insertNextCell(NORM_QUAD4,4,conn[9:13])
+ mesh.insertNextCell(NORM_QUAD8,8,conn[13:21])
+ mesh.finishInsertingCells();
+ mesh.setCoords(coo);
+ return mesh;
+
+ def build3DMultiTypes_1(self):
+ mesh=MEDCouplingUMesh.New("Multi3DMesh",3);
+ coo=MEDCouplingDataForTest.buildCoordsForMultiTypes_1();
+ conn=[0,16,17,18,
+ 0,16,17,18,19,20,21,22,23,24,
+ 0,11,10,9,25,
+ 0,11,10,9,25,15,14,13,12,26,27,28,29,
+ 0,30,31,32,33,34,
+ 0,30,31,32,33,34,35,36,37,38,39,40,41,42,43,
+ 0,9,10,11,44,45,46,47,
+ 0,9,10,11,44,45,46,47,12,13,14,15,48,49,50,51,52,53,54,55 ];
+ mesh.allocateCells(8);
+ mesh.insertNextCell(NORM_TETRA4,4,conn[0:4])
+ mesh.insertNextCell(NORM_TETRA10,10,conn[4:14])
+ mesh.insertNextCell(NORM_PYRA5,5,conn[14:19])
+ mesh.insertNextCell(NORM_PYRA13,13,conn[19:32])
+ mesh.insertNextCell(NORM_PENTA6,6,conn[32:38])
+ mesh.insertNextCell(NORM_PENTA15,15,conn[38:53])
+ mesh.insertNextCell(NORM_HEXA8,8,conn[53:61])
+ mesh.insertNextCell(NORM_HEXA20,20,conn[61:81])
+ mesh.finishInsertingCells();
+ mesh.setCoords(coo);
+ return mesh;
+
+ def buildCoordsForMultiTypes_1(self):
+ coords=DataArrayDouble.New();
+ data=[0.0,0.0,0.0, 0.5,0.5,0.5, 1.0,1.0,1.0, 1.0,1.0,0.0, 2.0,2.5,0.0, 6.0,1.5,0.0, 1.0,2.0,0.0, 4.5,2.5,0.0, 4.0,0.5,0.0, 0.0,4.0,0.0, 4.0,4.0,0.0, 4.0,0.0,0.0, 0.0,2.0,0.0, 2.0,4.0,0.0, 4.0,2.0,0.0, 2.0,0.0,0.0, 0.0,6.0,0.0, 3.0,3.0,0.0, 1.3,3.0,3.0, 0.0,3.0,0.0, 1.5,4.5,0.0, 1.5,1.5,0.0, 0.65,1.5,1.5, 0.65,4.5,1.5, 2.15,3.0,1.5, 2.0,2.0,2.0, 3.0,1.0,1.0, 3.0,3.0,1.0, 1.0,3.0,1.0, 1.0,1.0,1.0, 0.0,3.0,0.0, 2.0,0.0,0.0, 0.0,0.0,6.0, 0.0,3.0,6.0, 3.0,0.0,6.0, 0.0,1.5,0.0, 1.5,1.5,0.0, 1.5,0.0,0.0, 0.0,1.5,6.0, 1.5,1.5,6.0, 1.5,0.0,6.0, 0.0,0.0,3.0, 0.0,3.0,3.0, 3.0,0.0,3.0, 0.0,0.0,4.0, 0.0,4.0,4.0, 4.0,4.0,4.0, 4.0,0.0,4.0, 0.0,2.0,4.0, 2.0,4.0,4.0, 4.0,2.0,4.0, 2.0,0.0,4.0, 0.0,0.0,2.0, 0.0,4.0,2.0, 4.0,4.0,2.0, 4.0,0.0,2.0]
+ coords.setValues(data,56,3);
+ coords.setInfoOnComponent(0,"X (cm)");
+ coords.setInfoOnComponent(1,"Y (cm)");
+ coords.setInfoOnComponent(2,"Z (cm)");
+ return coords
+
+ def buildHexa8Mesh_1(self):
+ mesh=MEDCouplingUMesh.New("Hexa8Only",3);
+ coo=DataArrayDouble.New();
+ coords=[0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.5, 1.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 0.5, 0.5, 1.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.5, 1.0, 0.5, 1.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.5, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.5, 0.5, 1.0, 1.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0]
+ coo.setValues(coords,27,3);
+ conn=[3,12,13,4,0,9,10,1,
+ 4,13,14,5,1,10,11,2,
+ 6,15,16,7,3,12,13,4,
+ 7,16,17,8,4,13,14,5,
+ 12,21,22,13,9,18,19,10,
+ 13,22,23,14,10,19,20,11,
+ 15,24,25,16,12,21,22,13,
+ 16,25,26,17,13,22,23,14];
+ mesh.allocateCells(8);
+ for i in xrange(8):
+ mesh.insertNextCell(NORM_HEXA8,8,conn[8*i:8*(i+1)])
+ pass
+ mesh.finishInsertingCells();
+ mesh.setCoords(coo);
+ return mesh;
+
+ def buildPointe_1(self):
+ mesh=MEDCouplingUMesh.New("Pointe.med",3);
+ mesh2=MEDCouplingUMesh.New("Pointe.med",2);
+ coords=[0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 1.0, 0.0, 2.0, 1.0, -2.0, 0.0, 1.0, 0.0, -2.0, 1.0, 1.0, 1.0, 2.0, -1.0, 1.0, 2.0, -1.0, -1.0, 2.0, 1.0, -1.0, 2.0, 1.0, 1.0, 3.0, -1.0, 1.0, 3.0, -1.0, -1.0, 3.0, 1.0, -1.0, 3.0, 1.0, 1.0, 4.0, -1.0, 1.0, 4.0, -1.0, -1.0, 4.0, 1.0, -1.0, 4.0, 0.0, 0.0, 5.0]
+ conn=[0,1,2,5,0,1,3,2,0,1,4,3,0,1,5,4,1,6,3,2,1,7,4,3,1,8,5,4,1,9,2,5,1,6,2,9,1,7,3,6,1,8,4,7,1,9,5,8, 6,7,8,9,1,14,17,16,15,18, 10,11,12,13,6,7,8,9,14,15,16,17,10,11,12,13]
+ coo=DataArrayDouble.New();
+ coo.setValues(coords,19,3);
+ mesh.setCoords(coo);
+ mesh2.setCoords(coo);
+ mesh.allocateCells(16);
+ for i in xrange(12):
+ mesh.insertNextCell(NORM_TETRA4,4,conn[4*i:4*i+4])
+ pass
+ mesh.insertNextCell(NORM_PYRA5,5,conn[48:53])
+ mesh.insertNextCell(NORM_PYRA5,5,conn[53:58])
+ mesh.insertNextCell(NORM_HEXA8,8,conn[58:66])
+ mesh.insertNextCell(NORM_HEXA8,8,conn[66:74])
+ mesh.finishInsertingCells();
+ #[1,34,29,23,41,32]
+ conn2=[0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9]
+ mesh2.allocateCells(6);
+ for i in xrange(4):
+ mesh2.insertNextCell(NORM_TRI3,3,conn2[3*i:3*i+3])
+ pass
+ mesh2.insertNextCell(NORM_QUAD4,4,conn2[12:16])
+ mesh2.insertNextCell(NORM_QUAD4,4,conn2[16:20])
+ mesh2.finishInsertingCells();
+ return [mesh,mesh2]
+
build2DTargetMesh_1=classmethod(build2DTargetMesh_1)
build2DSourceMesh_1=classmethod(build2DSourceMesh_1)
build3DTargetMesh_1=classmethod(build3DTargetMesh_1)
+ build3DSourceMesh_1=classmethod(build3DSourceMesh_1)
build3DSurfTargetMesh_1=classmethod(build3DSurfTargetMesh_1)
build3DExtrudedUMesh_1=classmethod(build3DExtrudedUMesh_1)
buildCU1DMesh_U=classmethod(buildCU1DMesh_U)
build2DCurveTargetMesh_3=classmethod(build2DCurveTargetMesh_3)
build2DTargetMesh_3=classmethod(build2DTargetMesh_3)
build2DTargetMesh_4=classmethod(build2DTargetMesh_4)
+ buildMultiFields_1=classmethod(buildMultiFields_1)
+ buildMultiFields_2=classmethod(buildMultiFields_2)
+ build1DMultiTypes_1=classmethod(build1DMultiTypes_1)
+ build2DMultiTypes_1=classmethod(build2DMultiTypes_1)
+ build3DMultiTypes_1=classmethod(build3DMultiTypes_1)
+ buildCoordsForMultiTypes_1=classmethod(buildCoordsForMultiTypes_1)
+ buildHexa8Mesh_1=classmethod(buildHexa8Mesh_1)
+ buildPointe_1=classmethod(buildPointe_1)
pass
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
from MEDCouplingRemapper import *
pass
self.failUnless(1==trgfield.getArray().getNumberOfComponents());
pass
+
+ def testPrepareEx1(self):
+ sourceMesh=self.build2DSourceMesh_1();
+ targetMesh=self.build2DTargetMesh_3();
+ #
+ remapper=MEDCouplingRemapper();
+ remapper.setPrecision(1e-12);
+ remapper.setIntersectionType(Triangulation);
+ srcFt=MEDCouplingFieldTemplate.New(ON_CELLS);
+ trgFt=MEDCouplingFieldTemplate.New(ON_CELLS);
+ srcFt.setMesh(sourceMesh);
+ trgFt.setMesh(targetMesh);
+ self.assertEqual(1,remapper.prepareEx(srcFt,trgFt));
+ srcField=MEDCouplingFieldDouble.New(ON_CELLS);
+ srcField.setNature(ConservativeVolumic);
+ srcField.setMesh(sourceMesh);
+ array=DataArrayDouble.New();
+ ptr=sourceMesh.getNumberOfCells()*[None]
+ for i in xrange(sourceMesh.getNumberOfCells()):
+ ptr[i]=float(i+7);
+ pass
+ array.setValues(ptr,sourceMesh.getNumberOfCells(),1);
+ srcField.setArray(array);
+ trgfield=remapper.transferField(srcField,4.220173);
+ values=trgfield.getArray().getValues();
+ valuesExpected=[7.75, 7.0625, 4.220173,8.0]
+ self.assertEqual(4,trgfield.getArray().getNumberOfTuples());
+ self.assertEqual(1,trgfield.getArray().getNumberOfComponents());
+ for i0 in xrange(4):
+ self.assertAlmostEqual(valuesExpected[i0],values[i0],12);
+ pass
+ pass
def build2DSourceMesh_1(self):
sourceCoords=[-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7]
myCoords.setValues(targetCoords,9,2);
targetMesh.setCoords(myCoords);
return targetMesh;
+
+ def build2DTargetMesh_3(self):
+ targetCoords=[-0.6,-0.4, -0.1,-0.4, 1.1,-0.4, 2.1,-0.4, -0.6,0.1, -0.1,0.1, 1.1,0.1, 2.1,0.1, -0.6,1.1, -0.1,1.1]
+ targetConn=[0,4,5,1, 1,5,6,2, 2,6,7,3, 4,8,9,5]
+ targetMesh=MEDCouplingUMesh.New();
+ targetMesh.setMeshDimension(2);
+ targetMesh.allocateCells(4);
+ for i in xrange(4):
+ targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[4*i:4*(i+1)])
+ pass
+ targetMesh.finishInsertingCells();
+ myCoords=DataArrayDouble.New();
+ myCoords.setValues(targetCoords,10,2);
+ targetMesh.setCoords(myCoords);
+ return targetMesh;
+ pass
def setUp(self):
pass
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifdef WITH_NUMPY2
return ret;
}
+static PyObject* convertMultiFields(ParaMEDMEM::MEDCouplingMultiFields *mfs, int owner) throw(INTERP_KERNEL::Exception)
+{
+ PyObject *ret=0;
+ if(dynamic_cast<ParaMEDMEM::MEDCouplingFieldOverTime *>(mfs))
+ ret=SWIG_NewPointerObj((void*)mfs,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldOverTime,owner);
+ else
+ ret=SWIG_NewPointerObj((void*)mfs,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMultiFields,owner);
+ return ret;
+}
+
static PyObject *convertIntArrToPyList(const int *ptr, int size) throw(INTERP_KERNEL::Exception)
{
#ifndef WITH_NUMPY2
throw INTERP_KERNEL::Exception(msg);
}
}
+
+/*!
+ * if python int -> cpp int sw=1
+ * if python list[int] -> cpp vector<int> sw=2
+ * if python tuple[int] -> cpp vector<int> sw=2
+ * if python DataArrayInt -> cpp DataArrayInt sw=3
+ *
+ * switch between (int,vector<int>,DataArrayInt)
+ */
+static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, ParaMEDMEM::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+{
+ sw=-1;
+ if(PyInt_Check(value))
+ {
+ iTyypp=(int)PyInt_AS_LONG(value);
+ sw=1;
+ return;
+ }
+ if(PyTuple_Check(value))
+ {
+ int size=PyTuple_Size(value);
+ stdvecTyypp.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyTuple_GetItem(value,i);
+ if(PyInt_Check(o))
+ stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=2;
+ return;
+ }
+ if(PyList_Check(value))
+ {
+ int size=PyList_Size(value);
+ stdvecTyypp.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyList_GetItem(value,i);
+ if(PyInt_Check(o))
+ stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=2;
+ return;
+ }
+ void *argp;
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
+ if(!SWIG_IsOK(status))
+ throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, DataArrayInt");
+ daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
+ sw=3;
+}
+
+/*!
+ * if python double -> cpp double sw=1
+ * if python int -> cpp double sw=1
+ * if python list[double] -> cpp vector<double> sw=2
+ * if python list[int] -> cpp vector<double> sw=2
+ * if python tuple[double] -> cpp vector<double> sw=2
+ * if python tuple[int] -> cpp vector<double> sw=2
+ * if python DataArrayDouble -> cpp DataArrayDouble sw=3
+ *
+ * switch between (int,vector<int>,DataArrayInt)
+ */
+static void convertObjToPossibleCpp4(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, ParaMEDMEM::DataArrayDouble *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+{
+ sw=-1;
+ if(PyFloat_Check(value))
+ {
+ iTyypp=PyFloat_AS_DOUBLE(value);
+ sw=1;
+ return;
+ }
+ if(PyInt_Check(value))
+ {
+ iTyypp=(double)PyInt_AS_LONG(value);
+ sw=1;
+ return;
+ }
+ if(PyTuple_Check(value))
+ {
+ int size=PyTuple_Size(value);
+ stdvecTyypp.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyTuple_GetItem(value,i);
+ if(PyFloat_Check(o))
+ stdvecTyypp[i]=PyFloat_AS_DOUBLE(o);
+ else if(PyInt_Check(o))
+ stdvecTyypp[i]=(double)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=2;
+ return;
+ }
+ if(PyList_Check(value))
+ {
+ int size=PyList_Size(value);
+ stdvecTyypp.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyList_GetItem(value,i);
+ if(PyFloat_Check(o))
+ stdvecTyypp[i]=PyFloat_AS_DOUBLE(o);
+ else if(PyInt_Check(o))
+ stdvecTyypp[i]=(double)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=2;
+ return;
+ }
+ void *argp;
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0);
+ if(!SWIG_IsOK(status))
+ throw INTERP_KERNEL::Exception("5 types accepted : double float, integer, tuple of double float or int, list of double float or int, DataArrayDouble");
+ daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayDouble * >(argp);
+ sw=3;
+}
+
+/*!
+ * if python int -> cpp int sw=1
+ * if python list[int] -> cpp vector<int> sw=2
+ * if python tuple[int] -> cpp vector<int> sw=2
+ * if python slicp -> cpp pair sw=3
+ * if python DataArrayInt -> cpp DataArrayInt sw=4
+ *
+ * switch between (int,vector<int>,DataArrayInt)
+ */
+static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, ParaMEDMEM::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+{
+ sw=-1;
+ if(PyInt_Check(value))
+ {
+ iTyypp=(int)PyInt_AS_LONG(value);
+ sw=1;
+ return;
+ }
+ if(PyTuple_Check(value))
+ {
+ int size=PyTuple_Size(value);
+ stdvecTyypp.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyTuple_GetItem(value,i);
+ if(PyInt_Check(o))
+ stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=2;
+ return;
+ }
+ if(PyList_Check(value))
+ {
+ int size=PyList_Size(value);
+ stdvecTyypp.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyList_GetItem(value,i);
+ if(PyInt_Check(o))
+ stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+ else
+ {
+ std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ sw=2;
+ return;
+ }
+ if(PySlice_Check(value))
+ {
+ Py_ssize_t strt,stp,step;
+ PySliceObject *oC=reinterpret_cast<PySliceObject *>(value);
+ if(PySlice_GetIndices(oC,nbelem,&strt,&stp,&step)!=0)
+ {
+ std::ostringstream oss; oss << "Slice in subscriptable object DataArray invalid : number of elemnts is : " << nbelem;
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ p.first=strt;
+ p.second.first=stp;
+ p.second.second=step;
+ sw=3;
+ return ;
+ }
+ void *argp;
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
+ if(!SWIG_IsOK(status))
+ throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt");
+ daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
+ sw=4;
+}
+
+/*!
+ * if value int -> cpp it sw=1
+ * if value list[int] -> vt sw=2
+ * if value tuple[int] -> vt sw=2
+ * if value slice -> pt sw=3
+ * if value DataArrayInt -> dt sw=4
+ * if value tuple [int,int] -> cpp it,ip sw=5
+ * if value tuple [list[int],int] -> cpp vt,ip sw=6
+ * if value tuple [tuple[int],int] -> cpp vt,ip sw=6
+ * if value tuple [slice,int] -> cpp pt,ip sw=7
+ * if value tuple [DaI,int] -> cpp dt,ip sw=8
+ * if value tuple [int,list[int]] -> cpp it,vc sw=9
+ * if value tuple [list[int],list[int]] -> cpp vt,vc sw=10
+ * if value tuple [tuple[int],list[int]] -> cpp vt,vc sw=10
+ * if value tuple [slice,list[int]] -> cpp pt,vc sw=11
+ * if value tuple [DaI,list[int]] -> cpp dt,vc sw=12
+ * if value tuple [int,tuple[int]] -> cpp it,vc sw=9
+ * if value tuple [list[int],tuple[int]] -> cpp vt,vc sw=10
+ * if value tuple [tuple[int],tuple[int]] -> cpp vt,vc sw=10
+ * if value tuple [slice,tuple[int]] -> cpp pt,vc sw=11
+ * if value tuple [DaI,tuple[int]] -> cpp dt,vc sw=12
+ * if value tuple [int,slice] -> cpp it,pc sw=13
+ * if value tuple [list[int],slice] -> cpp vt,pc sw=14
+ * if value tuple [tuple[int],slice] -> cpp vt,pc sw=14
+ * if value tuple [slice,slice] -> cpp pt,pc sw=15
+ * if value tuple [DaI,slice] -> cpp dt,pc sw=16
+ *
+ * switch between (int,vector<int>,DataArrayInt)
+ */
+static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, int& sw, int& it, int& ic, std::vector<int>& vt, std::vector<int>& vc,
+ std::pair<int, std::pair<int,int> >& pt, std::pair<int, std::pair<int,int> >& pc,
+ ParaMEDMEM::DataArrayInt *&dt, ParaMEDMEM::DataArrayInt *&dc) throw(INTERP_KERNEL::Exception)
+{
+ if(!PyTuple_Check(value))
+ {
+ convertObjToPossibleCpp2(value,nbTuple,sw,it,vt,pt,dt);
+ return ;
+ }
+ else
+ {
+ int sz=PyTuple_Size(value);
+ if(sz!=2)
+ throw INTERP_KERNEL::Exception("Unexpected nb of slice element : 1 or 2 expected !\n1st is for tuple selection, 2nd for component selection !");
+ PyObject *ob0=PyTuple_GetItem(value,0);
+ int sw1,sw2;
+ convertObjToPossibleCpp2(ob0,nbTuple,sw1,it,vt,pt,dt);
+ PyObject *ob1=PyTuple_GetItem(value,1);
+ convertObjToPossibleCpp2(ob1,nbCompo,sw2,ic,vc,pc,dc);
+ sw=4*sw2+sw1;
+ }
+}
+
+/*!
+ * if value int -> cpp val sw=1
+ * if value double -> cpp val sw=1
+ * if value DataArrayDouble -> cpp DataArrayDouble sw=2
+ */
+static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, ParaMEDMEM::DataArrayDouble *&d)
+{
+ sw=-1;
+ if(PyFloat_Check(value))
+ {
+ val=PyFloat_AS_DOUBLE(value);
+ sw=1;
+ return;
+ }
+ if(PyInt_Check(value))
+ {
+ val=(double)PyInt_AS_LONG(value);
+ sw=1;
+ return;
+ }
+ void *argp;
+ int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,0|0);
+ if(!SWIG_IsOK(status))
+ throw INTERP_KERNEL::Exception("3 types accepted : integer, double, DataArrayDouble");
+ d=reinterpret_cast< ParaMEDMEM::DataArrayDouble * >(argp);
+ sw=2;
+}
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# MED MEDCoupling_Swig : binding of C++ implementation and Python
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "MEDFileData.hxx"
+
+using namespace ParaMEDMEM;
+
+MEDFileData *MEDFileData::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDFileData(fileName);
+}
+
+MEDFileData *MEDFileData::New()
+{
+ return new MEDFileData;
+}
+
+MEDFileFields *MEDFileData::getFields() const
+{
+ return const_cast<MEDFileFields *>(static_cast<const MEDFileFields *>(_fields));
+}
+
+MEDFileMeshes *MEDFileData::getMeshes() const
+{
+ return const_cast<MEDFileMeshes *>(static_cast<const MEDFileMeshes *>(_meshes));
+}
+
+void MEDFileData::setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception)
+{
+ if(!fields)
+ throw INTERP_KERNEL::Exception("MEDFileData::setFields : input pointer is null !");
+ fields->incrRef();
+ _fields=fields;
+}
+
+void MEDFileData::setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception)
+{
+ if(!meshes)
+ throw INTERP_KERNEL::Exception("MEDFileData::setMeshes : input pointer is null !");
+ meshes->incrRef();
+ _meshes=meshes;
+}
+
+int MEDFileData::getNumberOfFields() const throw(INTERP_KERNEL::Exception)
+{
+ const MEDFileFields *f=_fields;
+ if(!f)
+ throw INTERP_KERNEL::Exception("MEDFileData::getNumberOfFields : no fields set !");
+ return f->getNumberOfFields();
+}
+
+int MEDFileData::getNumberOfMeshes() const throw(INTERP_KERNEL::Exception)
+{
+ const MEDFileMeshes *m=_meshes;
+ if(!m)
+ throw INTERP_KERNEL::Exception("MEDFileData::getNumberOfMeshes : no meshes set !");
+ return m->getNumberOfMeshes();
+}
+
+MEDFileData::MEDFileData()
+{
+}
+
+MEDFileData::MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
+try
+ {
+ _fields=MEDFileFields::New(fileName);
+ _meshes=MEDFileMeshes::New(fileName);
+ }
+catch(INTERP_KERNEL::Exception& e)
+ {
+ throw e;
+ }
+
+void MEDFileData::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+{
+ const MEDFileMeshes *ms=_meshes;
+ if(ms)
+ ms->write(fileName,mode);
+ const MEDFileFields *fs=_fields;
+ if(fs)
+ fs->write(fileName,mode);
+}
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#ifndef __MEDFILEDATA_HXX__
+#define __MEDFILEDATA_HXX__
+
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MEDFileField.hxx"
+#include "MEDFileMesh.hxx"
+
+namespace ParaMEDMEM
+{
+ /*!
+ * User class.
+ */
+ class MEDFileData : public RefCountObject, public MEDFileWritable
+ {
+ public:
+ static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+ static MEDFileData *New();
+ MEDFileFields *getFields() const;
+ MEDFileMeshes *getMeshes() const;
+ void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
+ void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
+ int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
+ //
+ void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ private:
+ MEDFileData();
+ MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception);
+ private:
+ MEDCouplingAutoRefCountObjectPtr<MEDFileFields> _fields;
+ MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> _meshes;
+ };
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#include "MEDFileField.hxx"
+#include "MEDFileMesh.hxx"
+#include "MEDLoaderBase.hxx"
+#include "MEDFileUtilities.hxx"
+
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingFieldDiscretization.hxx"
+
+#include "InterpKernelAutoPtr.hxx"
+#include "CellModel.hxx"
+
+#include <algorithm>
+
+extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO];
+extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO];
+extern med_geometry_type typmainoeud[1];
+extern med_geometry_type typmai3[32];
+
+using namespace ParaMEDMEM;
+
+MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, const char *locName)
+{
+ return new MEDFileFieldLoc(fid,locName);
+}
+
+MEDFileFieldLoc *MEDFileFieldLoc::New(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w)
+{
+ return new MEDFileFieldLoc(locName,geoType,refCoo,gsCoo,w);
+}
+
+MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, const char *locName):_name(locName)
+{
+ med_geometry_type geotype;
+ med_geometry_type sectiongeotype;
+ int nsectionmeshcell;
+ INTERP_KERNEL::AutoPtr<char> geointerpname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> sectionmeshname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDlocalizationInfoByName(fid,locName,&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype);
+ _geo_type=(INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+32,geotype)));
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ _nb_node_per_cell=cm.getNumberOfNodes();
+ _ref_coo.resize(_dim*_nb_node_per_cell);
+ _gs_coo.resize(_dim*_nb_gauss_pt);
+ _w.resize(_nb_gauss_pt);
+ MEDlocalizationRd(fid,locName,MED_FULL_INTERLACE,&_ref_coo[0],&_gs_coo[0],&_w[0]);
+}
+
+MEDFileFieldLoc::MEDFileFieldLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType,
+ const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w):_name(locName),_geo_type(geoType),_ref_coo(refCoo),_gs_coo(gsCoo),
+ _w(w)
+{
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ _dim=cm.getDimension();
+ _nb_node_per_cell=cm.getNumberOfNodes();
+ _nb_gauss_pt=_w.size();
+}
+
+bool MEDFileFieldLoc::isEqual(const MEDFileFieldLoc& other, double eps) const
+{
+ if(_name!=other._name)
+ return false;
+ if(_dim!=other._dim)
+ return false;
+ if(_nb_gauss_pt!=other._nb_gauss_pt)
+ return false;
+ if(_nb_node_per_cell!=other._nb_node_per_cell)
+ return false;
+ if(_geo_type!=other._geo_type)
+ return false;
+ if(MEDCouplingGaussLocalization::AreAlmostEqual(_ref_coo,other._ref_coo,eps))
+ return false;
+ if(MEDCouplingGaussLocalization::AreAlmostEqual(_gs_coo,other._gs_coo,eps))
+ return false;
+ if(MEDCouplingGaussLocalization::AreAlmostEqual(_w,other._w,eps))
+ return false;
+
+ return true;
+}
+
+void MEDFileFieldLoc::writeLL(med_idt fid) const
+{
+ MEDlocalizationWr(fid,_name.c_str(),typmai3[(int)_geo_type],_dim,&_ref_coo[0],MED_FULL_INTERLACE,_nb_gauss_pt,&_gs_coo[0],&_w[0],MED_NO_INTERPOLATION,MED_NO_MESH_SUPPORT);
+}
+
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ _type=field->getTypeOfField();
+ const DataArrayDouble *da=field->getArray();
+ switch(_type)
+ {
+ case ON_CELLS:
+ {
+ _arr=da->selectByTupleId2(offset,offset+nbOfCells,1);
+ _nval=nbOfCells;
+ break;
+ }
+ case ON_GAUSS_NE:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(field->getMesh());
+ const int *arrPtr=arr->getConstPointer();
+ _nval=nbOfCells;
+ _arr=da->selectByTupleId2(arrPtr[offset],arrPtr[offset+nbOfCells],1);
+ break;
+ }
+ case ON_GAUSS_PT:
+ {
+ const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
+ const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(_loc_id);
+ const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
+ if(!disc2)
+ throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !");
+ const DataArrayInt *dai=disc2->getArrayOfDiscIds();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dai2=disc2->getOffsetArr(field->getMesh());
+ const int *dai2Ptr=dai2->getConstPointer();
+ int nbi=gsLoc.getWeights().size();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da2=dai->selectByTupleId2(offset,offset+nbOfCells,1);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=da2->getIdsEqual(_loc_id);
+ const int *da3Ptr=da3->getConstPointer();
+ if(da3->getNumberOfTuples()!=nbOfCells)
+ {//profile : for gauss even in NoProfile !!!
+ std::ostringstream oss; oss << "Pfl_" << getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
+ _profile=oss.str();
+ da3->setName(_profile.c_str());
+ glob.appendProfile(da3);
+ }
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da4=DataArrayInt::New();
+ _nval=da3->getNbOfElems();
+ da4->alloc(_nval*nbi,1);
+ int *da4Ptr=da4->getPointer();
+ for(int i=0;i<_nval;i++)
+ {
+ int ref=dai2Ptr[offset+da3Ptr[i]];
+ for(int j=0;j<nbi;j++)
+ *da4Ptr++=ref+j;
+ }
+ std::ostringstream oss2; oss2 << "Loc_" << getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
+ _localization=oss2.str();
+ _arr=da->selectByTupleId(da4->getConstPointer(),da4->getConstPointer()+_nval*nbi);
+ glob.appendLoc(_localization.c_str(),getGeoType(),gsLoc.getRefCoords(),gsLoc.getGaussCoords(),gsLoc.getWeights());
+ break;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile : not implemented yet for such discretization type of field !");
+ }
+}
+
+/*!
+ * Leaf method of field with profile assignement.
+ * @param pflName input containing name of profile if any. 0 if no profile.
+ * @param multiTypePfl input containing the profile array \b including \b all \b types. This array is usefull only for GAUSS_NE.
+ * @param idsInPfl input containing the ids in the profile 'multiTypePfl' concerning the current geo type.
+ */
+void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(const char *pflName, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ if(pflName)
+ _profile=pflName;
+ else
+ _profile.clear();
+ _type=field->getTypeOfField();
+ const DataArrayDouble *da=field->getArray();
+ switch(_type)
+ {
+ case ON_NODES:
+ {
+ _nval=idsInPfl->getNumberOfTuples();
+ _arr=da->deepCpy();
+ break;
+ }
+ case ON_CELLS:
+ {
+ _nval=idsInPfl->getNumberOfTuples();
+ _arr=da->selectByTupleId(idsInPfl->getConstPointer(),idsInPfl->getConstPointer()+_nval);
+ break;
+ }
+ case ON_GAUSS_NE:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(mesh);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2=arr->deltaShiftIndex();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr3=arr2->selectByTupleId(multiTypePfl->getConstPointer(),multiTypePfl->getConstPointer()+multiTypePfl->getNumberOfTuples());
+ arr3->computeOffsets2();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
+ int trueNval=tmp->getNumberOfTuples();
+ _nval=idsInPfl->getNumberOfTuples();
+ _arr=da->selectByTupleIdSafe(tmp->getConstPointer(),tmp->getConstPointer()+trueNval);
+ break;
+ }
+ case ON_GAUSS_PT:
+ {
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile : not implemented yet for profiles on gauss points !");
+ }
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile : not implemented yet for such discretization type of field !");
+ }
+}
+
+void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ _arr=field->getArray()->deepCpy();
+ _nval=field->getArray()->getNumberOfTuples();
+}
+
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerType *fath, med_idt fid, TypeOfField type, int profileIt) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDFileFieldPerMeshPerTypePerDisc(fath,fid,type,profileIt);
+}
+
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int locId)
+{
+ return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,locId);
+}
+
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, med_idt fid, TypeOfField atype, int profileIt) throw(INTERP_KERNEL::Exception)
+try:_type(atype),_father(fath),_profile_it(profileIt)
+{
+ INTERP_KERNEL::AutoPtr<char> locname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> pflname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ std::string fieldName=getName();
+ std::string meshName=getMeshName();
+ int iteration=getIteration();
+ int order=getOrder();
+ const std::vector<std::string>& infos=getInfo();
+ TypeOfField type=getType();
+ INTERP_KERNEL::NormalizedCellType geoType=getGeoType();
+ int profilesize,nbi;
+ med_geometry_type mgeoti;
+ med_entity_type menti=MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(type,geoType,mgeoti);
+ _nval=MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,profileIt,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi);
+ _arr=DataArrayDouble::New();
+ _arr->alloc(_nval*nbi,infos.size());
+ MEDfieldValueWithProfileRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,
+ pflname,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,reinterpret_cast<unsigned char*>(_arr->getPointer()));
+ _profile=MEDLoaderBase::buildStringFromFortran(pflname,MED_NAME_SIZE);
+ _localization=MEDLoaderBase::buildStringFromFortran(locname,MED_NAME_SIZE);
+ if(type==ON_CELLS && !_localization.empty())
+ {
+ if(_localization!="MED_GAUSS_ELNO")
+ setType(ON_GAUSS_PT);
+ else
+ {
+ setType(ON_GAUSS_NE);
+ _localization.clear();
+ }
+ }
+}
+catch(INTERP_KERNEL::Exception& e)
+{
+ throw e;
+}
+
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int locId):_type(type),_father(fath),_loc_id(locId)
+{
+}
+
+const MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerTypePerDisc::getFather() const
+{
+ return _father;
+}
+
+int MEDFileFieldPerMeshPerTypePerDisc::getIteration() const
+{
+ return _father->getIteration();
+}
+
+int MEDFileFieldPerMeshPerTypePerDisc::getOrder() const
+{
+ return _father->getOrder();
+}
+
+double MEDFileFieldPerMeshPerTypePerDisc::getTime() const
+{
+ return _father->getTime();
+}
+
+std::string MEDFileFieldPerMeshPerTypePerDisc::getName() const
+{
+ return _father->getName();
+}
+
+std::string MEDFileFieldPerMeshPerTypePerDisc::getMeshName() const
+{
+ return _father->getMeshName();
+}
+
+TypeOfField MEDFileFieldPerMeshPerTypePerDisc::getType() const
+{
+ return _type;
+}
+
+void MEDFileFieldPerMeshPerTypePerDisc::setType(TypeOfField newType)
+{
+ _type=newType;
+}
+
+INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerTypePerDisc::getGeoType() const
+{
+ return _father->getGeoType();
+}
+
+int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfComponents() const
+{
+ return _father->getNumberOfComponents();
+}
+
+int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const
+{
+ return _arr->getNumberOfTuples();
+}
+
+const std::vector<std::string>& MEDFileFieldPerMeshPerTypePerDisc::getInfo() const
+{
+ return _father->getInfo();
+}
+
+std::string MEDFileFieldPerMeshPerTypePerDisc::getProfile() const
+{
+ return _profile;
+}
+
+std::string MEDFileFieldPerMeshPerTypePerDisc::getLocalization() const
+{
+ return _localization;
+}
+
+void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector<const DataArrayDouble *>& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
+{
+ if(type!=_type)
+ return ;
+ dads.push_back(_arr);
+ geoTypes.push_back(getGeoType());
+ if(_profile.empty())
+ pfls.push_back(0);
+ else
+ {
+ pfls.push_back(glob->getProfile(_profile.c_str()));
+ }
+ if(_localization.empty())
+ locs.push_back(-1);
+ else
+ {
+ locs.push_back(glob->getLocalizationId(_localization.c_str()));
+ }
+}
+
+void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+{
+ TypeOfField type=getType();
+ INTERP_KERNEL::NormalizedCellType geoType=getGeoType();
+ med_geometry_type mgeoti;
+ med_entity_type menti=MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(type,geoType,mgeoti);
+ MEDfieldValueWithProfileWr(fid,getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti,
+ MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,_nval,
+ reinterpret_cast<const unsigned char*>(_arr->getConstPointer()));
+}
+
+int MEDFileFieldPerMeshPerTypePerDisc::ConvertType(TypeOfField type, int locId) throw(INTERP_KERNEL::Exception)
+{
+ switch(type)
+ {
+ case ON_CELLS:
+ return -2;
+ case ON_GAUSS_NE:
+ return -1;
+ case ON_GAUSS_PT:
+ return locId;
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::ConvertType : not managed type of field !");
+ }
+}
+
+MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDFileFieldPerMeshPerType(fath,geoType);
+}
+
+void MEDFileFieldPerMeshPerType::assignFieldNoProfile(int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ std::vector<int> pos=addNewEntryIfNecessary(field,offset,nbOfCells);
+ for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
+ _field_pm_pt_pd[*it]->assignFieldNoProfile(offset,nbOfCells,field,glob);
+}
+
+void MEDFileFieldPerMeshPerType::assignFieldProfile(const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ std::vector<int> pos=addNewEntryIfNecessary(field,idsInPfl);
+ if(locIds)
+ {
+ //
+ std::string pflName(locIds->getName());
+ if(pflName.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerType::assignFieldProfile : existing profile with empty name !");
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ std::ostringstream oss; oss << pflName << "_" << cm.getRepr();
+ locIds->setName(oss.str().c_str());
+ glob.appendProfile(locIds);
+ //
+ for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
+ _field_pm_pt_pd[*it]->assignFieldProfile(oss.str().c_str(),multiTypePfl,idsInPfl,field,mesh,glob);
+ }
+ else
+ {
+ for(std::vector<int>::const_iterator it=pos.begin();it!=pos.end();it++)
+ _field_pm_pt_pd[*it]->assignFieldProfile(0,multiTypePfl,idsInPfl,field,mesh,glob);
+ }
+}
+
+void MEDFileFieldPerMeshPerType::assignNodeFieldNoProfile(const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ _field_pm_pt_pd.resize(1);
+ _field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3);
+ _field_pm_pt_pd[0]->assignNodeFieldNoProfile(field,glob);
+}
+
+void MEDFileFieldPerMeshPerType::assignNodeFieldProfile(const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ std::string pflName(pfl->getName());
+ if(pflName.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerType::assignNodeFieldProfile : existing profile with empty name !");
+ std::ostringstream oss; oss << pflName << "_NODE";
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pfl2=pfl->deepCpy();
+ pfl2->setName(oss.str().c_str());
+ glob.appendProfile(pfl2);
+ //
+ _field_pm_pt_pd.resize(1);
+ _field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3);
+ _field_pm_pt_pd[0]->assignFieldProfile(oss.str().c_str(),pfl,pfl2,field,0,glob);//mesh is not requested so 0 is send.
+}
+
+std::vector<int> MEDFileFieldPerMeshPerType::addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception)
+{
+ TypeOfField type=field->getTypeOfField();
+ if(type!=ON_GAUSS_PT)
+ {
+ int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
+ int sz=_field_pm_pt_pd.size();
+ bool found=false;
+ for(int j=0;j<sz && !found;j++)
+ {
+ if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
+ {
+ _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ found=true;
+ }
+ }
+ if(!found)
+ {
+ _field_pm_pt_pd.resize(sz+1);
+ _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ }
+ std::vector<int> ret(1,0);
+ return ret;
+ }
+ else
+ {
+ std::vector<int> ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells);
+ int sz2=ret2.size();
+ std::vector<int> ret3(sz2);
+ int k=0;
+ for(int i=0;i<sz2;i++)
+ {
+ int sz=_field_pm_pt_pd.size();
+ int locIdToFind=ret2[i];
+ bool found=false;
+ for(int j=0;j<sz && !found;j++)
+ {
+ if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
+ {
+ _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ ret3[k++]=j;
+ found=true;
+ }
+ }
+ if(!found)
+ {
+ _field_pm_pt_pd.resize(sz+1);
+ _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ ret3[k++]=sz;
+ }
+ }
+ return ret3;
+ }
+}
+
+std::vector<int> MEDFileFieldPerMeshPerType::addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception)
+{
+ const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
+ const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
+ if(!disc2)
+ throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
+ const DataArrayInt *da=disc2->getArrayOfDiscIds();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da2=da->selectByTupleId2(offset,offset+nbOfCells,1);
+ std::set<int> retTmp=da2->getDifferentValues();
+ if(retTmp.find(-1)!=retTmp.end())
+ throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !");
+ std::vector<int> ret(retTmp.begin(),retTmp.end());
+ return ret;
+}
+
+std::vector<int> MEDFileFieldPerMeshPerType::addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception)
+{
+ TypeOfField type=field->getTypeOfField();
+ if(type!=ON_GAUSS_PT)
+ {
+ int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0);
+ int sz=_field_pm_pt_pd.size();
+ bool found=false;
+ for(int j=0;j<sz && !found;j++)
+ {
+ if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
+ {
+ _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ found=true;
+ }
+ }
+ if(!found)
+ {
+ _field_pm_pt_pd.resize(sz+1);
+ _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ }
+ std::vector<int> ret(1,0);
+ return ret;
+ }
+ else
+ {
+ std::vector<int> ret2=addNewEntryIfNecessaryGauss(field,subCells);
+ int sz2=ret2.size();
+ std::vector<int> ret3(sz2);
+ int k=0;
+ for(int i=0;i<sz2;i++)
+ {
+ int sz=_field_pm_pt_pd.size();
+ int locIdToFind=ret2[i];
+ bool found=false;
+ for(int j=0;j<sz && !found;j++)
+ {
+ if(_field_pm_pt_pd[j]->getLocId()==locIdToFind)
+ {
+ _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ ret3[k++]=j;
+ found=true;
+ }
+ }
+ if(!found)
+ {
+ _field_pm_pt_pd.resize(sz+1);
+ _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind);
+ ret3[k++]=sz;
+ }
+ }
+ return ret3;
+ }
+}
+
+std::vector<int> MEDFileFieldPerMeshPerType::addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception)
+{
+ const MEDCouplingFieldDiscretization *disc=field->getDiscretization();
+ const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(disc);
+ if(!disc2)
+ throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !");
+ const DataArrayInt *da=disc2->getArrayOfDiscIds();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da2=da->selectByTupleId(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples());
+ std::set<int> retTmp=da2->getDifferentValues();
+ if(retTmp.find(-1)!=retTmp.end())
+ throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !");
+ std::vector<int> ret(retTmp.begin(),retTmp.end());
+ return ret;
+}
+
+const MEDFileFieldPerMesh *MEDFileFieldPerMeshPerType::getFather() const
+{
+ return _father;
+}
+
+void MEDFileFieldPerMeshPerType::getDimension(int& dim) const
+{
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ int curDim=(int)cm.getDimension();
+ dim=std::max(dim,curDim);
+}
+
+int MEDFileFieldPerMeshPerType::getIteration() const
+{
+ return _father->getIteration();
+}
+
+int MEDFileFieldPerMeshPerType::getOrder() const
+{
+ return _father->getOrder();
+}
+
+double MEDFileFieldPerMeshPerType::getTime() const
+{
+ return _father->getTime();
+}
+
+std::string MEDFileFieldPerMeshPerType::getName() const
+{
+ return _father->getName();
+}
+
+std::string MEDFileFieldPerMeshPerType::getMeshName() const
+{
+ return _father->getMeshName();
+}
+
+INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerType::getGeoType() const
+{
+ return _geo_type;
+}
+
+
+int MEDFileFieldPerMeshPerType::getNumberOfComponents() const
+{
+ return _father->getNumberOfComponents();
+}
+
+const std::vector<std::string>& MEDFileFieldPerMeshPerType::getInfo() const
+{
+ return _father->getInfo();
+}
+
+std::vector<std::string> MEDFileFieldPerMeshPerType::getPflsReallyUsed() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ {
+ std::string tmp=(*it1)->getProfile();
+ if(!tmp.empty())
+ ret.push_back(tmp);
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileFieldPerMeshPerType::getLocsReallyUsed() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ {
+ std::string tmp=(*it1)->getLocalization();
+ if(!tmp.empty() && tmp!=MED_GAUSS_ELNO)
+ ret.push_back(tmp);
+ }
+ return ret;
+}
+
+void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector<const DataArrayDouble *>& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
+{
+ if(_geo_type!=INTERP_KERNEL::NORM_ERROR)
+ {
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ if(meshDim!=(int)cm.getDimension())
+ return ;
+ }
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ (*it)->getFieldAtLevel(type,glob,dads,pfls,locs,geoTypes);
+}
+
+MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception):_father(fath),_geo_type(geoType)
+{
+}
+
+void MEDFileFieldPerMeshPerType::finishLoading(med_idt fid, TypeOfField type) throw(INTERP_KERNEL::Exception)
+{
+ INTERP_KERNEL::NormalizedCellType geoType=getGeoType();
+ INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_geometry_type mgeoti;
+ med_entity_type menti=ConvertIntoMEDFileType(type,geoType,mgeoti);
+ int nbProfiles=MEDfieldnProfile(fid,getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName);
+ _field_pm_pt_pd.resize(nbProfiles);
+ for(int i=0;i<nbProfiles;i++)
+ {
+ _field_pm_pt_pd[i]=MEDFileFieldPerMeshPerTypePerDisc::New(this,fid,type,i+1);
+ }
+}
+
+void MEDFileFieldPerMeshPerType::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++)
+ {
+ (*it)->copyOptionsFrom(*this);
+ (*it)->writeLL(fid);
+ }
+}
+
+med_entity_type MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType)
+{
+ switch(ikType)
+ {
+ case ON_CELLS:
+ medfGeoType=typmai3[(int)ikGeoType];
+ return MED_CELL;
+ case ON_NODES:
+ medfGeoType=MED_NONE;
+ return MED_NODE;
+ case ON_GAUSS_NE:
+ medfGeoType=typmai3[(int)ikGeoType];
+ return MED_NODE_ELEMENT;
+ case ON_GAUSS_PT:
+ medfGeoType=typmai3[(int)ikGeoType];
+ return MED_CELL;
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType : unexpected entity type ! internal error");
+ }
+ return MED_UNDEF_ENTITY_TYPE;
+}
+
+MEDFileFieldPerMesh *MEDFileFieldPerMesh::New(MEDFileField1TSWithoutDAS *fath, int meshCsit, int meshIteration, int meshOrder)
+{
+ return new MEDFileFieldPerMesh(fath,meshCsit,meshIteration,meshOrder);
+}
+
+MEDFileFieldPerMesh *MEDFileFieldPerMesh::New(MEDFileField1TSWithoutDAS *fath, const MEDCouplingMesh *mesh)
+{
+ return new MEDFileFieldPerMesh(fath,mesh);
+}
+
+void MEDFileFieldPerMesh::copyTinyInfoFrom(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception)
+{
+ _mesh_name=mesh->getName();
+ mesh->getTime(_mesh_iteration,_mesh_order);
+}
+
+void MEDFileFieldPerMesh::assignFieldProfile(const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTypes=code.size()/3;
+ bool isProfile=false;
+ for(int i=0;i<nbOfTypes;i++)
+ if(code[3*i+2]!=-1)
+ isProfile=true;
+ if(!isProfile)
+ {
+ if(idsInPflPerType.empty())
+ assignFieldNoProfileNoRenum(code,field,glob);
+ else
+ assignFieldProfileGeneral(multiTypePfl,code,idsInPflPerType,idsPerType,field,mesh,glob);
+ }
+ else
+ assignFieldProfileGeneral(multiTypePfl,code,idsInPflPerType,idsPerType,field,mesh,glob);
+}
+
+void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(const std::vector<int>& code, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTypes=code.size()/3;
+ int offset=0;
+ for(int i=0;i<nbOfTypes;i++)
+ {
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
+ int nbOfCells=code[3*i+1];
+ int pos=addNewEntryIfNecessary(type);
+ _field_pm_pt[pos]->assignFieldNoProfile(offset,nbOfCells,field,glob);
+ offset+=nbOfCells;
+ }
+}
+
+/*!
+ * This method is the most general one. No optimization is done here.
+ */
+void MEDFileFieldPerMesh::assignFieldProfileGeneral(const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTypes=code.size()/3;
+ for(int i=0;i<nbOfTypes;i++)
+ {
+ INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)code[3*i];
+ int pos=addNewEntryIfNecessary(type);
+ DataArrayInt *pfl=0;
+ if(code[3*i+2]!=-1)
+ pfl=idsPerType[code[3*i+2]];
+ _field_pm_pt[pos]->assignFieldProfile(multiTypePfl,idsInPflPerType[i],pfl,field,mesh,glob);
+ }
+}
+
+void MEDFileFieldPerMesh::assignNodeFieldNoProfile(const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
+ _field_pm_pt[pos]->assignNodeFieldNoProfile(field,glob);
+}
+
+void MEDFileFieldPerMesh::assignNodeFieldProfile(const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR);
+ _field_pm_pt[pos]->assignNodeFieldProfile(pfl,field,glob);
+}
+
+void MEDFileFieldPerMesh::finishLoading(med_idt fid) throw(INTERP_KERNEL::Exception)
+{
+ INTERP_KERNEL::AutoPtr<char> meshName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ _field_pm_pt.clear();
+ for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
+ {
+ int nbProfile=MEDfield23nProfile(fid,getName().c_str(),getIteration(),getOrder(),MED_CELL,typmai[i],_mesh_csit,meshName,pflName,locName);
+ if(nbProfile>0)
+ {
+ _field_pm_pt.resize(_field_pm_pt.size()+1);
+ _field_pm_pt.back()=MEDFileFieldPerMeshPerType::New(this,typmai2[i]);
+ _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1);
+ _field_pm_pt.back()->finishLoading(fid,ON_CELLS);
+ }
+ nbProfile=MEDfield23nProfile(fid,getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[i],_mesh_csit,meshName,pflName,locName);
+ if(nbProfile>0)
+ {
+ _field_pm_pt.resize(_field_pm_pt.size()+1);
+ _field_pm_pt.back()=MEDFileFieldPerMeshPerType::New(this,typmai2[i]);
+ _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1);
+ _field_pm_pt.back()->finishLoading(fid,ON_GAUSS_NE);
+ }
+ }
+ int nbProfile=MEDfield23nProfile(fid,getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,_mesh_csit,meshName,pflName,locName);
+ if(nbProfile>0)
+ {
+ _field_pm_pt.resize(_field_pm_pt.size()+1);
+ _field_pm_pt.back()=MEDFileFieldPerMeshPerType::New(this,INTERP_KERNEL::NORM_ERROR);
+ _mesh_name=MEDLoaderBase::buildStringFromFortran(meshName,MED_NAME_SIZE+1);
+ _field_pm_pt.back()->finishLoading(fid,ON_NODES);
+ }
+}
+
+void MEDFileFieldPerMesh::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTypes=_field_pm_pt.size();
+ for(int i=0;i<nbOfTypes;i++)
+ {
+ _field_pm_pt[i]->copyOptionsFrom(*this);
+ _field_pm_pt[i]->writeLL(fid);
+ }
+}
+
+void MEDFileFieldPerMesh::getDimension(int& dim) const
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->getDimension(dim);
+}
+
+double MEDFileFieldPerMesh::getTime() const
+{
+ return _father->getTime();
+}
+
+int MEDFileFieldPerMesh::getIteration() const
+{
+ return _father->getIteration();
+}
+
+const std::string& MEDFileFieldPerMesh::getDtUnit() const
+{
+ return _father->getDtUnit();
+}
+
+int MEDFileFieldPerMesh::getOrder() const
+{
+ return _father->getOrder();
+}
+
+std::string MEDFileFieldPerMesh::getName() const
+{
+ return _father->getName();
+}
+
+int MEDFileFieldPerMesh::getNumberOfComponents() const
+{
+ return _father->getNumberOfComponents();
+}
+
+const std::vector<std::string>& MEDFileFieldPerMesh::getInfo() const
+{
+ return _father->getInfo();
+}
+
+/*!
+ * type,geoTypes,dads,pfls,locs are input parameters. They should have the same size.
+ * Before the call of this method 'geoTypes','dads','pfls','locs' must be reorganized so that types in geoTypes are contiguous and ordered following typmai2 array.
+ * It returns 2 output vectors :
+ * - 'code' of size 3*sz where sz is the number of different values into 'geoTypes'
+ * - 'notNullPfls' contains sz2 values that are extracted from 'pfls' in which null profiles have been removed.
+ * 'code' and 'notNullPfls' are in MEDCouplingUMesh::checkTypeConsistencyAndContig format.
+ */
+void MEDFileFieldPerMesh::SortArraysPerType(const MEDFieldFieldGlobsReal *glob, TypeOfField type, const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector<const DataArrayDouble *>& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs, std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls)
+{
+ int notNullPflsSz=0;
+ int nbOfArrs=geoTypes.size();
+ for(int i=0;i<nbOfArrs;i++)
+ if(pfls[i])
+ notNullPflsSz++;
+ std::set<INTERP_KERNEL::NormalizedCellType> geoTypes3(geoTypes.begin(),geoTypes.end());
+ int nbOfDiffGeoTypes=geoTypes3.size();
+ code.resize(3*nbOfDiffGeoTypes);
+ notNullPfls.resize(notNullPflsSz);
+ notNullPflsSz=0;
+ int j=0;
+ for(int i=0;i<nbOfDiffGeoTypes;i++)
+ {
+ int startZone=j;
+ INTERP_KERNEL::NormalizedCellType refType=geoTypes[j];
+ std::vector<const DataArrayInt *> notNullTmp;
+ if(pfls[j])
+ notNullTmp.push_back(pfls[j]);
+ j++;
+ for(;j<nbOfArrs;j++)
+ if(geoTypes[j]==refType)
+ {
+ if(pfls[j])
+ notNullTmp.push_back(pfls[j]);
+ }
+ else
+ break;
+ std::vector<const DataArrayDouble *> tmpDads(dads.begin()+startZone,dads.begin()+j);
+ std::vector<const DataArrayInt *> tmpPfls(pfls.begin()+startZone,pfls.begin()+j);
+ std::vector<int> tmpLocs(locs.begin()+startZone,locs.begin()+j);
+ code[3*i]=(int)refType;
+ code[3*i+1]=ComputeNbOfElems(glob,type,refType,tmpDads,tmpLocs);
+ if(notNullTmp.empty())
+ code[3*i+2]=-1;
+ else
+ {
+ notNullPfls[notNullPflsSz]=DataArrayInt::Aggregate(notNullTmp);
+ code[3*i+2]=notNullPflsSz++;
+ }
+ }
+}
+
+/*!
+ * 'dads' and 'locs' are input parameters that should have same size sz. sz should be >=1.
+ */
+int MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFieldFieldGlobsReal *glob, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<const DataArrayDouble *>& dads, const std::vector<int>& locs) throw(INTERP_KERNEL::Exception)
+{
+ int sz=dads.size();
+ int ret=0;
+ for(int i=0;i<sz;i++)
+ {
+ if(locs[i]==-1)
+ {
+ if(type!=ON_GAUSS_NE)
+ ret+=dads[i]->getNumberOfTuples();
+ else
+ {
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(geoType);
+ ret+=dads[i]->getNumberOfTuples()/cm.getNumberOfNodes();
+ }
+ }
+ else
+ {
+ int nbOfGaussPtPerCell=glob->getNbOfGaussPtPerCell(locs[i]);
+ ret+=dads[i]->getNumberOfTuples()/nbOfGaussPtPerCell;
+ }
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileFieldPerMesh::getPflsReallyUsed() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsed();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileFieldPerMesh::getLocsReallyUsed() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsed();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField type, const MEDFieldFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception)
+{
+ if(_field_pm_pt.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !");
+ //
+ std::vector<const DataArrayDouble *> dads;
+ std::vector<const DataArrayInt *> pfls;
+ std::vector<DataArrayInt *> notNullPflsPerGeoType;
+ std::vector<int> locs,code;
+ std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
+ // Sort by types
+ SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType);
+ if(code.empty())
+ {
+ std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevel : " << "The field \"" << getName() << "\" exists but not with such spatial discretization or such dimension specified !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ //
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ if(type!=ON_NODES)
+ {
+ DataArrayInt *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
+ if(!arr)
+ return finishField(type,glob,dads,locs,mesh,isPfl);
+ else
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2(arr);
+ return finishField2(type,glob,dads,locs,mesh,arr,isPfl);
+ }
+ }
+ else
+ {
+ if(code.size()!=3)
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !");
+ int nb=code[1];
+ if(code[2]==-1)
+ {
+ if(nb!=mesh->getNumberOfNodes())
+ {
+ std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevel : There is a problem there is " << nb << " nodes in field whereas there is " << mesh->getNumberOfNodes();
+ oss << " nodes in mesh !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return finishField(type,glob,dads,locs,mesh,isPfl);
+ }
+ else
+ return finishField3(glob,dads,locs,mesh,notNullPflsPerGeoType3[0],isPfl);
+ }
+}
+
+DataArrayDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFieldFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception)
+{
+ if(_field_pm_pt.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !");
+ //
+ std::vector<const DataArrayDouble *> dads;
+ std::vector<const DataArrayInt *> pfls;
+ std::vector<DataArrayInt *> notNullPflsPerGeoType;
+ std::vector<int> locs,code;
+ std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes);
+ // Sort by types
+ SortArraysPerType(glob,type,geoTypes,dads,pfls,locs,code,notNullPflsPerGeoType);
+ if(code.empty())
+ {
+ std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << getName() << "\" exists but not with such spatial discretization or such dimension specified !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end());
+ if(type!=ON_NODES)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3);
+ return finishField4(dads,arr,mesh->getNumberOfCells(),pfl);
+ }
+ else
+ {
+ if(code.size()!=3)
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !");
+ int nb=code[1];
+ if(code[2]==-1)
+ {
+ if(nb!=mesh->getNumberOfNodes())
+ {
+ std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevel : There is a problem there is " << nb << " nodes in field whereas there is " << mesh->getNumberOfNodes();
+ oss << " nodes in mesh !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return finishField4(dads,code[2]==-1?0:notNullPflsPerGeoType3[0],mesh->getNumberOfNodes(),pfl);
+ }
+ //
+ return 0;
+}
+
+int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type)
+{
+ int i=0;
+ int pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type));
+ std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it2=_field_pm_pt.begin();
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++)
+ {
+ INTERP_KERNEL::NormalizedCellType curType=(*it)->getGeoType();
+ if(type==curType)
+ return i;
+ else
+ {
+ int pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType));
+ if(pos>pos2)
+ it2=it+1;
+ }
+ }
+ int ret=std::distance(_field_pm_pt.begin(),it2);
+ _field_pm_pt.insert(it2,MEDFileFieldPerMeshPerType::New(this,type));
+ return ret;
+}
+
+MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFieldFieldGlobsReal *glob,
+ const std::vector<const DataArrayDouble *>& dads, const std::vector<int>& locs,
+ const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception)
+{
+ isPfl=false;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(type,ONE_TIME);
+ ret->setMesh(mesh); ret->setName(getName().c_str()); ret->setTime(getTime(),getIteration(),getOrder()); ret->setTimeUnit(getDtUnit().c_str());
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> da=DataArrayDouble::Aggregate(dads);
+ const std::vector<std::string>& infos=getInfo();
+ int nbOfComp=infos.size();
+ for(int i=0;i<nbOfComp;i++)
+ da->setInfoOnComponent(i,infos[i].c_str());
+ ret->setArray(da);
+ if(type==ON_GAUSS_PT)
+ {
+ int offset=0;
+ int nbOfArrs=dads.size();
+ for(int i=0;i<nbOfArrs;i++)
+ {
+ std::vector<const DataArrayDouble *> dads2(1,dads[i]); const std::vector<int> locs2(1,locs[i]);
+ int nbOfElems=ComputeNbOfElems(glob,type,INTERP_KERNEL::NORM_ERROR,dads2,locs2);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> di=DataArrayInt::New();
+ di->alloc(nbOfElems,1);
+ di->iota(offset);
+ const MEDFileFieldLoc& fl=glob->getLocalizationFromId(locs[i]);
+ ret->setGaussLocalizationOnCells(di->getConstPointer(),di->getConstPointer()+nbOfElems,fl.getRefCoords(),fl.getGaussCoords(),fl.getGaussWeights());
+ offset+=nbOfElems;
+ }
+ }
+ //
+ ret->incrRef();
+ return ret;
+}
+
+/*!
+ * This method is an extension of MEDFileFieldPerMesh::finishField method. It deals with profiles. This method should be called when type is different from ON_NODES.
+ * No check of this is performed. 'da' array contains an array in old2New style to be applyied to mesh to obtain the right support.
+ * The order of cells in the returned field is those imposed by the profile.
+ */
+MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFieldFieldGlobsReal *glob,
+ const std::vector<const DataArrayDouble *>& dads, const std::vector<int>& locs,
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception)
+{
+ if(da->isIdentity())
+ {
+ int nbOfTuples=da->getNumberOfTuples();
+ if(nbOfTuples==ComputeNbOfElems(glob,type,INTERP_KERNEL::NORM_ERROR,dads,locs))//No problem for NORM_ERROR because it is in context of node
+ return finishField(type,glob,dads,locs,mesh,isPfl);
+ }
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(type,glob,dads,locs,mesh,isPfl);
+ isPfl=true;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m2=mesh->buildPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
+ m2->setName(mesh->getName());
+ ret->setMesh(m2);
+ ret->incrRef();
+ return ret;
+}
+
+/*!
+ * This method is the complement of MEDFileFieldPerMesh::finishField2 method except that this method works for node profiles.
+ */
+MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField3(const MEDFieldFieldGlobsReal *glob,
+ const std::vector<const DataArrayDouble *>& dads, const std::vector<int>& locs,
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception)
+{
+ if(da->isIdentity())
+ {
+ int nbOfTuples=da->getNumberOfTuples();
+ if(nbOfTuples==ComputeNbOfElems(glob,ON_NODES,INTERP_KERNEL::NORM_ERROR,dads,locs))//No problem for NORM_ERROR because it is in context of node
+ return finishField(ON_NODES,glob,dads,locs,mesh,isPfl);
+ }
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl);
+ isPfl=true;
+ DataArrayInt *arr2=0;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr3(arr2);
+ int nnodes=mesh2->getNumberOfNodes();
+ if(nnodes==da->getNbOfElems())
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=da->transformWithIndArrR(arr2->getConstPointer(),arr2->getConstPointer()+arr2->getNbOfElems());
+ ret->getArray()->renumberInPlace(da3->getConstPointer());
+ mesh2->setName(mesh->getName());
+ ret->setMesh(mesh2);
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::finishField3 : not implemented yet !");
+ return 0;
+}
+
+/*!
+ * This method is the most light method of field retrieving.
+ */
+DataArrayDouble *MEDFileFieldPerMesh::finishField4(const std::vector<const DataArrayDouble *>& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const throw(INTERP_KERNEL::Exception)
+{
+ if(!pflIn)
+ {
+ pflOut=DataArrayInt::New();
+ pflOut->alloc(nbOfElems,1);
+ pflOut->iota(0);
+ }
+ else
+ {
+ pflOut=const_cast<DataArrayInt*>(pflIn);
+ pflOut->incrRef();
+ }
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> safePfl(pflOut);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> da=DataArrayDouble::Aggregate(dads);
+ const std::vector<std::string>& infos=getInfo();
+ int nbOfComp=infos.size();
+ for(int i=0;i<nbOfComp;i++)
+ da->setInfoOnComponent(i,infos[i].c_str());
+ safePfl->incrRef();
+ da->incrRef();
+ return da;
+}
+
+MEDFileFieldPerMesh::MEDFileFieldPerMesh(MEDFileField1TSWithoutDAS *fath, int meshCsit, int meshIteration, int meshOrder):_mesh_iteration(meshIteration),_mesh_order(meshOrder),
+ _mesh_csit(meshCsit),_father(fath)
+{
+}
+
+MEDFileFieldPerMesh::MEDFileFieldPerMesh(MEDFileField1TSWithoutDAS *fath, const MEDCouplingMesh *mesh):_father(fath)
+{
+ copyTinyInfoFrom(mesh);
+}
+
+void MEDFieldFieldGlobs::loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception)
+{
+ if(id>=(int)_pfls.size())
+ _pfls.resize(id+1);
+ _pfls[id]=DataArrayInt::New();
+ int lgth=MEDprofileSizeByName(fid,pflName);
+ _pfls[id]->setName(pflName);
+ _pfls[id]->alloc(lgth,1);
+ MEDprofileRd(fid,pflName,_pfls[id]->getPointer());
+ _pfls[id]->applyLin(1,-1,0);//Converting into C format
+}
+
+void MEDFieldFieldGlobs::loadProfileInFile(med_idt fid, int i)
+{
+ INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ int sz;
+ MEDprofileInfo(fid,i+1,pflName,&sz);
+ std::string pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE);
+ if(i>=(int)_pfls.size())
+ _pfls.resize(i+1);
+ _pfls[i]=DataArrayInt::New();
+ _pfls[i]->alloc(sz,1);
+ _pfls[i]->setName(pflCpp.c_str());
+ MEDprofileRd(fid,pflName,_pfls[i]->getPointer());
+}
+
+void MEDFieldFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) const throw(INTERP_KERNEL::Exception)
+{
+ int nbOfPfls=_pfls.size();
+ for(int i=0;i<nbOfPfls;i++)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cpy=_pfls[i]->deepCpy();
+ cpy->applyLin(1,1,0);
+ INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy());
+ MEDprofileWr(fid,pflName,_pfls[i]->getNumberOfTuples(),cpy->getConstPointer());
+ }
+ //
+ int nbOfLocs=_locs.size();
+ for(int i=0;i<nbOfLocs;i++)
+ _locs[i]->writeLL(fid);
+}
+
+void MEDFieldFieldGlobs::loadGlobals(med_idt fid, const MEDFieldFieldGlobsReal& real) throw(INTERP_KERNEL::Exception)
+{
+ std::vector<std::string> profiles=real.getPflsReallyUsed();
+ int sz=profiles.size();
+ _pfls.resize(sz);
+ for(int i=0;i<sz;i++)
+ loadProfileInFile(fid,i,profiles[i].c_str());
+ //
+ std::vector<std::string> locs=real.getLocsReallyUsed();
+ sz=locs.size();
+ _locs.resize(sz);
+ for(int i=0;i<sz;i++)
+ _locs[i]=MEDFileFieldLoc::New(fid,locs[i].c_str());
+}
+
+MEDFieldFieldGlobs *MEDFieldFieldGlobs::New(const char *fname)
+{
+ return new MEDFieldFieldGlobs(fname);
+}
+
+MEDFieldFieldGlobs *MEDFieldFieldGlobs::New()
+{
+ return new MEDFieldFieldGlobs;
+}
+
+MEDFieldFieldGlobs::MEDFieldFieldGlobs(const char *fname):_file_name(fname)
+{
+}
+
+MEDFieldFieldGlobs::MEDFieldFieldGlobs()
+{
+}
+
+MEDFieldFieldGlobs::~MEDFieldFieldGlobs()
+{
+}
+
+void MEDFieldFieldGlobs::setFileName(const char *fileName)
+{
+ _file_name=fileName;
+}
+
+int MEDFieldFieldGlobs::getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception)
+{
+ if(locId<0 || locId>=(int)_locs.size())
+ throw INTERP_KERNEL::Exception("MEDFieldFieldGlobs::getNbOfGaussPtPerCell : Invalid localization id !");
+ return _locs[locId]->getNbOfGaussPtPerCell();
+}
+
+const MEDFileFieldLoc& MEDFieldFieldGlobs::getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
+{
+ if(locId<0 || locId>=(int)_locs.size())
+ throw INTERP_KERNEL::Exception("MEDFieldFieldGlobs::getLocalizationFromId : Invalid localization id !");
+ return *_locs[locId];
+}
+
+namespace ParaMEDMEMImpl
+{
+ class LocFinder
+ {
+ public:
+ LocFinder(const char *loc):_loc(loc) { }
+ bool operator() (const MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc>& loc) { return loc->isName(_loc); }
+ private:
+ const char *_loc;
+ };
+
+ class PflFinder
+ {
+ public:
+ PflFinder(const std::string& pfl):_pfl(pfl) { }
+ bool operator() (const MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& pfl) { return _pfl==pfl->getName(); }
+ private:
+ const std::string& _pfl;
+ };
+}
+
+int MEDFieldFieldGlobs::getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception)
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),ParaMEDMEMImpl::LocFinder(loc));
+ if(it==_locs.end())
+ {
+ std::ostringstream oss; oss << "MEDFieldFieldGlobs::getLocalisationId : no such localisation name : \"" << loc << "\" Possible localizations are : ";
+ for(it=_locs.begin();it!=_locs.end();it++)
+ oss << "\"" << (*it)->getName() << "\", ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return std::distance(_locs.begin(),it);
+}
+
+const DataArrayInt *MEDFieldFieldGlobs::getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception)
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflName));
+ if(it==_pfls.end())
+ {
+ std::ostringstream oss; oss << "MEDFieldFieldGlobs::getProfile: no such profile name : \"" << pflName << "\" Possible profiles are : ";
+ for(it=_pfls.begin();it!=_pfls.end();it++)
+ oss << "\"" << (*it)->getName() << "\", ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return *it;
+}
+
+std::vector<std::string> MEDFieldFieldGlobs::getPfls() const
+{
+ int sz=_pfls.size();
+ std::vector<std::string> ret(sz);
+ for(int i=0;i<sz;i++)
+ ret[i]=_pfls[i]->getName();
+ return ret;
+}
+
+std::vector<std::string> MEDFieldFieldGlobs::getLocs() const
+{
+ int sz=_locs.size();
+ std::vector<std::string> ret(sz);
+ for(int i=0;i<sz;i++)
+ ret[i]=_locs[i]->getName();
+ return ret;
+}
+
+void MEDFieldFieldGlobs::appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception)
+{
+ std::string name(pfl->getName());
+ if(name.empty())
+ throw INTERP_KERNEL::Exception("MEDFieldFieldGlobs::appendProfile : unsupported profiles with no name !");
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++)
+ if(name==(*it)->getName())
+ {
+ if(!pfl->isEqual(*(*it)))
+ {
+ std::ostringstream oss; oss << "MEDFieldFieldGlobs::appendProfile : profile \"" << name << "\" already exists and is different from existing !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ pfl->incrRef();
+ _pfls.push_back(pfl);
+}
+
+void MEDFieldFieldGlobs::appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception)
+{
+ std::string name(locName);
+ if(name.empty())
+ throw INTERP_KERNEL::Exception("MEDFieldFieldGlobs::appendLoc : unsupported localizations with no name !");
+ MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> obj=MEDFileFieldLoc::New(locName,geoType,refCoo,gsCoo,w);
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++)
+ if((*it)->isName(locName))
+ {
+ if(!(*it)->isEqual(*obj,1e-12))
+ {
+ std::ostringstream oss; oss << "MEDFieldFieldGlobs::appendLoc : localization \"" << name << "\" already exists and is different from existing !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ _locs.push_back(obj);
+}
+
+MEDFieldFieldGlobsReal::MEDFieldFieldGlobsReal(const char *fname):_globals(MEDFieldFieldGlobs::New(fname))
+{
+}
+
+MEDFieldFieldGlobsReal::MEDFieldFieldGlobsReal():_globals(MEDFieldFieldGlobs::New())
+{
+}
+
+void MEDFieldFieldGlobsReal::shallowCpyGlobs(const MEDFieldFieldGlobsReal& other)
+{
+ _globals=other._globals;
+}
+
+void MEDFieldFieldGlobsReal::loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception)
+{
+ _globals->loadProfileInFile(fid,id,pflName);
+}
+
+void MEDFieldFieldGlobsReal::loadProfileInFile(med_idt fid, int id)
+{
+ _globals->loadProfileInFile(fid,id);
+}
+
+void MEDFieldFieldGlobsReal::loadGlobals(med_idt fid) throw(INTERP_KERNEL::Exception)
+{
+ _globals->loadGlobals(fid,*this);
+}
+
+void MEDFieldFieldGlobsReal::writeGlobals(med_idt fid, const MEDFileWritable& opt) const throw(INTERP_KERNEL::Exception)
+{
+ _globals->writeGlobals(fid,opt);
+}
+
+std::vector<std::string> MEDFieldFieldGlobsReal::getPfls() const
+{
+ return _globals->getPfls();
+}
+
+std::vector<std::string> MEDFieldFieldGlobsReal::getLocs() const
+{
+ return _globals->getLocs();
+}
+
+void MEDFieldFieldGlobsReal::setFileName(const char *fileName)
+{
+ _globals->setFileName(fileName);
+}
+
+int MEDFieldFieldGlobsReal::getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception)
+{
+ return _globals->getNbOfGaussPtPerCell(locId);
+}
+
+int MEDFieldFieldGlobsReal::getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception)
+{
+ return _globals->getLocalizationId(loc);
+}
+
+const char *MEDFieldFieldGlobsReal::getFileName() const
+{
+ return _globals->getFileName();
+}
+
+std::string MEDFieldFieldGlobsReal::getFileName2() const
+{
+ return _globals->getFileName2();
+}
+
+const MEDFileFieldLoc& MEDFieldFieldGlobsReal::getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
+{
+ return _globals->getLocalizationFromId(locId);
+}
+
+const DataArrayInt *MEDFieldFieldGlobsReal::getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception)
+{
+ return _globals->getProfile(pflName);
+}
+
+void MEDFieldFieldGlobsReal::appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception)
+{
+ _globals->appendProfile(pfl);
+}
+
+void MEDFieldFieldGlobsReal::appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception)
+{
+ _globals->appendLoc(locName,geoType,refCoo,gsCoo,w);
+}
+
+/*!
+ * This method returns the max dimension of 'this'.
+ * This method returns -2 if 'this' is empty, -1 if only nodes are defined.
+ */
+int MEDFileField1TSWithoutDAS::getDimension() const
+{
+ int ret=-2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->getDimension(ret);
+ return ret;
+}
+
+void MEDFileField1TSWithoutDAS::CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception)
+{
+ if(meshDimRelToMax>0)
+ throw INTERP_KERNEL::Exception("CheckMeshDimRel : This is a meshDimRel not a meshDimRelExt ! So value should be <=0 !");
+}
+
+std::vector<int> MEDFileField1TSWithoutDAS::CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception)
+{
+ //
+ std::set<INTERP_KERNEL::NormalizedCellType> geoTypes=mesh->getAllGeoTypes();
+ int nbOfTypes=geoTypes.size();
+ std::vector<int> code(3*nbOfTypes);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr1=DataArrayInt::New();
+ arr1->alloc(nbOfTypes,1);
+ int *arrPtr=arr1->getPointer();
+ std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=geoTypes.begin();
+ for(int i=0;i<nbOfTypes;i++,it++)
+ arrPtr[i]=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,*it));
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2=arr1->checkAndPreparePermutation();
+ const int *arrPtr2=arr2->getConstPointer();
+ int i=0;
+ for(it=geoTypes.begin();it!=geoTypes.end();it++,i++)
+ {
+ int pos=arrPtr2[i];
+ int nbCells=mesh->getNumberOfCellsWithType(*it);
+ code[3*pos]=(int)(*it);
+ code[3*pos+1]=nbCells;
+ code[3*pos+2]=-1;//no profiles
+ }
+ std::vector<const DataArrayInt *> idsPerType;//no profiles
+ DataArrayInt *da=mesh->checkTypeConsistencyAndContig(code,idsPerType);
+ if(da)
+ {
+ da->decrRef();
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::CheckSBTMesh : underlying mesh is not sorted by type as MED file expects !");
+ }
+ return code;
+}
+
+MEDFileField1TSWithoutDAS *MEDFileField1TSWithoutDAS::New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos)
+{
+ return new MEDFileField1TSWithoutDAS(fieldName,csit,iteration,order,infos);
+}
+
+void MEDFileField1TSWithoutDAS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
+{
+ _name=field->getName();
+ if(_name.empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::copyTinyInfoFrom : unsupported fields with no name in MED file !");
+ const DataArrayDouble *arr=field->getArray();
+ if(!arr)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::copyTinyInfoFrom : no array set !");
+ _dt=field->getTime(_iteration,_order);
+ _infos=arr->getInfoOnComponent();
+}
+
+std::string MEDFileField1TSWithoutDAS::getMeshName() const throw(INTERP_KERNEL::Exception)
+{
+ if(_field_per_mesh.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::getMeshName : No field set !");
+ return _field_per_mesh[0]->getMeshName();
+}
+
+int MEDFileField1TSWithoutDAS::getMeshIteration() const throw(INTERP_KERNEL::Exception)
+{
+ if(_field_per_mesh.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::getMeshIteration : No field set !");
+ return _field_per_mesh[0]->getMeshIteration();
+}
+
+int MEDFileField1TSWithoutDAS::getMeshOrder() const throw(INTERP_KERNEL::Exception)
+{
+ if(_field_per_mesh.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::getMeshOrder : No field set !");
+ return _field_per_mesh[0]->getMeshOrder();
+}
+
+bool MEDFileField1TSWithoutDAS::isDealingTS(int iteration, int order) const
+{
+ return iteration==_iteration && order==_order;
+}
+
+std::pair<int,int> MEDFileField1TSWithoutDAS::getDtIt() const
+{
+ std::pair<int,int> p;
+ fillIteration(p);
+ return p;
+}
+
+void MEDFileField1TSWithoutDAS::fillIteration(std::pair<int,int>& p) const
+{
+ p.first=_iteration;
+ p.second=_order;
+}
+
+void MEDFileField1TSWithoutDAS::finishLoading(med_idt fid) throw(INTERP_KERNEL::Exception)
+{
+ med_int numdt,numit;
+ med_float dt;
+ med_int nmesh;
+ med_bool localMesh;
+ med_int meshnumdt,meshnumit;
+ INTERP_KERNEL::AutoPtr<char> meshName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDfieldComputingStepInfo(fid,_name.c_str(),_csit,&numdt,&numit,&_dt);
+ MEDfield23ComputingStepMeshInfo(fid,_name.c_str(),_csit,&numdt,&numit,&dt,&nmesh,meshName,&localMesh,&meshnumdt,&meshnumit);
+ if(_iteration!=numdt || _order!=numit)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::finishLoading : unexpected exception internal error !");
+ _field_per_mesh.resize(nmesh);
+ for(int i=0;i<nmesh;i++)
+ _field_per_mesh[i]=MEDFileFieldPerMesh::New(this,i+1,meshnumdt,meshnumit);
+ for(int i=0;i<nmesh;i++)
+ _field_per_mesh[i]->finishLoading(fid);
+}
+
+std::vector<std::string> MEDFileField1TSWithoutDAS::getPflsReallyUsed2() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsed();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileField1TSWithoutDAS::getLocsReallyUsed2() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsed();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+void MEDFileField1TSWithoutDAS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+{
+ if(_field_per_mesh.empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::writeLL : empty field !");
+ if(_field_per_mesh.size()>1)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::writeLL : In MED3.0 mode in writting mode only ONE underlying mesh supported !");
+ _field_per_mesh[0]->copyOptionsFrom(*this);
+ _field_per_mesh[0]->writeLL(fid);
+}
+
+/*!
+ * SBT means Sort By Type.
+ * This method is the most basic method to assign field in this. Basic in sense that no renumbering is done. Underlying mesh in 'field' is globaly ignored except for type contiguous check.
+ */
+void MEDFileField1TSWithoutDAS::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ const MEDCouplingMesh *mesh=field->getMesh();
+ //
+ TypeOfField type=field->getTypeOfField();
+ std::vector<DataArrayInt *> dummy;
+ copyTinyInfoFrom(field);
+ if(type!=ON_NODES)
+ {
+ std::vector<int> code=MEDFileField1TSWithoutDAS::CheckSBTMesh(mesh);
+ //
+ int pos=addNewEntryIfNecessary(mesh);
+ _field_per_mesh[pos]->assignFieldProfile(0,code,dummy,dummy,field,0,glob);//mesh is set to 0 because no external mesh is needed to be sent because no profile.
+ }
+ else
+ {
+ int pos=addNewEntryIfNecessary(mesh);
+ _field_per_mesh[pos]->assignNodeFieldNoProfile(field,glob);
+ }
+}
+
+/*!
+ * Generalization of MEDFileField1TSWithoutDAS::setFieldNoProfileSBT method.
+ */
+void MEDFileField1TSWithoutDAS::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception)
+{
+ TypeOfField type=field->getTypeOfField();
+ copyTinyInfoFrom(field);
+ std::vector<DataArrayInt *> idsInPflPerType;
+ std::vector<DataArrayInt *> idsPerType;
+ std::vector<int> code;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=mesh->getGenMeshAtLevel(meshDimRelToMax);
+ if(type!=ON_NODES)
+ {
+ m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType);
+ //
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsInPflPerType2(idsInPflPerType.size());
+ for(std::size_t i=0;i<idsInPflPerType.size();i++)
+ idsInPflPerType2[i]=idsInPflPerType[i];
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > idsPerType2(idsPerType.size());
+ for(std::size_t i=0;i<idsPerType.size();i++)
+ idsPerType2[i]=idsPerType[i];
+ //
+ int pos=addNewEntryIfNecessary(m);
+ _field_per_mesh[pos]->assignFieldProfile(profile,code,idsInPflPerType,idsPerType,field,m,glob);
+ }
+ else
+ {
+ int pos=addNewEntryIfNecessary(m);
+ _field_per_mesh[pos]->assignNodeFieldProfile(profile,field,glob);
+ }
+}
+
+MEDCouplingFieldDouble *MEDFileField1TSWithoutDAS::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFieldFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
+ if(mName==0)
+ mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder());
+ else
+ mm=MEDFileMesh::New(glob->getFileName(),mName,-1,-1);
+ return MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,glob,mm);
+}
+
+MEDCouplingFieldDouble *MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFieldFieldGlobsReal *glob, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
+{
+ CheckMeshDimRel(meshDimRelToMax);
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=mesh->getGenMeshAtLevel(meshDimRelToMax,false);
+ const DataArrayInt *d=mesh->getNumberFieldAtLevel(meshDimRelToMax);
+ const DataArrayInt *e=mesh->getNumberFieldAtLevel(1);
+ return MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e);
+}
+
+MEDCouplingFieldDouble *MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFieldFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum) const throw(INTERP_KERNEL::Exception)
+{
+ static const char msg1[]="MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !";
+ int meshId=getMeshIdFromMeshName(mesh->getName());
+ bool isPfl=false;
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl);
+ switch(renumPol)
+ {
+ case 0:
+ {
+ //no need to test _field_per_mesh.empty() because geMeshName has already done it
+ ret->incrRef();
+ return ret;
+ }
+ case 3:
+ case 1:
+ {
+ if(isPfl)
+ throw INTERP_KERNEL::Exception(msg1);
+ //no need to test _field_per_mesh.empty() because geMeshName has already done it
+ if(cellRenum)
+ {
+ if(cellRenum->getNbOfElems()!=mesh->getNumberOfCells())
+ {
+ std::ostringstream oss; oss << "MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel : Request of simple renumbering but it seems that underlying mesh \"" << mesh->getName() << "\" of requested field ";
+ oss << "\"" << getName() << "\" has partial renumbering (some geotype has no renumber) !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ ret->renumberCells(cellRenum->getConstPointer(),true);
+ }
+ if(renumPol==1)
+ {
+ ret->incrRef();
+ return ret;
+ }
+ }
+ case 2:
+ {
+ //no need to test _field_per_mesh.empty() because geMeshName has already done it
+ if(isPfl)
+ throw INTERP_KERNEL::Exception(msg1);
+ if(nodeRenum)
+ {
+ if(nodeRenum->getNbOfElems()!=mesh->getNumberOfNodes())
+ {
+ std::ostringstream oss; oss << "MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel : Request of simple renumbering but it seems that underlying mesh \"" << mesh->getName() << "\" of requested field ";
+ oss << "\"" << getName() << "\" not defined on all nodes !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodeRenumSafe=nodeRenum->checkAndPreparePermutation();
+ ret->renumberNodes(nodeRenumSafe->getConstPointer());
+ }
+ ret->incrRef();
+ return ret;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel : unsupported renum policy ! Dealing with policy 0 1 2 and 3 !");
+ }
+}
+
+DataArrayDouble *MEDFileField1TSWithoutDAS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFieldFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=mesh->getGenMeshAtLevel(meshDimRelToMax);
+ int meshId=getMeshIdFromMeshName(mesh->getName());
+ return _field_per_mesh[meshId]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob);
+}
+
+MEDFileField1TSWithoutDAS::MEDFileField1TSWithoutDAS(const char *fieldName, int csit, int iteration, int order,
+ const std::vector<std::string>& infos):_name(fieldName),_infos(infos),_csit(csit),_iteration(iteration),_order(order)
+{
+}
+
+MEDFileField1TSWithoutDAS::MEDFileField1TSWithoutDAS()
+{
+}
+
+int MEDFileField1TSWithoutDAS::addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception)
+{
+ std::string tmp(mesh->getName());
+ if(tmp.empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::addNewEntryIfNecessary : empty mesh name ! unsupported by MED file !");
+ std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();
+ int i=0;
+ for(;it!=_field_per_mesh.end();it++,i++)
+ {
+ if((*it)->getMeshName()==tmp)
+ return i;
+ }
+ int sz=_field_per_mesh.size();
+ _field_per_mesh.resize(sz+1);
+ _field_per_mesh[sz]=MEDFileFieldPerMesh::New(this,mesh);
+ return sz;
+}
+
+int MEDFileField1TSWithoutDAS::getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception)
+{
+ if(_field_per_mesh.empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::getMeshIdFromMeshName : No field set !");
+ std::string mName2(mName);
+ int ret=0;
+ std::vector<std::string> msg;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++,ret++)
+ if(mName2==(*it)->getMeshName())
+ return ret;
+ else
+ msg.push_back((*it)->getMeshName());
+ std::ostringstream oss; oss << "MEDFileField1TSWithoutDAS::getMeshIdFromMeshName : No such mesh \"" << mName2 << "\" as underlying mesh of field \"" << getName() << "\" !\n";
+ oss << "Possible meshes are : ";
+ for(std::vector<std::string>::const_iterator it2=msg.begin();it2!=msg.end();it2++)
+ oss << "\"" << (*it2) << "\" ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDFileField1TS(fileName,fieldName,iteration,order);
+}
+
+MEDFileField1TS *MEDFileField1TS::New()
+{
+ return new MEDFileField1TS;
+}
+
+void MEDFileField1TS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+{
+ med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+ int nbComp=_infos.size();
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
+ for(int i=0;i<nbComp;i++)
+ {
+ std::string info=_infos[i];
+ std::string c,u;
+ MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
+ MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);
+ MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);
+ }
+ if(_name.empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::write : MED file does not accept field with empty name !");
+ MEDfieldCr(fid,_name.c_str(),MED_FLOAT64,nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str());
+ writeGlobals(fid,*this);
+ writeLL(fid);
+}
+
+MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+try:MEDFileField1TSWithoutDAS(fieldName,-1,iteration,order,std::vector<std::string>()),MEDFieldFieldGlobsReal(fileName)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ int nbFields=MEDnField(fid);
+ med_field_type typcha;
+ bool found=false;
+ std::vector<std::string> fns(nbFields);
+ int nbOfStep2=-1;
+ for(int i=0;i<nbFields && !found;i++)
+ {
+ int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localMesh;
+ int nbOfStep;
+ MEDfieldInfo(fid,i+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
+ std::string tmp(nomcha);
+ fns[i]=tmp;
+ found=(tmp==fieldName);
+ if(found)
+ {
+ nbOfStep2=nbOfStep;
+ std::string mname=MEDLoaderBase::buildStringFromFortran(nomMaa,MED_NAME_SIZE);
+ _infos.resize(ncomp);
+ for(int j=0;j<ncomp;j++)
+ _infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
+ }
+ }
+ if(!found)
+ {
+ std::ostringstream oss; oss << "No such field '" << fieldName << "' in file '" << fileName << "' ! Available fields are : ";
+ std::copy(fns.begin(),fns.end(),std::ostream_iterator<std::string>(oss," "));
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ found=false;
+ std::vector< std::pair<int,int> > dtits(nbOfStep2);
+ for(int i=0;i<nbOfStep2 && !found;i++)
+ {
+ med_int numdt,numit;
+ med_float dt;
+ MEDfieldComputingStepInfo(fid,fieldName,i+1,&numdt,&numit,&dt);
+ if(numdt==iteration && numit==order)
+ {
+ found=true;
+ _csit=i+1;
+ }
+ else
+ dtits[i]=std::pair<int,int>(numdt,numit);
+ }
+ if(!found)
+ {
+ std::ostringstream oss; oss << "No such iteration (" << iteration << "," << order << ") in existing field '" << fieldName << "' in file '" << fileName << "' ! Available iterations are : ";
+ for(std::vector< std::pair<int,int> >::const_iterator iter=dtits.begin();iter!=dtits.end();iter++)
+ oss << "(" << (*iter).first << "," << (*iter).second << "), ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ finishLoading(fid);
+ //
+ loadGlobals(fid);
+}
+catch(INTERP_KERNEL::Exception& e)
+ {
+ throw e;
+ }
+
+MEDFileField1TS::MEDFileField1TS()
+{
+}
+
+std::vector<std::string> MEDFileField1TS::getPflsReallyUsed() const
+{
+ return getPflsReallyUsed2();
+}
+
+std::vector<std::string> MEDFileField1TS::getLocsReallyUsed() const
+{
+ return getLocsReallyUsed2();
+}
+
+/*!
+ * This method requests underlying file to perform the job, for mesh reading. If the current instance is not coming from a file and has been constructed from scratch
+ * an exception will be thrown. In this case you should use MEDFileField1TS::getFieldOnMeshAtLevel method instead.
+ * \b WARNING ! Parameter 'meshDimRelToMax' is relative from read mesh in file that can be different from the field in MED file !
+ * It leads that the returned field of this method is always coherent.
+ */
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+ if(getFileName2().empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
+ return MEDFileField1TSWithoutDAS::getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this);
+}
+
+/*!
+ * \b WARNING, there is a main difference with the two close methods (MEDFileField1TS::getFieldAtLevel and MEDFileField1TS::getFieldOnMeshAtLevel method) !
+ * Here the mesh-dimension of 'mesh' is used by this to automatically request the right geoTypes regarding 'type'.
+ * If no such element fufilled the deduced dimension and 'type' an exception will be thrown.
+ * It leads that the returned field of this method is always coherent.
+ */
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+ return MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0);
+}
+
+/*!
+ * This method can be called whatever the mode of instance feeding of this (MED file or from scratch).
+ * But the parameter ''meshDimRelToMax' is applyied on 'mesh' (like MEDFileField1TS::getFieldAtLevel does). \b WARNING the dim of 'this' can be different from those in 'mesh' !
+ * It leads that the returned field of this method is always coherent.
+ */
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+ return MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh);
+}
+
+/*!
+ * This method is identical to MEDFileField1TS::getFieldAtLevel method except that meshName 'mname' should be specified.
+ * This method is called "Old" because in MED3 norm a field has only one meshName attached. This method is only here for reader of MED2 files.
+ * See MEDFileField1TS::getFieldAtLevel for more information.
+ */
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+ if(getFileName2().empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
+ return MEDFileField1TSWithoutDAS::getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this);
+}
+
+DataArrayDouble *MEDFileField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception)
+{
+ return MEDFileField1TSWithoutDAS::getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this);
+}
+
+/*!
+ * SBT means Sort By Type.
+ * This method is the most basic method to assign field in this. Basic in sense that no renumbering is done. Underlying mesh in 'field' is globaly ignored except for type contiguous check.
+ *
+ */
+void MEDFileField1TS::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
+{
+ setFileName("");
+ MEDFileField1TSWithoutDAS::setFieldNoProfileSBT(field,*this);
+}
+
+/*!
+ * This method is a generalization of MEDFileField1TS::setFieldNoProfileSBT method. Here a profile array is given in input.
+ * The support of field 'field' is \b not used by this method, so it can be null or incoherent with field.
+ * This method uses input parameters 'mesh', 'meshDimRelToMax' and 'profile' to determine what is really the support of field 'field'. If field is incoherent regarding this deduced support,
+ * an exception will be thrown.
+ * This method is trying to reduce the size of MEDfile file so profile is created only if it is absolutely necessary. If it is necessary the name of 'profile' will be used to create it in 'this'.
+ * In this case, if this profile name is empty an exception will be thrown.
+ */
+void MEDFileField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception)
+{
+ setFileName("");
+ MEDFileField1TSWithoutDAS::setFieldProfile(field,mesh,meshDimRelToMax,profile,*this);
+}
+
+MEDFileFieldMultiTSWithoutDAS *MEDFileFieldMultiTSWithoutDAS::New(med_idt fid, const char *fieldName, int id, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDFileFieldMultiTSWithoutDAS(fid,fieldName,id,infos,nbOfStep);
+}
+
+MEDFileFieldMultiTSWithoutDAS::MEDFileFieldMultiTSWithoutDAS()
+{
+}
+
+MEDFileFieldMultiTSWithoutDAS::MEDFileFieldMultiTSWithoutDAS(const char *fieldName):_name(fieldName)
+{
+}
+
+MEDFileFieldMultiTSWithoutDAS::MEDFileFieldMultiTSWithoutDAS(med_idt fid, const char *fieldName, int id, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception)
+try:_name(fieldName),_infos(infos)
+{
+ finishLoading(fid,nbOfStep);
+}
+catch(INTERP_KERNEL::Exception& e)
+ {
+ throw e;
+ }
+
+const std::vector<std::string>& MEDFileFieldMultiTSWithoutDAS::getInfo() const throw(INTERP_KERNEL::Exception)
+{
+ if(_time_steps.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::getInfos : not time steps !");
+ return _time_steps[0]->getInfo();
+}
+
+std::string MEDFileFieldMultiTSWithoutDAS::getMeshName() const throw(INTERP_KERNEL::Exception)
+{
+ if(_time_steps.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::getMeshName : not time steps !");
+ return _time_steps[0]->getMeshName();
+}
+
+std::string MEDFileFieldMultiTSWithoutDAS::getDtUnit() const throw(INTERP_KERNEL::Exception)
+{
+ if(_time_steps.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::getMeshName : not time steps !");
+ return _time_steps[0]->getDtUnit();
+}
+
+std::string MEDFileFieldMultiTSWithoutDAS::getName() const
+{
+ return _name;
+}
+
+std::vector< std::pair<int,int> > MEDFileFieldMultiTSWithoutDAS::getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception)
+{
+ std::size_t sz=_time_steps.size();
+ std::vector< std::pair<int,int> > ret(sz);
+ ret1.resize(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ const MEDFileField1TSWithoutDAS *f1ts=_time_steps[i];
+ if(f1ts)
+ {
+ ret[i].first=f1ts->getIteration();
+ ret[i].second=f1ts->getOrder();
+ ret1[i]=f1ts->getTime();
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutDAS::getTimeSteps : At rank #" << i << " time step is not defined !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return ret;
+}
+
+void MEDFileFieldMultiTSWithoutDAS::finishLoading(med_idt fid, int nbPdt) throw(INTERP_KERNEL::Exception)
+{
+ _time_steps.resize(nbPdt);
+ for(int i=0;i<nbPdt;i++)
+ {
+ std::vector< std::pair<int,int> > ts;
+ med_int numdt=0,numo=0;
+ med_int meshIt=0,meshOrder=0;
+ med_float dt=0.0;
+ MEDfieldComputingStepMeshInfo(fid,_name.c_str(),i+1,&numdt,&numo,&dt,&meshIt,&meshOrder);
+ _time_steps[i]=MEDFileField1TSWithoutDAS::New(_name.c_str(),i+1,numdt,numo,_infos);
+ _time_steps[i]->finishLoading(fid);
+ }
+}
+
+void MEDFileFieldMultiTSWithoutDAS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
+{
+ _name=field->getName();
+ if(_name.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::copyTinyInfoFrom : unsupported fields with no name in MED file !");
+ const DataArrayDouble *arr=field->getArray();
+ if(!arr)
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::copyTinyInfoFrom : no array set !");
+ _infos=arr->getInfoOnComponent();
+}
+
+void MEDFileFieldMultiTSWithoutDAS::checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field) const throw(INTERP_KERNEL::Exception)
+{
+ static const char MSG[]="MEDFileFieldMultiTSWithoutDAS::checkCoherencyOfTinyInfo : invalid ";
+ if(_name!=field->getName())
+ {
+ std::ostringstream oss; oss << MSG << "name ! should be \"" << _name;
+ oss << "\" and it is set in input field to \"" << field->getName() << "\" !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ const DataArrayDouble *arr=field->getArray();
+ if(!arr)
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::checkCoherencyOfTinyInfo : no array set !");
+ if(_infos!=arr->getInfoOnComponent())
+ {
+ std::ostringstream oss; oss << MSG << "components ! should be \"";
+ std::copy(_infos.begin(),_infos.end(),std::ostream_iterator<std::string>(oss,", "));
+ oss << " But compo in input fields are : ";
+ std::vector<std::string> tmp=arr->getInfoOnComponent();
+ std::copy(tmp.begin(),tmp.end(),std::ostream_iterator<std::string>(oss,", "));
+ oss << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+void MEDFileFieldMultiTSWithoutDAS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+{
+ if(_time_steps.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::writeLL : no time steps set !");
+ std::vector<std::string> infos(getInfo());
+ int nbComp=infos.size();
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
+ for(int i=0;i<nbComp;i++)
+ {
+ std::string info=infos[i];
+ std::string c,u;
+ MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
+ MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);
+ MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);
+ }
+ if(_name.empty())
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::write : MED file does not accept field with empty name !");
+ MEDfieldCr(fid,_name.c_str(),MED_FLOAT64,nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str());
+ int nbOfTS=_time_steps.size();
+ for(int i=0;i<nbOfTS;i++)
+ {
+ _time_steps[i]->copyOptionsFrom(*this);
+ _time_steps[i]->writeLL(fid);
+ }
+}
+
+int MEDFileFieldMultiTSWithoutDAS::getNumberOfTS() const
+{
+ return _time_steps.size();
+}
+
+std::vector< std::pair<int,int> > MEDFileFieldMultiTSWithoutDAS::getIterations() const
+{
+ int lgth=_time_steps.size();
+ std::vector< std::pair<int,int> > ret(lgth);
+ for(int i=0;i<lgth;i++)
+ _time_steps[i]->fillIteration(ret[i]);
+ return ret;
+}
+
+const MEDFileField1TSWithoutDAS& MEDFileFieldMultiTSWithoutDAS::getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutDAS> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it)->isDealingTS(iteration,order))
+ return *(*it);
+ std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepEntry : Muli timestep field on time (" << iteration << "," << order << ") does not exist ! Available (iteration,order) are :\n";
+ std::vector< std::pair<int,int> > vp=getIterations();
+ for(std::vector< std::pair<int,int> >::const_iterator it2=vp.begin();it2!=vp.end();it2++)
+ oss << "(" << (*it2).first << "," << (*it2).second << ") ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+MEDFileField1TSWithoutDAS& MEDFileFieldMultiTSWithoutDAS::getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutDAS> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it)->isDealingTS(iteration,order))
+ return *(*it);
+ std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepEntry : Muli timestep field on time (" << iteration << "," << order << ") does not exist ! Available (iteration,order) are :\n";
+ std::vector< std::pair<int,int> > vp=getIterations();
+ for(std::vector< std::pair<int,int> >::const_iterator it2=vp.begin();it2!=vp.end();it2++)
+ oss << "(" << (*it2).first << "," << (*it2).second << ") ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+std::vector<std::string> MEDFileFieldMultiTSWithoutDAS::getPflsReallyUsed2() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutDAS > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileFieldMultiTSWithoutDAS::getLocsReallyUsed2() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutDAS > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+MEDFileFieldMultiTS *MEDFileFieldMultiTS::New()
+{
+ return new MEDFileFieldMultiTS;
+}
+
+MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDFileFieldMultiTS(fileName,fieldName);
+}
+
+MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const MEDFileFieldMultiTSWithoutDAS& other)
+{
+ return new MEDFileFieldMultiTS(other);
+}
+
+void MEDFileFieldMultiTS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+{
+ med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+ writeGlobals(fid,*this);
+ writeLL(fid);
+}
+
+/*!
+ * Performs the job than MEDFileField1TS::getFieldAtLevel except that (iteration,order) couple should be specified !
+ * If such couple does not exist an exception is thrown.
+ */
+MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+ const MEDFileField1TSWithoutDAS& myF1TS=getTimeStepEntry(iteration,order);
+ return myF1TS.getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this);
+}
+
+/*!
+ * Performs the job than MEDFileField1TS::getFieldOnMeshAtLevel except that (iteration,order) couple should be specified !
+ * If such couple does not exist an exception is thrown.
+ */
+MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+ const MEDFileField1TSWithoutDAS& myF1TS=getTimeStepEntry(iteration,order);
+ return myF1TS.getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh);
+}
+
+/*!
+ * Performs the job than MEDFileField1TS::getFieldOnMeshAtLevel except that (iteration,order) couple should be specified !
+ * If such couple does not exist an exception is thrown.
+ */
+MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+ const MEDFileField1TSWithoutDAS& myF1TS=getTimeStepEntry(iteration,order);
+ return myF1TS.getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0);
+}
+
+MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol) const throw(INTERP_KERNEL::Exception)
+{
+ const MEDFileField1TSWithoutDAS& myF1TS=getTimeStepEntry(iteration,order);
+ return myF1TS.getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this);
+}
+
+DataArrayDouble *MEDFileFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception)
+{
+ const MEDFileField1TSWithoutDAS& myF1TS=getTimeStepEntry(iteration,order);
+ return myF1TS.getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this);
+}
+
+void MEDFileFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
+{
+ if(_time_steps.empty())
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutDAS> obj=new MEDFileField1TSWithoutDAS;
+ obj->setFieldNoProfileSBT(field,*this);
+ copyTinyInfoFrom(field);
+ _time_steps.push_back(obj);
+ }
+ else
+ {
+ checkCoherencyOfTinyInfo(field);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutDAS> obj=new MEDFileField1TSWithoutDAS;
+ obj->setFieldNoProfileSBT(field,*this);
+ _time_steps.push_back(obj);
+ }
+}
+
+void MEDFileFieldMultiTS::appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception)
+{
+ if(_time_steps.empty())
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutDAS> obj=new MEDFileField1TSWithoutDAS;
+ obj->setFieldProfile(field,mesh,meshDimRelToMax,profile,*this);
+ copyTinyInfoFrom(field);
+ _time_steps.push_back(obj);
+ }
+ else
+ {
+ checkCoherencyOfTinyInfo(field);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutDAS> obj=new MEDFileField1TSWithoutDAS;
+ obj->setFieldProfile(field,mesh,meshDimRelToMax,profile,*this);
+ _time_steps.push_back(obj);
+ }
+}
+
+MEDFileFieldMultiTS::MEDFileFieldMultiTS()
+{
+}
+
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+try:MEDFileFieldMultiTSWithoutDAS(fieldName),MEDFieldFieldGlobsReal(fileName)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ int nbFields=MEDnField(fid);
+ med_field_type typcha;
+ bool found=false;
+ std::vector<std::string> fns(nbFields);
+ int nbstep2=-1;
+ for(int i=0;i<nbFields && !found;i++)
+ {
+ int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localMesh;
+ int nbOfStep;
+ MEDfieldInfo(fid,i+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
+ std::string tmp(nomcha);
+ fns[i]=tmp;
+ found=(tmp==fieldName);
+ if(found)
+ {
+ nbstep2=nbOfStep;
+ _infos.resize(ncomp);
+ for(int j=0;j<ncomp;j++)
+ _infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
+ }
+ }
+ if(!found)
+ {
+ std::ostringstream oss; oss << "No such field '" << fieldName << "' in file '" << fileName << "' ! Available fields are : ";
+ std::copy(fns.begin(),fns.end(),std::ostream_iterator<std::string>(oss," "));
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ finishLoading(fid,nbstep2);
+ loadGlobals(fid);
+}
+catch(INTERP_KERNEL::Exception& e)
+ {
+ throw e;
+ }
+
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutDAS& other):MEDFileFieldMultiTSWithoutDAS(other)
+{
+}
+
+std::vector<std::string> MEDFileFieldMultiTS::getPflsReallyUsed() const
+{
+ return getPflsReallyUsed2();
+}
+
+std::vector<std::string> MEDFileFieldMultiTS::getLocsReallyUsed() const
+{
+ return getLocsReallyUsed2();
+}
+
+MEDFileFields *MEDFileFields::New()
+{
+ return new MEDFileFields;
+}
+
+MEDFileFields *MEDFileFields::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDFileFields(fileName);
+}
+
+int MEDFileFields::getNumberOfFields() const
+{
+ return _fields.size();
+}
+
+std::vector<std::string> MEDFileFields::getFieldsNames() const throw(INTERP_KERNEL::Exception)
+{
+ std::vector<std::string> ret(_fields.size());
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutDAS> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+ {
+ const MEDFileFieldMultiTSWithoutDAS *f=(*it);
+ if(f)
+ {
+ ret[i]=f->getName();
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileFields::getFieldsNames : At rank #" << i << " field is not defined !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return ret;
+}
+
+MEDFileFields::MEDFileFields()
+{
+}
+
+MEDFileFields::MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
+try:MEDFieldFieldGlobsReal(fileName)
+ {
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ int nbFields=MEDnField(fid);
+ _fields.resize(nbFields);
+ med_field_type typcha;
+ for(int i=0;i<nbFields;i++)
+ {
+ int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localMesh;
+ int nbOfStep;
+ MEDfieldInfo(fid,i+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
+ std::vector<std::string> infos(ncomp);
+ for(int j=0;j<ncomp;j++)
+ infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
+ _fields[i]=MEDFileFieldMultiTSWithoutDAS::New(fid,nomcha,i+1,infos,nbOfStep);
+ }
+ int nProfil=MEDnProfile(fid);
+ for(int i=0;i<nProfil;i++)
+ loadProfileInFile(fid,i);
+ }
+catch(INTERP_KERNEL::Exception& e)
+ {
+ throw e;
+ }
+
+void MEDFileFields::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+{
+ int i=0;
+ med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutDAS> >::const_iterator it=_fields.begin();it!=_fields.end();it++,i++)
+ {
+ const MEDFileFieldMultiTSWithoutDAS *elt=*it;
+ if(!elt)
+ {
+ std::ostringstream oss; oss << "MEDFileFields::write : at rank #" << i << "/" << _fields.size() << " field is empty !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ elt->copyOptionsFrom(*this);
+ elt->writeLL(fid);
+ }
+}
+
+std::vector<std::string> MEDFileFields::getPflsReallyUsed() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutDAS > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsed2();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileFields::getLocsReallyUsed() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutDAS > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
+ for(std::vector<std::string>::const_iterator it2=tmp.begin();it2!=tmp.end();it2++)
+ if(ret2.find(*it2)==ret2.end())
+ {
+ ret.push_back(*it2);
+ ret2.insert(*it2);
+ }
+ }
+ return ret;
+}
+
+void MEDFileFields::resize(int newSize) throw(INTERP_KERNEL::Exception)
+{
+ _fields.resize(newSize);
+}
+
+void MEDFileFields::pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
+{
+ if(!field)
+ throw INTERP_KERNEL::Exception("MEDFileFields::pushMesh : invalid input pointer ! should be different from 0 !");
+ field->incrRef();
+ _fields.push_back(field);
+}
+
+void MEDFileFields::setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
+{
+ if(!field)
+ throw INTERP_KERNEL::Exception("MEDFileFields::setFieldAtPos : invalid input pointer ! should be different from 0 !");
+ if(i>=(int)_fields.size())
+ _fields.resize(i+1);
+ field->incrRef();
+ _fields[i]=field;
+}
+
+void MEDFileFields::destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception)
+{
+ if(i<0 || i>=(int)_fields.size())
+ {
+ std::ostringstream oss; oss << "MEDFileFields::destroyMeshAtPos : Invalid given id in input (" << i << ") should be in [0," << _fields.size() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ _fields.erase(_fields.begin()+i);
+}
+
+MEDFileFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception)
+{
+ if(i<0 || i>=(int)_fields.size())
+ {
+ std::ostringstream oss; oss << "MEDFileFields::getFieldAtPos : Invalid given id in input (" << i << ") should be in [0," << _fields.size() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ const MEDFileFieldMultiTSWithoutDAS *fmts=_fields[i];
+ MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=MEDFileFieldMultiTS::New(*fmts);
+ ret->shallowCpyGlobs(*this);
+ ret->incrRef();
+ return ret;
+}
+
+MEDFileFieldMultiTS *MEDFileFields::getField(const char *fieldName) const throw(INTERP_KERNEL::Exception)
+{
+ return getFieldAtPos(getPosFromFieldName(fieldName));
+}
+
+int MEDFileFields::getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception)
+{
+ std::string tmp(fieldName);
+ std::vector<std::string> poss;
+ for(std::size_t i=0;i<_fields.size();i++)
+ {
+ const MEDFileFieldMultiTSWithoutDAS *f=_fields[i];
+ if(f)
+ {
+ std::string fname(f->getName());
+ if(tmp==fname)
+ return i;
+ else
+ poss.push_back(fname);
+ }
+ }
+ std::ostringstream oss; oss << "MEDFileFields::getPosFromFieldName : impossible to find field '" << tmp << "' in this ! Possibilities are : ";
+ std::copy(poss.begin(),poss.end(),std::ostream_iterator<std::string>(oss,", "));
+ oss << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
--- /dev/null
+// Copyright (C) 2007-2011 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
+//
+
+#ifndef __MEDFILEFIELD_HXX__
+#define __MEDFILEFIELD_HXX__
+
+#include "MEDFileUtilities.hxx"
+
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MEDCouplingRefCountObject.hxx"
+#include "MEDCouplingMemArray.hxx"
+
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpKernelException.hxx"
+
+#include <vector>
+#include <string>
+
+extern "C"
+{
+#include "med.h"
+}
+
+namespace ParaMEDMEM
+{
+ class MEDFieldFieldGlobs;
+ class MEDCouplingMesh;
+ class MEDCouplingFieldDouble;
+ class MEDFileMesh;
+
+ class MEDFileFieldLoc : public RefCountObject
+ {
+ public:
+ const std::string& getName() const { return _name; }
+ static MEDFileFieldLoc *New(med_idt fid, const char *locName);
+ static MEDFileFieldLoc *New(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
+ int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; }
+ void writeLL(med_idt fid) const;
+ bool isName(const char *name) const { return _name==name; }
+ const std::vector<double>& getRefCoords() const { return _ref_coo; }
+ const std::vector<double>& getGaussCoords() const { return _gs_coo; }
+ const std::vector<double>& getGaussWeights() const { return _w; }
+ bool isEqual(const MEDFileFieldLoc& other, double eps) const;
+ private:
+ MEDFileFieldLoc(med_idt fid, const char *locName);
+ MEDFileFieldLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
+ private:
+ int _dim;
+ int _nb_gauss_pt;
+ int _nb_node_per_cell;
+ std::string _name;
+ INTERP_KERNEL::NormalizedCellType _geo_type;
+ std::vector<double> _ref_coo;
+ std::vector<double> _gs_coo;
+ std::vector<double> _w;
+ };
+
+ class MEDFileFieldPerMeshPerType;
+ class MEDFileField1TSWithoutDAS;
+ class MEDFieldFieldGlobsReal;
+ class MEDFileFieldPerMesh;
+
+ class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable
+ {
+ public:
+ static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerType *fath, med_idt fid, TypeOfField type, int profileIt) throw(INTERP_KERNEL::Exception);
+ static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int locId);
+ void assignFieldNoProfile(int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignFieldProfile(const char *pflName, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignNodeFieldNoProfile(const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignNodeFieldProfile(const char *pflName, const DataArrayInt *idsInPfl, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+ const MEDFileFieldPerMeshPerType *getFather() const;
+ int getIteration() const;
+ int getOrder() const;
+ double getTime() const;
+ std::string getName() const;
+ std::string getMeshName() const;
+ TypeOfField getType() const;
+ void setType(TypeOfField newType);
+ INTERP_KERNEL::NormalizedCellType getGeoType() const;
+ int getNumberOfComponents() const;
+ int getNumberOfTuples() const;
+ const std::vector<std::string>& getInfo() const;
+ std::string getProfile() const;
+ std::string getLocalization() const;
+ int getLocId() const { return _loc_id; }
+ void getFieldAtLevel(TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector<const DataArrayDouble *>& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs,
+ std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
+ static int ConvertType(TypeOfField type, int locId) throw(INTERP_KERNEL::Exception);
+ private:
+ MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, med_idt fid, TypeOfField type, int profileIt) throw(INTERP_KERNEL::Exception);
+ MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, TypeOfField type, int profileIt);
+ private:
+ TypeOfField _type;
+ MEDFileFieldPerMeshPerType *_father;
+ MEDCouplingAutoRefCountObjectPtr< DataArrayDouble > _arr;
+ //! _nval is different than _arr->getNumberOfTuples() in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=_arr->getNumberOfTuples()/nbi)
+ int _nval;
+ int _profile_it;
+ std::string _profile;
+ std::string _localization;
+ //! only on assignement -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT
+ mutable int _loc_id;
+ };
+
+ class MEDFileFieldPerMeshPerType : public RefCountObject, public MEDFileWritable
+ {
+ public:
+ static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
+ void assignFieldNoProfile(int offset, int nbOfCells, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignFieldProfile(const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignNodeFieldNoProfile(const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignNodeFieldProfile(const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ const MEDFileFieldPerMesh *getFather() const;
+ void finishLoading(med_idt fid, TypeOfField type) throw(INTERP_KERNEL::Exception);
+ void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+ void getDimension(int& dim) const;
+ int getIteration() const;
+ int getOrder() const;
+ double getTime() const;
+ std::string getName() const;
+ std::string getMeshName() const;
+ INTERP_KERNEL::NormalizedCellType getGeoType() const;
+ int getNumberOfComponents() const;
+ const std::vector<std::string>& getInfo() const;
+ std::vector<std::string> getPflsReallyUsed() const;
+ std::vector<std::string> getLocsReallyUsed() const;
+ void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector<const DataArrayDouble *>& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
+ static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
+ private:
+ std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception);
+ std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception);
+ std::vector<int> addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception);
+ std::vector<int> addNewEntryIfNecessaryGauss(const MEDCouplingFieldDouble *field, const DataArrayInt *subCells) throw(INTERP_KERNEL::Exception);
+ MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception);
+ private:
+ MEDFileFieldPerMesh *_father;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> > _field_pm_pt_pd;
+ INTERP_KERNEL::NormalizedCellType _geo_type;
+ };
+
+ class MEDFileFieldPerMesh : public RefCountObject, public MEDFileWritable
+ {
+ public:
+ static MEDFileFieldPerMesh *New(MEDFileField1TSWithoutDAS *fath, const MEDCouplingMesh *mesh);
+ static MEDFileFieldPerMesh *New(MEDFileField1TSWithoutDAS *fath, int meshCsit, int meshIteration, int meshOrder);
+ void copyTinyInfoFrom(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
+ void assignFieldProfile(const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignFieldProfileGeneral(const DataArrayInt *multiTypePfl, const std::vector<int>& code, const std::vector<DataArrayInt *>& idsInPflPerType, const std::vector<DataArrayInt *>& idsPerType, const MEDCouplingFieldDouble *field, const MEDCouplingMesh *mesh, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignFieldNoProfileNoRenum(const std::vector<int>& code, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignNodeFieldNoProfile(const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void assignNodeFieldProfile(const DataArrayInt *pfl, const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void finishLoading(med_idt fid) throw(INTERP_KERNEL::Exception);
+ void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+ void getDimension(int& dim) const;
+ double getTime() const;
+ int getIteration() const;
+ int getOrder() const;
+ int getMeshIteration() const { return _mesh_iteration; }
+ int getMeshOrder() const { return _mesh_order; }
+ const std::string& getDtUnit() const;
+ std::string getName() const;
+ std::string getMeshName() const { return _mesh_name; }
+ int getNumberOfComponents() const;
+ const std::vector<std::string>& getInfo() const;
+ std::vector<std::string> getPflsReallyUsed() const;
+ std::vector<std::string> getLocsReallyUsed() const;
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFieldFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFieldFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
+ private:
+ int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
+ MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFieldFieldGlobsReal *glob,
+ const std::vector<const DataArrayDouble *>& dads, const std::vector<int>& locs, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFieldFieldGlobsReal *glob,
+ const std::vector<const DataArrayDouble *>& dads, const std::vector<int>& locs,
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *finishField3(const MEDFieldFieldGlobsReal *glob,
+ const std::vector<const DataArrayDouble *>& dads, const std::vector<int>& locs,
+ const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl) const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *finishField4(const std::vector<const DataArrayDouble *>& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const throw(INTERP_KERNEL::Exception);
+ static void SortArraysPerType(const MEDFieldFieldGlobsReal *glob, TypeOfField type,
+ const std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes, const std::vector<const DataArrayDouble *>& dads, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& locs,
+ std::vector<int>& code, std::vector<DataArrayInt *>& notNullPfls);
+ static int ComputeNbOfElems(const MEDFieldFieldGlobsReal *glob, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<const DataArrayDouble *>& dads, const std::vector<int>& locs) throw(INTERP_KERNEL::Exception);
+ MEDFileFieldPerMesh(MEDFileField1TSWithoutDAS *fath, int meshCsit, int meshIteration, int meshOrder);
+ MEDFileFieldPerMesh(MEDFileField1TSWithoutDAS *fath, const MEDCouplingMesh *mesh);
+ private:
+ std::string _mesh_name;
+ int _mesh_iteration;
+ int _mesh_order;
+ int _mesh_csit;
+ MEDFileField1TSWithoutDAS *_father;
+ std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > > _field_pm_pt;
+ };
+
+ class MEDFieldFieldGlobsReal;
+
+ class MEDFieldFieldGlobs : public RefCountObject
+ {
+ public:
+ static MEDFieldFieldGlobs *New(const char *fname);
+ static MEDFieldFieldGlobs *New();
+ void loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception);
+ void loadProfileInFile(med_idt fid, int id);
+ void loadGlobals(med_idt fid, const MEDFieldFieldGlobsReal& real) throw(INTERP_KERNEL::Exception);
+ void writeGlobals(med_idt fid, const MEDFileWritable& opt) const throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> getPfls() const;
+ std::vector<std::string> getLocs() const;
+ void setFileName(const char *fileName);
+ int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
+ int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
+ const char *getFileName() const { return _file_name.c_str(); }
+ std::string getFileName2() const { return _file_name; }
+ const MEDFileFieldLoc& getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception);
+ const DataArrayInt *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception);
+ //
+ void appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception);
+ void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
+ protected:
+ MEDFieldFieldGlobs(const char *fname);
+ MEDFieldFieldGlobs();
+ ~MEDFieldFieldGlobs();
+ protected:
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _pfls;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> > _locs;
+ std::string _file_name;
+ };
+
+ class MEDFieldFieldGlobsReal
+ {
+ public:
+ MEDFieldFieldGlobsReal(const char *fname);
+ MEDFieldFieldGlobsReal();
+ void shallowCpyGlobs(const MEDFieldFieldGlobsReal& other);
+ virtual std::vector<std::string> getPflsReallyUsed() const = 0;
+ virtual std::vector<std::string> getLocsReallyUsed() const = 0;
+ //
+ void loadProfileInFile(med_idt fid, int id, const char *pflName) throw(INTERP_KERNEL::Exception);
+ void loadProfileInFile(med_idt fid, int id);
+ void loadGlobals(med_idt fid) throw(INTERP_KERNEL::Exception);
+ void writeGlobals(med_idt fid, const MEDFileWritable& opt) const throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> getPfls() const;
+ std::vector<std::string> getLocs() const;
+ void setFileName(const char *fileName);
+ int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
+ int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
+ const char *getFileName() const;
+ std::string getFileName2() const;
+ const MEDFileFieldLoc& getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception);
+ const DataArrayInt *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception);
+ //
+ void appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception);
+ void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w) throw(INTERP_KERNEL::Exception);
+ protected:
+ MEDCouplingAutoRefCountObjectPtr< MEDFieldFieldGlobs > _globals;
+ };
+
+ class MEDFileField1TSWithoutDAS : public RefCountObject, public MEDFileWritable
+ {
+ public:
+ void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
+ int getDimension() const;
+ int getIteration() const { return _iteration; }
+ int getOrder() const { return _order; }
+ double getTime() const { return _dt; }
+ std::string getName() const { return _name; }
+ const std::string& getDtUnit() const { return _dt_unit; }
+ std::string getMeshName() const throw(INTERP_KERNEL::Exception);
+ int getMeshIteration() const throw(INTERP_KERNEL::Exception);
+ int getMeshOrder() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfComponents() const { return _infos.size(); }
+ bool isDealingTS(int iteration, int order) const;
+ std::pair<int,int> getDtIt() const;
+ void fillIteration(std::pair<int,int>& p) const;
+ const std::vector<std::string>& getInfo() const { return _infos; }
+ //
+ static MEDFileField1TSWithoutDAS *New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+ void finishLoading(med_idt fid) throw(INTERP_KERNEL::Exception);
+ void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> getPflsReallyUsed2() const;
+ std::vector<std::string> getLocsReallyUsed2() const;
+ static void CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
+ static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
+ //
+ void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFieldFieldGlobsReal& glob) throw(INTERP_KERNEL::Exception);
+ public:
+ MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFieldFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFieldFieldGlobsReal *glob, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFieldFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum) const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFieldFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception);
+ protected:
+ int addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
+ int getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception);
+ MEDFileField1TSWithoutDAS(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+ public:
+ MEDFileField1TSWithoutDAS();
+ protected:
+ std::string _name;
+ std::string _dt_unit;
+ std::vector<std::string> _infos;
+ std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > > _field_per_mesh;
+ int _csit;
+ int _iteration;
+ int _order;
+ double _dt;
+ };
+
+ /*!
+ * User class.
+ */
+ class MEDFileField1TS : public MEDFileField1TSWithoutDAS, public MEDFieldFieldGlobsReal
+ {
+ public:
+ static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+ static MEDFileField1TS *New();
+ void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
+ //
+ void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
+ void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+ private:
+ std::vector<std::string> getPflsReallyUsed() const;
+ std::vector<std::string> getLocsReallyUsed() const;
+ MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+ MEDFileField1TS();
+ };
+
+ class MEDFileFieldMultiTSWithoutDAS : public RefCountObject, public MEDFileWritable
+ {
+ public:
+ static MEDFileFieldMultiTSWithoutDAS *New(med_idt fid, const char *fieldName, int id, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception);
+ int getNumberOfTS() const;
+ std::vector< std::pair<int,int> > getIterations() const;
+ void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+ std::string getName() const;
+ std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
+ public:
+ std::vector<std::string> getPflsReallyUsed2() const;
+ std::vector<std::string> getLocsReallyUsed2() const;
+ protected:
+ const MEDFileField1TSWithoutDAS& getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+ MEDFileField1TSWithoutDAS& getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
+ std::string getMeshName() const throw(INTERP_KERNEL::Exception);
+ std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
+ MEDFileFieldMultiTSWithoutDAS();
+ MEDFileFieldMultiTSWithoutDAS(const char *fieldName);
+ MEDFileFieldMultiTSWithoutDAS(med_idt fid, const char *fieldName, int id, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception);
+ void finishLoading(med_idt fid, int nbPdt) throw(INTERP_KERNEL::Exception);
+ void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
+ void checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field) const throw(INTERP_KERNEL::Exception);
+ protected:
+ std::string _name;
+ std::vector<std::string> _infos;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSWithoutDAS> > _time_steps;
+ };
+
+ /*!
+ * User class.
+ */
+ class MEDFileFieldMultiTS : public MEDFileFieldMultiTSWithoutDAS, public MEDFieldFieldGlobsReal
+ {
+ public:
+ static MEDFileFieldMultiTS *New();
+ static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+ static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutDAS& other);
+ void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const throw(INTERP_KERNEL::Exception);
+ //
+ void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
+ void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+ private:
+ std::vector<std::string> getPflsReallyUsed() const;
+ std::vector<std::string> getLocsReallyUsed() const;
+ private:
+ MEDFileFieldMultiTS();
+ MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutDAS& other);
+ MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+ };
+
+ /*!
+ * Use class.
+ */
+ class MEDFileFields : public RefCountObject, public MEDFieldFieldGlobsReal, public MEDFileWritable
+ {
+ public:
+ static MEDFileFields *New();
+ static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+ void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ int getNumberOfFields() const;
+ std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
+ //
+ void resize(int newSize) throw(INTERP_KERNEL::Exception);
+ void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
+ void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
+ MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
+ MEDFileFieldMultiTS *getField(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+ void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
+ private:
+ int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> getPflsReallyUsed() const;
+ std::vector<std::string> getLocsReallyUsed() const;
+ private:
+ MEDFileFields();
+ MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception);
+ private:
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTSWithoutDAS> > _fields;
+ };
+}
+
+#endif
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDLoader.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingGaussLocalization.hxx"
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+
+#include "InterpKernelAutoPtr.hxx"
#include "InterpKernelAutoPtr.hxx"
}
#include <string>
+#include <limits>
#include <cstring>
#include <sstream>
#include <fstream>
+#include <numeric>
#include <iterator>
#include <algorithm>
-#include <numeric>
-#include <limits>
-med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE+2] = { MED_POINT1,
- MED_SEG2,
- MED_SEG3,
- MED_TRIA3,
- MED_TRIA6,
- MED_QUAD4,
- MED_QUAD8,
- MED_TETRA4,
- MED_TETRA10,
- MED_HEXA8,
- MED_HEXA20,
- MED_PENTA6,
- MED_PENTA15,
- MED_PYRA5,
- MED_PYRA13,
- MED_POLYGONE,
- MED_POLYEDRE };
-
-med_geometrie_element typmainoeud[1] = { MED_NONE };
-
-INTERP_KERNEL::NormalizedCellType typmai2[MED_NBR_GEOMETRIE_MAILLE+2] = { INTERP_KERNEL::NORM_POINT1,
- INTERP_KERNEL::NORM_SEG2,
- INTERP_KERNEL::NORM_SEG3,
- INTERP_KERNEL::NORM_TRI3,
- INTERP_KERNEL::NORM_TRI6,
- INTERP_KERNEL::NORM_QUAD4,
- INTERP_KERNEL::NORM_QUAD8,
- INTERP_KERNEL::NORM_TETRA4,
- INTERP_KERNEL::NORM_TETRA10,
- INTERP_KERNEL::NORM_HEXA8,
- INTERP_KERNEL::NORM_HEXA20,
- INTERP_KERNEL::NORM_PENTA6,
- INTERP_KERNEL::NORM_PENTA15,
- INTERP_KERNEL::NORM_PYRA5,
- INTERP_KERNEL::NORM_PYRA13,
- INTERP_KERNEL::NORM_POLYGON,
- INTERP_KERNEL::NORM_POLYHED };
-
-med_geometrie_element typmai3[32] = { MED_POINT1,//0
- MED_SEG2,//1
- MED_SEG3,//2
- MED_TRIA3,//3
- MED_QUAD4,//4
- MED_POLYGONE,//5
- MED_TRIA6,//6
- MED_NONE,//7
- MED_QUAD8,//8
- MED_NONE,//9
- MED_NONE,//10
- MED_NONE,//11
- MED_NONE,//12
- MED_NONE,//13
- MED_TETRA4,//14
- MED_PYRA5,//15
- MED_PENTA6,//16
- MED_NONE,//17
- MED_HEXA8,//18
- MED_NONE,//19
- MED_TETRA10,//20
- MED_NONE,//21
- MED_NONE,//22
- MED_PYRA13,//23
- MED_NONE,//24
- MED_PENTA15,//25
- MED_NONE,//26
- MED_NONE,//27
- MED_NONE,//28
- MED_NONE,//29
- MED_HEXA20,//30
- MED_POLYEDRE//31
+med_geometry_type typmai[MED_N_CELL_FIXED_GEO] = { MED_POINT1,
+ MED_SEG2,
+ MED_SEG3,
+ MED_SEG4,
+ MED_TRIA3,
+ MED_QUAD4,
+ MED_TRIA6,
+ MED_TRIA7,
+ MED_QUAD8,
+ MED_QUAD9,
+ MED_TETRA4,
+ MED_PYRA5,
+ MED_PENTA6,
+ MED_HEXA8,
+ MED_OCTA12,
+ MED_TETRA10,
+ MED_PYRA13,
+ MED_PENTA15,
+ MED_HEXA20,
+ MED_HEXA27,
+ MED_POLYGON,
+ MED_POLYHEDRON };
+
+med_geometry_type typmainoeud[1] = { MED_NONE };
+
+INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO] = { INTERP_KERNEL::NORM_POINT1,
+ INTERP_KERNEL::NORM_SEG2,
+ INTERP_KERNEL::NORM_SEG3,
+ INTERP_KERNEL::NORM_ERROR,//SEG4
+ INTERP_KERNEL::NORM_TRI3,
+ INTERP_KERNEL::NORM_QUAD4,
+ INTERP_KERNEL::NORM_TRI6,
+ INTERP_KERNEL::NORM_ERROR,//TRI7
+ INTERP_KERNEL::NORM_QUAD8,
+ INTERP_KERNEL::NORM_ERROR,//QUAD9
+ INTERP_KERNEL::NORM_TETRA4,
+ INTERP_KERNEL::NORM_PYRA5,
+ INTERP_KERNEL::NORM_PENTA6,
+ INTERP_KERNEL::NORM_HEXA8,
+ INTERP_KERNEL::NORM_HEXGP12,
+ INTERP_KERNEL::NORM_TETRA10,
+ INTERP_KERNEL::NORM_PYRA13,
+ INTERP_KERNEL::NORM_PENTA15,
+ INTERP_KERNEL::NORM_HEXA20,
+ INTERP_KERNEL::NORM_ERROR,//HEXA27
+ INTERP_KERNEL::NORM_POLYGON,
+ INTERP_KERNEL::NORM_POLYHED };
+
+med_geometry_type typmai3[32] = { MED_POINT1,//0
+ MED_SEG2,//1
+ MED_SEG3,//2
+ MED_TRIA3,//3
+ MED_QUAD4,//4
+ MED_POLYGON,//5
+ MED_TRIA6,//6
+ MED_NONE,//7
+ MED_QUAD8,//8
+ MED_NONE,//9
+ MED_NONE,//10
+ MED_NONE,//11
+ MED_NONE,//12
+ MED_NONE,//13
+ MED_TETRA4,//14
+ MED_PYRA5,//15
+ MED_PENTA6,//16
+ MED_NONE,//17
+ MED_HEXA8,//18
+ MED_NONE,//19
+ MED_TETRA10,//20
+ MED_NONE,//21
+ MED_OCTA12,//22
+ MED_PYRA13,//23
+ MED_NONE,//24
+ MED_PENTA15,//25
+ MED_NONE,//26
+ MED_NONE,//27
+ MED_NONE,//28
+ MED_NONE,//29
+ MED_HEXA20,//30
+ MED_POLYHEDRON//31
};
double MEDLoader::_EPS_FOR_NODE_COMP=1.e-12;
std::vector<int> getIdsFromFamilies(const char *fileName, const char *meshName, const std::vector<std::string>& fams);
std::vector<int> getIdsFromGroups(const char *fileName, const char *meshName, const std::vector<std::string>& grps);
med_int getIdFromMeshName(med_idt fid, const char *meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception);
- void dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entite_maillage& whichEntity);
+ void dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity);
int readUMeshDimFromFile(const char *fileName, const char *meshName, std::vector<int>& possibilities);
- void readUMeshDataInMedFile(med_idt fid, med_int meshId, DataArrayDouble *&coords, std::list<MEDLoader::MEDConnOfOneElemType>& conn);
+ void readUMeshDataInMedFile(med_idt fid, med_int meshId, DataArrayDouble *&coords, std::list<MEDLoader::MEDConnOfOneElemType>& conn, std::string& desc);
int buildMEDSubConnectivityOfOneType(const std::vector<const DataArrayInt *>& conn, const std::vector<const DataArrayInt *>& connIndex, const std::vector<const DataArrayInt *>& families, INTERP_KERNEL::NormalizedCellType type,
std::vector<int>& conn4MEDFile, std::vector<int>& connIndex4MEDFile, std::vector<int>& connIndexRk24MEDFile,
std::vector<int>& fam4MEDFile, std::vector<int>& renumber);
int buildMEDSubConnectivityOfOneTypeStaticTypes(const std::vector<const DataArrayInt *>& conn, const std::vector<const DataArrayInt *>& connIndex, const std::vector<const DataArrayInt *>& families,
INTERP_KERNEL::NormalizedCellType type, std::vector<int>& conn4MEDFile, std::vector<int>& fam4MEDFile, std::vector<int>& renumber);
ParaMEDMEM::MEDCouplingFieldDouble *readFieldDoubleLev1(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order,
- ParaMEDMEM::TypeOfField typeOfOutField);
+ ParaMEDMEM::TypeOfField typeOfOutField) throw(INTERP_KERNEL::Exception);
ParaMEDMEM::MEDCouplingFieldDouble *readFieldDoubleLev2(const char *fileName, ParaMEDMEM::TypeOfField typeOfOutField, unsigned meshDim, const int *renumCell, const ParaMEDMEM::MEDCouplingUMesh *mesh,
const std::vector<std::string>& infos, const char *fieldName, int iteration, int order, double time,
- std::list<MEDLoader::MEDFieldDoublePerCellType>& fieldPerCellType);
+ std::list<MEDLoader::MEDFieldDoublePerCellType>& fieldPerCellType) throw(INTERP_KERNEL::Exception);
med_idt appendFieldSimpleAtt(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, med_int& numdt, med_int& numo, med_float& dt);
void appendFieldDirectly(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f);
void appendNodeProfileField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, const int *thisMeshNodeIds);
std::vector<std::string> MEDLoaderNS::getMeshNamesFid(med_idt fid)
{
- med_maillage type_maillage;
- char maillage_description[MED_TAILLE_DESC+1];
- med_int dim;
- char nommaa[MED_TAILLE_NOM+1];
- med_int n=MEDnMaa(fid);
+ med_mesh_type type_maillage;
+ char maillage_description[MED_COMMENT_SIZE+1];
+ char dtunit[MED_COMMENT_SIZE+1];
+ med_int space_dim;
+ med_int mesh_dim;
+ char nommaa[MED_NAME_SIZE+1];
+ med_axis_type axistype;
+ med_sorting_type stype;
+ med_int n=MEDnMesh(fid);
std::vector<std::string> ret(n);
for(int i=0;i<n;i++)
{
- MEDmaaInfo(fid,i+1,nommaa,&dim,&type_maillage,maillage_description);
+ int naxis=MEDmeshnAxis(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
+ int nstep;
+ MEDmeshInfo(fid,i+1,nommaa,&space_dim,&mesh_dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit);
std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa));
ret[i]=cur;
}
void MEDLoaderNS::fillGaussDataOnField(const char *fileName, const std::list<MEDLoader::MEDFieldDoublePerCellType>& data, MEDCouplingFieldDouble *f)
{
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- char locName[MED_TAILLE_NOM+1];
- int nloc=MEDnGauss(fid);
- med_geometrie_element typeGeo;
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ char locName[MED_NAME_SIZE+1];
+ int nloc=MEDnLocalization(fid);
+ med_geometry_type typeGeo;
for(std::list<MEDLoader::MEDFieldDoublePerCellType>::const_iterator iter=data.begin();iter!=data.end();iter++)
{
const std::string& loc=(*iter).getLocName();
int idLoc=1;
int nbOfGaussPt=-1;
+ med_int spaceDim;
for(;idLoc<=nloc;idLoc++)
{
- MEDgaussInfo(fid,idLoc,locName,&typeGeo,&nbOfGaussPt);
+ char geointerpname[MED_NAME_SIZE+1]="";
+ char ipointstructmeshname[MED_NAME_SIZE+1]="";
+ med_int nsectionmeshcell;
+ med_geometry_type sectiongeotype;
+ MEDlocalizationInfo(fid,idLoc,locName,&typeGeo,&spaceDim,&nbOfGaussPt, geointerpname, ipointstructmeshname, &nsectionmeshcell,
+ §iongeotype);
if(loc==locName)
break;
}
- int dim=(int)INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getDimension();
- int nbPtPerCell=(int)INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getNumberOfNodes();
+ int dim=(int)INTERP_KERNEL::CellModel::GetCellModel((*iter).getType()).getDimension();
+ int nbPtPerCell=(int)INTERP_KERNEL::CellModel::GetCellModel((*iter).getType()).getNumberOfNodes();
std::vector<double> refcoo(nbPtPerCell*dim),gscoo(nbOfGaussPt*dim),w(nbOfGaussPt);
- MEDgaussLire(fid,(med_float *)&refcoo[0],(med_float *)&gscoo[0],(med_float *)&w[0],MED_FULL_INTERLACE,(char *)(*iter).getLocName().c_str());
+ MEDlocalizationRd(fid,(*iter).getLocName().c_str(),MED_FULL_INTERLACE,&refcoo[0],&gscoo[0],&w[0]);
f->setGaussLocalizationOnType((*iter).getType(),refcoo,gscoo,w);
}
- MEDfermer(fid);
+ MEDfileClose(fid);
}
void MEDLoader::CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception)
std::vector<std::string> MEDLoader::GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception)
{
CheckFileForRead(fileName);
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
std::vector<std::string> ret=MEDLoaderNS::getMeshNamesFid(fid);
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
//
- med_type_champ typcha;
- //med_int nbpdtnor=0,pflsize,*pflval,lnsize;
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
- med_float dt=0.0;
- med_booleen local;
- //char pflname[MED_TAILLE_NOM+1]="";
- //char locname[MED_TAILLE_NOM+1]="";
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
+ //
+ med_field_type typcha;
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localmesh;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ med_int nbPdt;
+ INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
- {
- bool found=false;
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
- {
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
- for(int k=0;k<nbPdt;k++)
- {
- MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
- std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
- if(std::find(ret.begin(),ret.end(),curMeshName)==ret.end())
- ret.push_back(curMeshName);
- }
- }
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
- for(int k=0;k<nbPdt;k++)
- {
- MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
- std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
- if(std::find(ret.begin(),ret.end(),curMeshName)==ret.end())
- ret.push_back(curMeshName);
- }
- }
+ ret.push_back(meshName);
}
- delete [] maa_ass;
- delete [] dt_unit;
- delete [] nomcha;
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
std::vector<std::string> MEDLoader::GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
{
CheckFileForRead(fileName);
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nfam=MEDnFam(fid,(char *)meshName);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName);
std::vector<std::string> ret(nfam);
- char nomfam[MED_TAILLE_NOM+1];
+ char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnGroupe(fid,(char *)meshName,i+1);
- med_int natt=MEDnAttribut(fid,(char *)meshName,i+1);
- med_int *attide=new int[natt];
- med_int *attval=new int[natt];
- char *attdes=new char[MED_TAILLE_DESC*natt+1];
- char *gro=new char[MED_TAILLE_LNOM*ngro+1];
- MEDfamInfo(fid,(char *)meshName,i+1,nomfam,&numfam,attide,attval,attdes,&natt,gro,&ngro);
+ int ngro=MEDnFamilyGroup(fid,meshName,i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
+ INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
+ MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
ret[i]=cur;
- delete [] attdes;
- delete [] gro;
- delete [] attide;
- delete [] attval;
}
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
+
std::vector<std::string> MEDLoader::GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception)
{
CheckFileForRead(fileName);
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nfam=MEDnFam(fid,(char *)meshName);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName);
std::vector<std::string> ret;
- char nomfam[MED_TAILLE_NOM+1];
+ char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnGroupe(fid,(char *)meshName,i+1);
- med_int natt=MEDnAttribut(fid,(char *)meshName,i+1);
- INTERP_KERNEL::AutoPtr<med_int> attide=new int[natt];
- INTERP_KERNEL::AutoPtr<med_int> attval=new int[natt];
- INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_TAILLE_DESC*natt+1];
- INTERP_KERNEL::AutoPtr<char> gro=new char[MED_TAILLE_LNOM*ngro+1];
- MEDfamInfo(fid,(char *)meshName,i+1,nomfam,&numfam,attide,attval,attdes,&natt,gro,&ngro);
+ int ngro=MEDnFamilyGroup(fid,meshName,i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
+ INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
+ MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
for(int j=0;j<ngro;j++)
{
- std::string cur2=MEDLoaderBase::buildStringFromFortran(gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ std::string cur2=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
if(cur2==grpName)
ret.push_back(cur);
}
}
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
std::vector<std::string> MEDLoader::GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception)
{
CheckFileForRead(fileName);
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nfam=MEDnFam(fid,(char *)meshName);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName);
std::vector<std::string> ret;
- char nomfam[MED_TAILLE_NOM+1];
+ char nomfam[MED_NAME_SIZE+1];
med_int numfam;
bool found=false;
for(int i=0;i<nfam && !found;i++)
{
- int ngro=MEDnGroupe(fid,(char *)meshName,i+1);
- med_int natt=MEDnAttribut(fid,(char *)meshName,i+1);
- INTERP_KERNEL::AutoPtr<med_int> attide=new int[natt];
- INTERP_KERNEL::AutoPtr<med_int> attval=new int[natt];
- INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_TAILLE_DESC*natt+1];
- INTERP_KERNEL::AutoPtr<char> gro=new char[MED_TAILLE_LNOM*ngro+1];
- MEDfamInfo(fid,(char *)meshName,i+1,nomfam,&numfam,attide,attval,attdes,&natt,gro,&ngro);
+ int ngro=MEDnFamilyGroup(fid,meshName,i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
+ INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
+ MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
found=(cur==famName);
if(found)
for(int j=0;j<ngro;j++)
{
- std::string cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ std::string cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
ret.push_back(cur);
}
}
- MEDfermer(fid);
+ MEDfileClose(fid);
if(!found)
{
std::ostringstream oss;
}
return ret;
}
+
std::vector<std::string> MEDLoader::GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
{
CheckFileForRead(fileName);
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nfam=MEDnFam(fid,(char *)meshName);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName);
std::vector<std::string> ret;
- char nomfam[MED_TAILLE_NOM+1];
+ char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnGroupe(fid,(char *)meshName,i+1);
- med_int natt=MEDnAttribut(fid,(char *)meshName,i+1);
- med_int *attide=new int[natt];
- med_int *attval=new int[natt];
- char *attdes=new char[MED_TAILLE_DESC*natt+1];
- char *gro=new char[MED_TAILLE_LNOM*ngro+1];
- MEDfamInfo(fid,(char *)meshName,i+1,nomfam,&numfam,attide,attval,attdes,&natt,gro,&ngro);
+ int ngro=MEDnFamilyGroup(fid,meshName,i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
+ INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
+ MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
for(int j=0;j<ngro;j++)
{
- std::string cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ std::string cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
if(std::find(ret.begin(),ret.end(),cur)==ret.end())
ret.push_back(cur);
}
- delete [] attdes;
- delete [] gro;
- delete [] attide;
- delete [] attval;
}
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
-std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const char *fileName, const char *fieldName, const char *meshName) throw(INTERP_KERNEL::Exception)
+std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
{
CheckFileForRead(fileName);
std::vector<ParaMEDMEM::TypeOfField> ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
//
- med_type_champ typcha;
+ med_field_type typcha;
//med_int nbpdtnor=0,pflsize,*pflval,lnsize;
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
+ med_int numdt=0,numo=0;
med_float dt=0.0;
- med_booleen local;
- //char pflname[MED_TAILLE_NOM+1]="";
- //char locname[MED_TAILLE_NOM+1]="";
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ char pflname[MED_NAME_SIZE+1]="";
+ char locname[MED_NAME_SIZE+1]="";
+ char *maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ char *nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localmesh;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
- if(curFieldName==fieldName)
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1];
+ med_int nbPdt;
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
+ if(curMeshName==meshName)
{
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
- if(nbPdt>0)
+ if(curFieldName==fieldName)
{
- bool found=false;
- for(int i=0;i<nbPdt && !found;i++)
+ int profilesize,nbi;
+ if(nbPdt>0)
{
- MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
- std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
- if(curMeshName==meshName)
+ bool found=false;
+ for(int i=0;i<nbPdt && !found;i++)
{
- ret.push_back(ON_NODES);
- found=true;
+ MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi);
+ if(nbOfVal>0)
+ {
+ ret.push_back(ON_NODES);
+ found=true;
+ }
}
}
- }
- bool found=false;
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
- {
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
- if(nbPdt>0)
+ bool found=false;
+ for(int j=0;j<MED_N_CELL_FIXED_GEO && !found;j++)
{
- MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
- std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
- if(curMeshName==meshName)
+ if(nbPdt>0)
{
- found=true;
- ret.push_back(ON_CELLS);
+ MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi);
+ if(nbOfVal>0)
+ {
+ found=true;
+ ret.push_back(ON_CELLS);
+ }
}
}
}
}
}
delete [] maa_ass;
- delete [] dt_unit;
delete [] nomcha;
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
- med_type_champ typcha;
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
+ med_field_type typcha;
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1];
+ med_int nbPdt;
+ med_bool localmesh;
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
ret.push_back(std::string(nomcha));
- delete [] nomcha;
- delete [] comp;
- delete [] unit;
}
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
//
- med_type_champ typcha;
- //med_int nbpdtnor=0,pflsize,*pflval,lnsize;
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
- med_float dt=0.0;
- med_booleen local;
- //char pflname[MED_TAILLE_NOM+1]="";
- //char locname[MED_TAILLE_NOM+1]="";
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ med_field_type typcha;
+ char *maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ char *nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
- //
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
- bool found=false;
- if(nbPdt>0)
- {
- for(int i=0;i<nbPdt && !found;i++)
- {
- MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,i+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
- std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
- if(curMeshName==meshName)
- {
- found=true;
- ret.push_back(curFieldName);
- }
- }
- }
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1];
+ med_int nbPdt;
+ med_bool localmesh;
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
//
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
- {
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
- if(nbPdt>0)
- {
- MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
- std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
- if(curMeshName==meshName)
- {
- found=true;
- ret.push_back(curFieldName);
- }
- }
- }
+ if(curMeshName==meshName)
+ ret.push_back(curFieldName);
}
delete [] maa_ass;
- delete [] dt_unit;
delete [] nomcha;
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
//
- med_type_champ typcha;
+ med_field_type typcha;
//med_int nbpdtnor=0,pflsize,*pflval,lnsize;
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
+ med_int numdt=0,numo=0;
med_float dt=0.0;
- med_booleen local;
- //char pflname[MED_TAILLE_NOM+1]="";
- //char locname[MED_TAILLE_NOM+1]="";
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ char pflname[MED_NAME_SIZE+1]="";
+ char locname[MED_NAME_SIZE+1]="";
+ INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localmesh;
+ med_int nbPdt;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
- bool found=false;
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
+ int profilesize,nbi;
+ if(curMeshName==meshName)
{
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
- if(nbPdt>0)
+ bool found=false;
+ for(int j=0;j<MED_N_CELL_FIXED_GEO && !found;j++)
{
- MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
- std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
- if(curMeshName==meshName)
+ if(nbPdt>0)
{
- found=true;
- ret.push_back(curFieldName);
+ MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi);
+ if(nbOfVal>0)
+ {
+ found=true;
+ ret.push_back(curFieldName);
+ }
}
}
}
}
- delete [] maa_ass;
- delete [] dt_unit;
- delete [] nomcha;
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
+ char pflname[MED_NAME_SIZE+1]="";
+ char locname[MED_NAME_SIZE+1]="";
//
- med_type_champ typcha;
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
+ med_field_type typcha;
+ med_int numdt=0,numo=0;
med_float dt=0.0;
- med_booleen local;
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localmesh;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ med_int nbPdt;
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
bool found=false;
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
if(nbPdt>0)
{
- MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
- std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
- if(curMeshName==meshName)
+ int profilesize,nbi;
+ MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi);
+ if(curMeshName==meshName && nbOfVal>0)
{
found=true;
ret.push_back(curFieldName);
}
}
}
- delete [] maa_ass;
- delete [] dt_unit;
- delete [] nomcha;
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
{
CheckFileForRead(fileName);
std::string meshNameCpp(meshName);
- std::vector< std::pair< std::pair<int,int>, double> > ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
+ std::vector< std::pair< std::pair<int,int>, double > > ret;
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
//
- med_type_champ typcha;
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
+ med_field_type typcha;
+ med_int numdt=0,numo=0;
med_float dt=0.0;
- med_booleen local;
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ char pflname[MED_NAME_SIZE+1]="";
+ char locname[MED_NAME_SIZE+1]="";
+ INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localmesh;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ med_int nbPdt;
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
bool found=false;
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+ int profilesize,nbi;
+ for(int j=0;j<MED_N_CELL_FIXED_GEO && !found;j++)
{
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
for(int k=0;k<nbPdt;k++)
{
- MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+ MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi);
std::string maa_ass_cpp(maa_ass);
- if(meshNameCpp==maa_ass_cpp)
+ if(meshNameCpp==maa_ass_cpp && nbOfVal>0)
{
found=true;
ret.push_back(std::make_pair(std::make_pair(numdt,numo),dt));
}
}
}
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
for(int k=0;k<nbPdt;k++)
{
- MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+ MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi);
std::string maa_ass_cpp(maa_ass);
- if(meshNameCpp==maa_ass_cpp)
- ret.push_back(std::make_pair(std::make_pair(numdt,numo),dt));
+ if(meshNameCpp==maa_ass_cpp && nbOfVal>0)
+ {
+ found=true;
+ ret.push_back(std::make_pair(std::make_pair(numdt,numo),dt));
+ }
}
}
}
- delete [] maa_ass;
- delete [] dt_unit;
- delete [] nomcha;
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
double MEDLoader::GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
{
CheckFileForRead(fileName);
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
//
- med_type_champ typcha;
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
+ med_field_type typcha;
+ med_int numdt=0,numo=0;
med_float dt=0.0;
- med_booleen local;
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ med_bool local;
+ INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
//
bool found=false;
bool found2=false;
double ret=std::numeric_limits<double>::max();
for(int i=0;i<nbFields && !found;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ med_int nbPdt;
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&local,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
found=true;
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found2;j++)
+ for(int j=0;j<MED_N_CELL_FIXED_GEO && !found2;j++)
{
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
for(int k=0;k<nbPdt;k++)
{
- MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
- if(numdt==iteration && numo==order)
- {
- found2=true;
- ret=dt;
- }
- }
- }
- if(!found2)
- {
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
- for(int k=0;k<nbPdt && !found2;k++)
- {
- MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+ MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
if(numdt==iteration && numo==order)
{
found2=true;
}
}
}
- delete [] maa_ass;
- delete [] dt_unit;
- delete [] nomcha;
- MEDfermer(fid);
+ MEDfileClose(fid);
if(!found || !found2)
{
std::ostringstream oss;
CheckFileForRead(fileName);
std::string meshNameCpp(meshName);
std::vector< std::pair<int,int> > ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
//
- med_type_champ typcha;
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
+ med_field_type typcha;
+ med_int numdt=0,numo=0;
med_float dt=0.0;
- med_booleen local;
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ char pflname[MED_NAME_SIZE+1]="";
+ char locname[MED_NAME_SIZE+1]="";
+ INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localmesh;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ med_int nbPdt;
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
bool found=false;
- for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+ for(int j=0;j<MED_N_CELL_FIXED_GEO && !found;j++)
{
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
for(int k=0;k<nbPdt;k++)
{
- MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+ int profilesize,nbi;
+ MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi);
std::string maa_ass_cpp(maa_ass);
- if(meshNameCpp==maa_ass_cpp)
+ if(meshNameCpp==maa_ass_cpp && nbOfVal>0)
{
found=true;
ret.push_back(std::make_pair(numdt,numo));
}
}
}
- delete [] maa_ass;
- delete [] dt_unit;
- delete [] nomcha;
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
CheckFileForRead(fileName);
std::string meshNameCpp(meshName);
std::vector< std::pair<int,int> > ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
//
- med_type_champ typcha;
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
+ med_field_type typcha;
+ med_int numdt=0,numo=0;
med_float dt=0.0;
- med_booleen local;
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ char pflname[MED_NAME_SIZE+1]="";
+ char locname[MED_NAME_SIZE+1]="";
+ INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localmesh;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ med_int nbPdt;
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
for(int k=0;k<nbPdt;k++)
{
- MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+ int profilesize,nbi;
+ MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
+ med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi);
std::string maa_ass_cpp(maa_ass);
- if(meshNameCpp==maa_ass_cpp)
+ if(meshNameCpp==maa_ass_cpp && nbOfVal>0)
{
ret.push_back(std::make_pair(numdt,numo));
}
}
}
}
- delete [] maa_ass;
- delete [] dt_unit;
- delete [] nomcha;
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
double& time, std::vector<std::string>& infos)
{
time=0.;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nbFields=MEDnChamp(fid,0);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nbFields=MEDnField(fid);
//
- med_type_champ typcha;
- char nomcha[MED_TAILLE_NOM+1]="";
- char pflname [MED_TAILLE_NOM+1]="";
- char locname [MED_TAILLE_NOM+1]="";
- std::map<ParaMEDMEM::TypeOfField, med_entite_maillage> tabEnt;
- std::map<ParaMEDMEM::TypeOfField, med_geometrie_element *> tabType;
+ med_field_type typcha;
+ char nomcha[MED_NAME_SIZE+1]="";
+ char pflname [MED_NAME_SIZE+1]="";
+ char locname [MED_NAME_SIZE+1]="";
+ std::map<ParaMEDMEM::TypeOfField, med_entity_type> tabEnt;
+ std::map<ParaMEDMEM::TypeOfField, med_geometry_type *> tabType;
std::map<ParaMEDMEM::TypeOfField, int> tabTypeLgth;
- tabEnt[ON_CELLS]=MED_MAILLE;
+ med_bool localmesh;
+ tabEnt[ON_CELLS]=MED_CELL;
tabType[ON_CELLS]=typmai;
- tabTypeLgth[ON_CELLS]=MED_NBR_GEOMETRIE_MAILLE+2;
- tabEnt[ON_NODES]=MED_NOEUD;
+ tabTypeLgth[ON_CELLS]=MED_N_CELL_FIXED_GEO;
+ tabEnt[ON_NODES]=MED_NODE;
tabType[ON_NODES]=typmainoeud;
tabTypeLgth[ON_NODES]=1;
- tabEnt[ON_GAUSS_PT]=MED_MAILLE;
+ tabEnt[ON_GAUSS_PT]=MED_CELL;
tabType[ON_GAUSS_PT]=typmai;
- tabTypeLgth[ON_GAUSS_PT]=MED_NBR_GEOMETRIE_MAILLE+2;
- tabEnt[ON_GAUSS_NE]=MED_MAILLE;
+ tabTypeLgth[ON_GAUSS_PT]=MED_N_CELL_FIXED_GEO;
+ tabEnt[ON_GAUSS_NE]=MED_NODE_ELEMENT;
tabType[ON_GAUSS_NE]=typmai;
- tabTypeLgth[ON_GAUSS_NE]=MED_NBR_GEOMETRIE_MAILLE+2;
+ tabTypeLgth[ON_GAUSS_NE]=MED_N_CELL_FIXED_GEO;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDnChamp(fid,i+1);
- char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
- char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
- MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
+ med_int ncomp=MEDfieldnComponent(fid,i+1);
+ INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1];
+ INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_int nbPdt;
+ MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
+ if(curMeshName!=meshName)
+ {
+ MEDfileClose(fid);
+ throw INTERP_KERNEL::Exception("Invalid meshname on field !");
+ }
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
infos.resize(ncomp);
for(int i=0;i<ncomp;i++)
- infos[i]=MEDLoaderBase::buildUnionUnit(comp+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM,unit+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
+ infos[i]=MEDLoaderBase::buildUnionUnit(comp+i*MED_SNAME_SIZE,MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
bool found=false;
+ bool found2=false;
+ med_int numdt=0,numo=0;
+ med_float dt=0.0;
+ for(int k=0;k<nbPdt && !found2;k++)
+ {
+ MEDfieldComputingStepInfo(fid,fieldName,k+1,&numdt,&numo,&dt);
+ found2=(numdt==iteration && numo==order);
+ if(found2)
+ time=dt;
+ }
+ if(!found2)
+ {
+ std::ostringstream oss; oss << "FieldDouble in file \""<< fileName<< "\" with name \"" << fieldName << "\" on mesh \"" << meshName;
+ oss << "\" does not have such time step : iteration=" << iteration << " order=" << order << std::endl;
+ MEDfileClose(fid);
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
for(int j=0;j<tabTypeLgth[typeOfOutField] && !found;j++)
{
- med_int nbPdt=MEDnPasdetemps(fid,nomcha,tabEnt[typeOfOutField],typmai[j]);
if(nbPdt>0)
{
- int nval=MEDnVal(fid,(char *)fieldName,tabEnt[typeOfOutField],tabType[typeOfOutField][j],iteration,order,(char *)meshName,MED_COMPACT);
- double *valr=new double[ncomp*nval];
- //
- med_int ngauss=0;
- med_int numdt=0,numo=0,nbrefmaa;
- char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
- char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- med_float dt=0.0;
- med_booleen local;
- med_int nbPdt=MEDnPasdetemps(fid,(char *)fieldName,tabEnt[typeOfOutField],tabType[typeOfOutField][j]);
- bool found2=false;
- for(int k=0;k<nbPdt && !found2;k++)
+ int profilesize,nbi;
+ int nval=MEDfieldnValueWithProfile(fid,fieldName,numdt,numo,tabEnt[typeOfOutField],tabType[typeOfOutField][j],1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi);
+ if(nval>0)
{
- MEDpasdetempsInfo(fid,(char *)fieldName,tabEnt[typeOfOutField],tabType[typeOfOutField][j],k+1,&ngauss,
- &numdt,&numo,dt_unit,&dt,maa_ass,&local,&nbrefmaa);
- found2=(numdt==iteration && numo==order);
- if(found2)
- time=dt;
- }
- if(!found2)
- {
- std::ostringstream oss; oss << "FieldDouble in file \""<< fileName<< "\" with name \"" << fieldName << "\" on mesh \"" << meshName;
- oss << "\" does not have such time step : iteration=" << iteration << " order=" << order << std::endl;
- delete [] valr;
- delete [] comp;
- delete [] unit;
- delete [] dt_unit;
- delete [] maa_ass;
- MEDfermer(fid);
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
- MEDchampLire(fid,(char *)meshName,(char *)fieldName,(unsigned char*)valr,MED_FULL_INTERLACE,MED_ALL,locname,
- pflname,MED_COMPACT,tabEnt[typeOfOutField],tabType[typeOfOutField][j],iteration,order);
- std::string tmp(locname);
- if((locname[0]!='\0' && (typeOfOutField!=ON_GAUSS_PT && typeOfOutField!=ON_GAUSS_NE))
- || (tmp!=MED_GAUSS_ELNO && typeOfOutField==ON_GAUSS_NE)
- || (locname[0]=='\0' && typeOfOutField==ON_GAUSS_PT)
- || (tmp==MED_GAUSS_ELNO && typeOfOutField==ON_GAUSS_PT))
- {
- delete [] dt_unit;
- delete [] maa_ass;
- delete [] valr;
- continue;
- }
- int *pfl=0;
- if(pflname[0]!='\0')
- {
- pfl=new int[nval];
- MEDprofilLire(fid,pfl,pflname);
+ double *valr=new double[ncomp*nval*nbi];
+ MEDfieldValueWithProfileRd(fid,fieldName,iteration,order,tabEnt[typeOfOutField],tabType[typeOfOutField][j],MED_COMPACT_PFLMODE,
+ pflname,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,(unsigned char*)valr);
+ std::string tmp(locname);
+ if((locname[0]!='\0' && (typeOfOutField!=ON_GAUSS_PT))
+ || (locname[0]=='\0' && typeOfOutField==ON_GAUSS_PT))
+ {
+ delete [] valr;
+ continue;
+ }
+ INTERP_KERNEL::AutoPtr<int> pfl=0;
+ if(pflname[0]!='\0')
+ {
+ pfl=new int[nval];
+ MEDprofileRd(fid,pflname,pfl);
+ }
+ field.push_back(MEDLoader::MEDFieldDoublePerCellType(typmai2[j],valr,ncomp,nval*nbi,pfl,locname));
}
- field.push_back(MEDLoader::MEDFieldDoublePerCellType(typmai2[j],valr,ncomp,nval,pfl,locname));
- delete [] pfl;
- delete [] dt_unit;
- delete [] maa_ass;
}
}
}
- delete [] comp;
- delete [] unit;
}
- MEDfermer(fid);
+ MEDfileClose(fid);
}
std::vector<int> MEDLoaderNS::getIdsFromFamilies(const char *fileName, const char *meshName, const std::vector<std::string>& fams)
{
std::vector<int> ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nfam=MEDnFam(fid,(char *)meshName);
- char nomfam[MED_TAILLE_NOM+1];
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName);
+ char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnGroupe(fid,(char *)meshName,i+1);
- med_int natt=MEDnAttribut(fid,(char *)meshName,i+1);
- med_int *attide=new int[natt];
- med_int *attval=new int[natt];
- char *attdes=new char[MED_TAILLE_DESC*natt+1];
- char *gro=new char[MED_TAILLE_LNOM*ngro+1];
- MEDfamInfo(fid,(char *)meshName,i+1,nomfam,&numfam,attide,attval,attdes,&natt,gro,&ngro);
+ int ngro=MEDnFamilyGroup(fid,meshName,i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
+ INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
+ MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
if(std::find(fams.begin(),fams.end(),cur)!=fams.end())
ret.push_back(numfam);
- delete [] attdes;
- delete [] gro;
- delete [] attide;
- delete [] attval;
}
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
std::vector<int> MEDLoaderNS::getIdsFromGroups(const char *fileName, const char *meshName, const std::vector<std::string>& grps)
{
std::vector<int> ret;
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
- med_int nfam=MEDnFam(fid,(char *)meshName);
- char nomfam[MED_TAILLE_NOM+1];
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName);
+ char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnGroupe(fid,(char *)meshName,i+1);
- med_int natt=MEDnAttribut(fid,(char *)meshName,i+1);
- med_int *attide=new int[natt];
- med_int *attval=new int[natt];
- char *attdes=new char[MED_TAILLE_DESC*natt+1];
- char *gro=new char[MED_TAILLE_LNOM*ngro+1];
- MEDfamInfo(fid,(char *)meshName,i+1,nomfam,&numfam,attide,attval,attdes,&natt,gro,&ngro);
+ int ngro=MEDnFamilyGroup(fid,meshName,i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
+ INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
+ INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
+ MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
for(int j=0;j<ngro;j++)
{
- std::string cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ std::string cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
if(std::find(grps.begin(),grps.end(),cur)!=grps.end())
{
ret.push_back(numfam);
break;
}
}
- delete [] attdes;
- delete [] gro;
- delete [] attide;
- delete [] attval;
}
- MEDfermer(fid);
+ MEDfileClose(fid);
return ret;
}
/*!
* This methods allows to merger all entities and to considerate only cell types.
*/
-void MEDLoaderNS::dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entite_maillage& whichEntity)
+void MEDLoaderNS::dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity)
{
if(nbOfElemCell>=nbOfElemFace)
{
- whichEntity=MED_MAILLE;
+ whichEntity=MED_CELL;
nbOfElem=nbOfElemCell;
}
else
{
- whichEntity=MED_FACE;
+ whichEntity=MED_CELL;
nbOfElem=nbOfElemFace;
}
}
int MEDLoaderNS::readUMeshDimFromFile(const char *fileName, const char *meshName, std::vector<int>& possibilities)
{
possibilities.clear();
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
int ret;
std::set<int> poss;
- char nommaa[MED_TAILLE_NOM+1];
- char maillage_description[MED_TAILLE_DESC+1];
- med_maillage type_maillage;
- med_int Mdim;
+ char nommaa[MED_NAME_SIZE+1];
+ char maillage_description[MED_COMMENT_SIZE+1];
+ med_mesh_type type_maillage;
+ med_int Sdim,Mdim;
std::string trueMeshName;
med_int meshId=getIdFromMeshName(fid,meshName,trueMeshName);
- MEDmaaInfo(fid,meshId,nommaa,&Mdim,&type_maillage,maillage_description);
- for(int i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- {
- med_geometrie_element curMedType=typmai[i];
- int curNbOfElemM=MEDnEntMaa(fid,nommaa,MED_CONN,MED_MAILLE,curMedType,MED_NOD);
- int curNbOfElemF=MEDnEntMaa(fid,nommaa,MED_CONN,MED_FACE,curMedType,MED_NOD);
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ med_sorting_type sortingType;
+ med_int nstep;
+ med_axis_type axisType;
+ int naxis=MEDmeshnAxis(fid,meshId);
+ INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
+ MEDmeshInfo(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit);
+ // limitation
+ if(nstep!=1)
+ {
+ throw INTERP_KERNEL::Exception("multisteps on mesh not managed yet !");
+ }
+ med_int numdt,numit;
+ med_float dt;
+ MEDmeshComputationStepInfo(fid,nommaa,1,&numdt,&numit,&dt);
+ // endlimitation
+ for(int i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
+ {
+ med_geometry_type curMedType=typmai[i];
+ med_bool changement,transformation;
+ int curNbOfElemM=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);
+ int curNbOfElemF=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);//limitation
int curNbOfElem;
- med_entite_maillage whichEntity;
+ med_entity_type whichEntity;
MEDLoaderNS::dispatchElems(curNbOfElemM,curNbOfElemF,curNbOfElem,whichEntity);
if(curNbOfElem>0)
{
INTERP_KERNEL::NormalizedCellType type=typmai2[i];
- int curDim=(int)INTERP_KERNEL::CellModel::getCellModel(type).getDimension();
+ int curDim=(int)INTERP_KERNEL::CellModel::GetCellModel(type).getDimension();
poss.insert(curDim);
}
}
- MEDfermer(fid);
+ MEDfileClose(fid);
if(!poss.empty())
{
ret=*poss.rbegin();
return ret;
}
-void MEDLoaderNS::readUMeshDataInMedFile(med_idt fid, med_int meshId, DataArrayDouble *&coords, std::list<MEDLoader::MEDConnOfOneElemType>& conn)
+void MEDLoaderNS::readUMeshDataInMedFile(med_idt fid, med_int meshId, DataArrayDouble *&coords, std::list<MEDLoader::MEDConnOfOneElemType>& conn, std::string& description)
{
- char nommaa[MED_TAILLE_NOM+1];
- char maillage_description[MED_TAILLE_DESC+1];
- med_maillage type_maillage;
+ char nommaa[MED_NAME_SIZE+1];
+ char maillage_description[MED_COMMENT_SIZE+1];
+ med_mesh_type type_maillage;
med_int Mdim;
- MEDmaaInfo(fid,meshId,nommaa,&Mdim,&type_maillage,maillage_description);
- med_int edim=MEDdimEspaceLire(fid,nommaa);
- int spaceDim=std::max((int)Mdim,(int)edim);
- int nCoords=MEDnEntMaa(fid,nommaa,MED_COOR,MED_NOEUD,(med_geometrie_element)0,(med_connectivite)0);
+ med_int Sdim;
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ med_sorting_type sortingType;
+ med_int nstep;
+ med_axis_type axisType;
+ med_int numdt,numit;
+ med_float dt;
+ med_bool changement,transformation;
+ // endlimitation
+ Sdim=MEDmeshnAxis(fid,1);
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(Sdim*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(Sdim*MED_SNAME_SIZE);
+ MEDmeshInfo(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,comp,unit);
+ description=MEDLoaderBase::buildStringFromFortran(maillage_description,sizeof(maillage_description));
+ MEDmeshComputationStepInfo(fid,nommaa,1,&numdt,&numit,&dt);
+ int spaceDim=std::max((int)Mdim,(int)Sdim);
+ int nCoords=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation);
+ // limitation
+ if(nstep!=1)
+ {
+ throw INTERP_KERNEL::Exception("multisteps on mesh not managed yet !");
+ }
coords=DataArrayDouble::New();
coords->alloc(nCoords,spaceDim);
double *coordsPtr=coords->getPointer();
- med_repere repere;
- char *comp=MEDLoaderBase::buildEmptyString(spaceDim*MED_TAILLE_PNOM);
- char *unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_TAILLE_PNOM);
- MEDcoordLire(fid,nommaa,spaceDim,coordsPtr,MED_FULL_INTERLACE,MED_ALL,NULL,0,&repere,comp,unit);
+ MEDmeshNodeCoordinateRd(fid,nommaa,numdt,numit,MED_FULL_INTERLACE,coordsPtr);
for(int i=0;i<spaceDim;i++)
{
- std::string n,u;
- std::string info=MEDLoaderBase::buildUnionUnit(comp+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM,unit+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
+ std::string info=MEDLoaderBase::buildUnionUnit(comp+i*MED_SNAME_SIZE,MED_SNAME_SIZE,unit+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
coords->setInfoOnComponent(i,info.c_str());
}
- delete [] comp;
- delete [] unit;
- med_booleen inoele, inuele;
- for(int i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
+ for(int i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
{
- med_geometrie_element curMedType=typmai[i];
- med_entite_maillage whichEntity;
- int curNbOfElemM=MEDnEntMaa(fid,nommaa,MED_CONN,MED_MAILLE,curMedType,MED_NOD);
- int curNbOfElemF=MEDnEntMaa(fid,nommaa,MED_CONN,MED_FACE,curMedType,MED_NOD);
+ med_geometry_type curMedType=typmai[i];
+ med_entity_type whichEntity;
+ int curNbOfElemM=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);
+ int curNbOfElemF=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);//limitation
int curNbOfElem;
MEDLoaderNS::dispatchElems(curNbOfElemM,curNbOfElemF,curNbOfElem,whichEntity);
if(curNbOfElem>0)
int *connTab=new int[(curMedType%100)*curNbOfElem];
int *fam=new int[curNbOfElem];
MEDLoader::MEDConnOfOneElemType elem(typmai2[i],connTab,0,fam,curNbOfElem,-1);
- int *tmp=new int[curNbOfElem];
- char *noms=new char[MED_TAILLE_PNOM*curNbOfElem+1];
- MEDelementsLire(fid,nommaa,Mdim,connTab,MED_FULL_INTERLACE,noms,&inoele,tmp,&inuele,fam,curNbOfElem,whichEntity,curMedType,MED_NOD);
- delete [] tmp;
+ char *noms=new char[MED_SNAME_SIZE*curNbOfElem+1];
+ med_bool withname=MED_FALSE,withnumber=MED_FALSE,withfam=MED_FALSE;
+ int *globArr=new int[curNbOfElem];
+ MEDmeshElementRd(fid,nommaa,numdt,numit,whichEntity,curMedType,MED_NODAL,MED_FULL_INTERLACE,connTab,&withname,noms,&withnumber,globArr,&withfam,fam);
+ if(!withfam)
+ std::fill(fam,fam+curNbOfElem,0);
delete [] noms;
//trying to read global numbering
- int *globArr=new int[curNbOfElem];
- if(MEDnumLire(fid,nommaa,globArr,curNbOfElem,whichEntity,curMedType)==0)
+ if(withnumber)
elem.setGlobal(globArr);
else
delete [] globArr;
+ //limitation manage withfam==false
conn.push_back(elem);
}
}
int curNbOfPolyElem;
- int curNbOfPolyElemM=MEDnEntMaa(fid,nommaa,MED_CONN,MED_MAILLE,MED_POLYGONE,MED_NOD);
- int curNbOfPolyElemF=MEDnEntMaa(fid,nommaa,MED_CONN,MED_FACE,MED_POLYGONE,MED_NOD);
- med_entite_maillage whichPolyEntity;
+ int curNbOfPolyElemM=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYGON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1;
+ int curNbOfPolyElemF=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYGON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1;//limitation
+ med_entity_type whichPolyEntity;
MEDLoaderNS::dispatchElems(curNbOfPolyElemM,curNbOfPolyElemF,curNbOfPolyElem,whichPolyEntity);
if(curNbOfPolyElem>0)
{
- med_int arraySize;
- MEDpolygoneInfo(fid,nommaa,whichPolyEntity,MED_NOD,&arraySize);
+ med_int arraySize=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYGON,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);
int *index=new int[curNbOfPolyElem+1];
int *locConn=new int[arraySize];
int *fam=new int[curNbOfPolyElem];
int *globArr=new int[curNbOfPolyElem];
MEDLoader::MEDConnOfOneElemType elem(INTERP_KERNEL::NORM_POLYGON,locConn,index,fam,curNbOfPolyElem,arraySize);
- MEDpolygoneConnLire(fid,nommaa,index,curNbOfPolyElem+1,locConn,whichPolyEntity,MED_NOD);
- MEDfamLire(fid,nommaa,fam,curNbOfPolyElem,whichPolyEntity,MED_POLYGONE);
- if(MEDnumLire(fid,nommaa,globArr,curNbOfPolyElem,whichPolyEntity,MED_POLYGONE)==0)
- elem.setGlobal(globArr);
+ MEDmeshPolygonRd(fid,nommaa,numdt,numit,MED_CELL,MED_NODAL,index,locConn);
+ if(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYGON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYGON,fam)!=0)
+ std::fill(fam,fam+curNbOfPolyElem,0);
+ }
+ else
+ std::fill(fam,fam+curNbOfPolyElem,0);
+ if(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYGON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYGON,globArr)==0)
+ elem.setGlobal(globArr);
+ else
+ delete [] globArr;
+ }
else
delete [] globArr;
conn.push_back(elem);
}
- curNbOfPolyElem=MEDnEntMaa(fid,nommaa,MED_CONN,MED_MAILLE,MED_POLYEDRE,MED_NOD);
+ curNbOfPolyElem=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1;
if(curNbOfPolyElem>0)
{
med_int indexFaceLgth,connFaceLgth;
- MEDpolyedreInfo(fid,nommaa,MED_NOD,&indexFaceLgth,&connFaceLgth);
- int *index=new int[curNbOfPolyElem+1];
- int *indexFace=new int[indexFaceLgth];
- int *locConn=new int[connFaceLgth];
+ indexFaceLgth=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation);
+ connFaceLgth=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);
+ INTERP_KERNEL::AutoPtr<int> index=new int[curNbOfPolyElem+1];
+ INTERP_KERNEL::AutoPtr<int> indexFace=new int[indexFaceLgth];
+ INTERP_KERNEL::AutoPtr<int> locConn=new int[connFaceLgth];
int *fam=new int[curNbOfPolyElem];
int *globArr=new int[curNbOfPolyElem];
- MEDpolyedreConnLire(fid,nommaa,index,curNbOfPolyElem+1,indexFace,indexFaceLgth,locConn,MED_NOD);
- MEDfamLire(fid,nommaa,fam,curNbOfPolyElem,MED_MAILLE,MED_POLYEDRE);
+ MEDmeshPolyhedronRd(fid,nommaa,numdt,numit,MED_CELL,MED_NODAL,index,indexFace,locConn);
+ if(MEDmeshnEntity(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYHEDRON,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYHEDRON,fam)!=0)
+ std::fill(fam,fam+curNbOfPolyElem,0);
+ }
+ else
+ std::fill(fam,fam+curNbOfPolyElem,0);
int arraySize=connFaceLgth;
for(int i=0;i<curNbOfPolyElem;i++)
arraySize+=index[i+1]-index[i]-1;
wFinalConn=std::copy(locConn+indexFace[j]-1,locConn+indexFace[j+1]-1,wFinalConn);
}
}
- delete [] index;
- delete [] locConn;
- delete [] indexFace;
MEDLoader::MEDConnOfOneElemType elem(INTERP_KERNEL::NORM_POLYHED,finalConn,finalIndex,fam,curNbOfPolyElem,arraySize);
- if(MEDnumLire(fid,nommaa,globArr,curNbOfPolyElem,MED_MAILLE,MED_POLYEDRE)==0)
- elem.setGlobal(globArr);
+ if(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
+ {
+ if(MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,whichPolyEntity,MED_POLYHEDRON,globArr)==0)
+ elem.setGlobal(globArr);
+ else
+ delete [] globArr;
+ }
else
delete [] globArr;
conn.push_back(elem);
unsigned ret=0;
for(typename std::list<T>::const_iterator iter=conn.begin();iter!=conn.end();iter++)
{
- unsigned curDim=INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getDimension();
+ unsigned curDim=INTERP_KERNEL::CellModel::GetCellModel((*iter).getType()).getDimension();
if(ret<curDim)
ret=curDim;
}
{
for(typename std::list<T>::iterator iter=conn.begin();iter!=conn.end();)
{
- unsigned curDim=INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getDimension();
+ unsigned curDim=INTERP_KERNEL::CellModel::GetCellModel((*iter).getType()).getDimension();
if(curDim!=meshDim)
{
(*iter).releaseArray();
{
if((*iter).getGlobal()==0)
renumber=false;
- const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::getCellModel((*iter).getType());
+ const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::GetCellModel((*iter).getType());
if(keepAll)
totalNbOfCells+=(*iter).getLength();
else
const int *sourceConn=(*iter).getArray();
const int *sourceIndex=(*iter).getIndex();
const int *globalNum=(*iter).getGlobal();
- const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::GetCellModel(type);
int nbOfCellsInCurType;
int nbOfNodesIn1Cell=cellMod.getNumberOfNodes();
nbOfCellsInCurType=(*iter).getLength();
std::vector<int>& connIndex4MEDFile, std::vector<int>& connIndexRk24MEDFile, std::vector<int>& fam4MEDFile, std::vector<int>& renumber)
{
- const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::getCellModel(type);
+ const INTERP_KERNEL::CellModel& cellMod=INTERP_KERNEL::CellModel::GetCellModel(type);
if(!cellMod.isDynamic())
return buildMEDSubConnectivityOfOneTypeStaticTypes(conn,connIndex,families,type,conn4MEDFile,fam4MEDFile,renumber);
else
if(meshDimRelToMax>0)
throw INTERP_KERNEL::Exception("meshDimRelToMax must be <=0 !");
//Extraction data from MED file.
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
std::string trueMeshName;
med_int mid=getIdFromMeshName(fid,meshName,trueMeshName);
DataArrayDouble *coords=0;
std::list<MEDLoader::MEDConnOfOneElemType> conn;
- readUMeshDataInMedFile(fid,mid,coords,conn);
+ std::string descr;
+ readUMeshDataInMedFile(fid,mid,coords,conn,descr);
meshDimExtract=MEDLoaderNS::calculateHighestMeshDim<MEDLoader::MEDConnOfOneElemType>(conn);
meshDimExtract=meshDimExtract+meshDimRelToMax;
MEDLoaderNS::keepSpecifiedMeshDim<MEDLoader::MEDConnOfOneElemType>(conn,meshDimExtract);
MEDLoaderNS::keepTypes<MEDLoader::MEDConnOfOneElemType>(conn,typesToKeep);
- MEDfermer(fid);
+ MEDfileClose(fid);
//Put data in returned data structure.
MEDCouplingUMesh *ret=MEDCouplingUMesh::New();
ret->setName(trueMeshName.c_str());
+ ret->setDescription(descr.c_str());
ret->setMeshDimension(meshDimExtract);
//
ret->setCoords(coords);
ParaMEDMEM::MEDCouplingFieldDouble *MEDLoaderNS::readFieldDoubleLev2(const char *fileName, ParaMEDMEM::TypeOfField typeOfOutField, unsigned meshDim, const int *cellRenum, const ParaMEDMEM::MEDCouplingUMesh *mesh,
const std::vector<std::string>& infos, const char *fieldName, int iteration, int order, double time,
- std::list<MEDLoader::MEDFieldDoublePerCellType>& fieldPerCellType)
+ std::list<MEDLoader::MEDFieldDoublePerCellType>& fieldPerCellType) throw(INTERP_KERNEL::Exception)
{
if(typeOfOutField==ON_CELLS || typeOfOutField==ON_GAUSS_PT || typeOfOutField==ON_GAUSS_NE)
MEDLoaderNS::keepSpecifiedMeshDim<MEDLoader::MEDFieldDoublePerCellType>(fieldPerCellType,meshDim);
+ if(fieldPerCellType.empty())
+ {
+ std::ostringstream oss; oss << "Error on reading file \"" << fileName << "\" meshName=\"" << mesh->getName();
+ oss << std::endl << "FieldName=\"" << fieldName << "\" (iteration=" << iteration << ",order=" << order << ")" << std::endl;
+ if(typeOfOutField==ON_CELLS || typeOfOutField==ON_GAUSS_PT || typeOfOutField==ON_GAUSS_NE)
+ oss << "Request for cell field, maybe it is an ON_NODES field ?";
+ else
+ oss << "Request for a node field, maybe it is an ON_CELLS field ?";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
//for profiles
ParaMEDMEM::MEDCouplingUMesh *newMesh=0;
std::string mName(mesh->getName());
if(typeOfOutField==ON_CELLS)
{
if(newMesh)
- mesh2=newMesh->keepSpecifiedCells((*iter).getType(),ci);
+ mesh2=newMesh->keepSpecifiedCells((*iter).getType(),&ci[0],&ci[0]+ci.size());
else
- mesh2=mesh->keepSpecifiedCells((*iter).getType(),ci);
+ mesh2=mesh->keepSpecifiedCells((*iter).getType(),&ci[0],&ci[0]+ci.size());
}
else if(typeOfOutField==ON_NODES)
{
mesh2=dynamic_cast<MEDCouplingUMesh *>(mesh->buildPartAndReduceNodes(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems(),da2));
//
int nnodes=mesh2->getNumberOfNodes();
- DataArrayInt *da3=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=DataArrayInt::New();
const int *da2Ptr=da2->getConstPointer();
da3->alloc(nnodes,1);
int *da3Ptr=da3->getPointer();
da3Ptr[val]=i;
}
mesh2->renumberNodes(da3->getConstPointer(),nnodes);
- da3->decrRef();
}
else
{
}
ParaMEDMEM::MEDCouplingFieldDouble *MEDLoaderNS::readFieldDoubleLev1(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order,
- ParaMEDMEM::TypeOfField typeOfOutField)
+ ParaMEDMEM::TypeOfField typeOfOutField) throw(INTERP_KERNEL::Exception)
{
std::list<MEDLoader::MEDFieldDoublePerCellType> fieldPerCellType;
double time;
typesToKeep.push_back((*iter).getType());
unsigned meshDim;
int *cellRenum;
- ParaMEDMEM::MEDCouplingUMesh *mesh=readUMeshFromFileLev1(fileName,meshName,meshDimRelToMax,familiesToKeep,typesToKeep,meshDim,cellRenum);
+ if(fieldPerCellType.empty())
+ {
+ std::ostringstream oss; oss << "Error on reading file \"" << fileName << "\" meshName=\"" << meshName << "\" meshDimRelToMax=" << meshDimRelToMax;
+ oss << std::endl << "FieldName=\"" << fieldName << "\" (iteration=" << iteration << ",order=" << order << ")" << std::endl;
+ if(typeOfOutField==ON_CELLS || typeOfOutField==ON_GAUSS_PT || typeOfOutField==ON_GAUSS_NE)
+ oss << "Request for cell field, maybe it is a node instead or by changing meshDimRelToMax ?";
+ else
+ oss << "Request for a node field, maybe it is a cell field instead ?";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingUMesh> mesh=readUMeshFromFileLev1(fileName,meshName,meshDimRelToMax,familiesToKeep,typesToKeep,meshDim,cellRenum);
ParaMEDMEM::MEDCouplingFieldDouble *ret=readFieldDoubleLev2(fileName,typeOfOutField,meshDim,cellRenum,mesh,infos,fieldName,iteration,order,time,fieldPerCellType);
if(cellRenum)
mesh->renumberCells(cellRenum,true);
- mesh->decrRef();
//clean-up
delete [] cellRenum;
releaseMEDFileCoreFrmt<MEDLoader::MEDFieldDoublePerCellType>(fieldPerCellType);
typesToKeep.push_back((*iter).getType());
unsigned meshDim;
int *cellRenum;
- ParaMEDMEM::MEDCouplingUMesh *m1=MEDLoaderNS::readUMeshFromFileLev1(fileName,meshName,meshDimRelToMax,familiesToKeep,typesToKeep,meshDim,cellRenum);
+ MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingUMesh> m1=MEDLoaderNS::readUMeshFromFileLev1(fileName,meshName,meshDimRelToMax,familiesToKeep,typesToKeep,meshDim,cellRenum);
ret[0]=MEDLoaderNS::readFieldDoubleLev2(fileName,type,meshDim,cellRenum,m1,infos,fieldName,its[0].first,its[0].second,time,fieldPerCellType);
if(cellRenum)
m1->renumberCells(cellRenum,true);
//clean-up
MEDLoaderNS::releaseMEDFileCoreFrmt<MEDLoader::MEDFieldDoublePerCellType>(fieldPerCellType);
}
- m1->decrRef();
delete [] cellRenum;
return ret;
}
*/
void MEDLoaderNS::writeUMeshesDirectly(const char *fileName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& mesh, const std::vector<const DataArrayInt *>& families, bool forceFromScratch, bool &isRenumbering)
{
- med_idt fid=MEDouvrir((char *)fileName,forceFromScratch?MED_CREATION:MED_LECTURE_ECRITURE);
+ med_idt fid=MEDfileOpen(fileName,forceFromScratch?MED_ACC_CREAT:MED_ACC_RDWR);
std::string meshName(mesh[0]->getName());
if(meshName=="")
{
- MEDfermer(fid);
+ MEDfileClose(fid);
throw INTERP_KERNEL::Exception("MEDCouplingMesh must have a not null name !");
}
isRenumbering=false;
std::set<INTERP_KERNEL::NormalizedCellType> allTypes;
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=mesh.begin();iter!=mesh.end();iter++)
{
- isRenumbering|=!(*iter)->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2);
+ isRenumbering|=!(*iter)->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
isFamilies&=(families[std::distance(mesh.begin(),iter)]!=0);
conn.push_back((*iter)->getNodalConnectivity());
connIndex.push_back((*iter)->getNodalConnectivityIndex());
const std::set<INTERP_KERNEL::NormalizedCellType>& curTypes=(*iter)->getAllTypes();
allTypes.insert(curTypes.begin(),curTypes.end());
}
- char *maa=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- char *desc=MEDLoaderBase::buildEmptyString(MED_TAILLE_DESC);
- MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_TAILLE_NOM,maa,MEDLoader::_TOO_LONG_STR);
- MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_TAILLE_DESC,desc,MEDLoader::_TOO_LONG_STR);
+ INTERP_KERNEL::AutoPtr<char> maa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> desc=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
+ MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,maa,MEDLoader::_TOO_LONG_STR);
+ MEDLoaderBase::safeStrCpy(mesh[0]->getDescription(),MED_COMMENT_SIZE,desc,MEDLoader::_TOO_LONG_STR);
const int spaceDim=mesh[0]->getSpaceDimension();
- MEDmaaCr(fid,maa,spaceDim,MED_NON_STRUCTURE,desc);
- MEDdimEspaceCr(fid,maa,spaceDim);
+ const int meshDim=mesh[0]->getMeshDimension();
+ const DataArrayDouble *arr=mesh[0]->getCoords();
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
+ for(int i=0;i<spaceDim;i++)
+ {
+ std::string info=arr->getInfoOnComponent(i);
+ std::string c,u;
+ MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
+ MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,MEDLoader::_TOO_LONG_STR);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
+ MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,MEDLoader::_TOO_LONG_STR);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
+ }
+ MEDmeshCr(fid,maa,spaceDim,meshDim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MED_CARTESIAN,comp,unit);
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=mesh.begin();iter!=mesh.end();iter++)
{
- for(int i=0;i<MED_NBR_GEOMETRIE_MAILLE+2;i++)
+ for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
{
- med_geometrie_element curMedType=typmai[i];
+ med_geometry_type curMedType=typmai[i];
INTERP_KERNEL::NormalizedCellType curType=typmai2[i];
if(allTypes.find(curType)!=allTypes.end())
{
std::vector<int> fam;
std::vector<int> renumber;
int nbOfElt=MEDLoaderNS::buildMEDSubConnectivityOfOneType(conn,connIndex,families,curType,medConn,medConnIndex,medConnIndex2,fam,renumber);
- if(curMedType!=MED_POLYGONE && curMedType!=MED_POLYEDRE)
- MEDconnEcr(fid,maa,(*iter)->getMeshDimension(),&medConn[0],MED_FULL_INTERLACE,nbOfElt,MED_MAILLE,curMedType,MED_NOD);
+ if(curMedType!=MED_POLYGON && curMedType!=MED_POLYHEDRON)
+ MEDmeshElementConnectivityWr(fid,maa,-1,-1,0.,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfElt,&medConn[0]);
else
{
- if(curMedType==MED_POLYGONE)
- MEDpolygoneConnEcr(fid,maa,&medConnIndex[0],medConnIndex.size(),&medConn[0],MED_MAILLE,MED_NOD);
- if(curMedType==MED_POLYEDRE)
+ if(curMedType==MED_POLYGON)
+ MEDmeshPolygonWr(fid,maa,-1,-1,0.,MED_CELL,MED_NODAL,medConnIndex.size(),&medConnIndex[0],&medConn[0]);
+ if(curMedType==MED_POLYHEDRON)
{
- MEDpolyedreConnEcr(fid,maa,&medConnIndex2[0],medConnIndex2.size(),&medConnIndex[0],medConnIndex.size(),
- &medConn[0],MED_NOD);
+ MEDmeshPolyhedronWr(fid,maa,-1,-1,0.,MED_CELL,MED_NODAL,medConnIndex2.size(),&medConnIndex2[0],medConnIndex.size(),&medConnIndex[0],
+ &medConn[0]);
}
}
if(isFamilies)
- MEDfamEcr(fid,maa,&fam[0],nbOfElt,MED_MAILLE,curMedType);
+ MEDmeshEntityFamilyNumberWr(fid,maa,-1,-1,MED_CELL,curMedType,nbOfElt,&fam[0]);
if(isRenumbering)
- MEDnumEcr(fid,maa,&renumber[0],nbOfElt,MED_MAILLE,curMedType);
+ MEDmeshEntityNumberWr(fid,maa,-1,-1,MED_CELL,curMedType,nbOfElt,&renumber[0]);
}
}
}
- char familyName[MED_TAILLE_NOM+1];
- std::fill(familyName,familyName+MED_TAILLE_NOM+1,'\0');
+ char familyName[MED_NAME_SIZE+1];
+ std::fill(familyName,familyName+MED_NAME_SIZE+1,'\0');
const char DftFamilyName[]="DftFamily";
std::copy(DftFamilyName,DftFamilyName+sizeof(DftFamilyName),familyName);
- MEDfamCr(fid,maa,familyName,0,0,0,0,0,0,0);
- DataArrayDouble *arr=mesh[0]->getCoords();
- char *comp=MEDLoaderBase::buildEmptyString(spaceDim*MED_TAILLE_PNOM);
- char *unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_TAILLE_PNOM);
- for(int i=0;i<spaceDim;i++)
- {
- std::string info=arr->getInfoOnComponent(i);
- std::string c,u;
- MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
- MEDLoaderBase::safeStrCpy(c.c_str(),MED_TAILLE_PNOM-1,comp+i*MED_TAILLE_PNOM,MEDLoader::_TOO_LONG_STR);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
- MEDLoaderBase::safeStrCpy(u.c_str(),MED_TAILLE_PNOM-1,unit+i*MED_TAILLE_PNOM,MEDLoader::_TOO_LONG_STR);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
- }
- MEDcoordEcr(fid,maa,spaceDim,arr->getPointer(),MED_FULL_INTERLACE,mesh[0]->getNumberOfNodes(),MED_CART,comp,unit);
- delete [] comp;
- delete [] unit;
- delete [] maa;
- delete [] desc;
- MEDfermer(fid);
+ MEDfamilyCr(fid,maa,familyName,0,0,0);
+
+ MEDmeshNodeCoordinateWr(fid,maa,-1,-1,0.,MED_FULL_INTERLACE,mesh[0]->getNumberOfNodes(),arr->getPointer());
+ MEDfileClose(fid);
}
/*!
void MEDLoaderNS::writeUMeshesPartitionDirectly(const char *fileName, const char *meshName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool forceFromScratch)
{
std::string meshNameCpp(meshName);
- char *maa=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- MEDLoaderBase::safeStrCpy(meshName,MED_TAILLE_NOM,maa,MEDLoader::_TOO_LONG_STR);
+ INTERP_KERNEL::AutoPtr<char> maa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDLoaderBase::safeStrCpy(meshName,MED_NAME_SIZE,maa,MEDLoader::_TOO_LONG_STR);
if(meshNameCpp=="")
throw INTERP_KERNEL::Exception("writeUMeshesPartitionDirectly : Invalid meshName : Must be different from \"\" !");
std::vector< DataArrayInt * > corr;
- MEDCouplingUMesh *m=ParaMEDMEM::MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=ParaMEDMEM::MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
m->setName(meshName);
std::vector< std::vector<int> > fidsOfGroups;
std::vector< const DataArrayInt * > corr2(corr.begin(),corr.end());
- DataArrayInt *arr2=DataArrayInt::MakePartition(corr2,m->getNumberOfCells(),fidsOfGroups);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2=DataArrayInt::MakePartition(corr2,m->getNumberOfCells(),fidsOfGroups);
for(std::vector< DataArrayInt * >::iterator it=corr.begin();it!=corr.end();it++)
(*it)->decrRef();
bool isRenumbering;
gidsOfFamilies[fid].push_back(gid);
}
fid=0;
- med_idt fid2=MEDouvrir((char *)fileName,MED_LECTURE_ECRITURE);
+ med_idt fid2=MEDfileOpen(fileName,MED_ACC_RDWR);
for(std::set<int>::const_iterator it=familyIds.begin();it!=familyIds.end();it++,fid++)
{
int ngro=gidsOfFamilies[fid].size();
- char *groName=MEDLoaderBase::buildEmptyString(MED_TAILLE_LNOM*ngro);
+ INTERP_KERNEL::AutoPtr<char> groName=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE*ngro);
for(int i=0;i<ngro;i++)
- MEDLoaderBase::safeStrCpy(meshes[gidsOfFamilies[fid][i]]->getName(),MED_TAILLE_LNOM-1,groName+i*MED_TAILLE_LNOM,MEDLoader::_TOO_LONG_STR);//MED_TAILLE_LNOM-1 to avoid to write '\0' on next compo
+ MEDLoaderBase::safeStrCpy2(meshes[gidsOfFamilies[fid][i]]->getName(),MED_LNAME_SIZE-1,groName+i*MED_LNAME_SIZE,MEDLoader::_TOO_LONG_STR);//MED_LNAME_SIZE-1 to avoid to write '\0' on next compo
std::ostringstream oss; oss << "Family_" << *it;
- char *famName=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- MEDLoaderBase::safeStrCpy(oss.str().c_str(),MED_TAILLE_NOM,famName,MEDLoader::_TOO_LONG_STR);
- MEDfamCr(fid2,maa,famName,*it,0,0,0,0,groName,ngro);
- delete [] famName;
- delete [] groName;
+ INTERP_KERNEL::AutoPtr<char> famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDLoaderBase::safeStrCpy(oss.str().c_str(),MED_NAME_SIZE,famName,MEDLoader::_TOO_LONG_STR);
+ MEDfamilyCr(fid2,maa,famName,*it,ngro,groName);
}
- MEDfermer(fid2);
- // end families creation
- delete [] maa;
- arr2->decrRef();
- m->decrRef();
+ MEDfileClose(fid2);
}
/*!
{
med_int numdt,numo;
med_float dt;
- char *nommaa=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- MEDLoaderBase::safeStrCpy(f->getMesh()->getName(),MED_TAILLE_NOM,nommaa,MEDLoader::_TOO_LONG_STR);
+ INTERP_KERNEL::AutoPtr<char> nommaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDLoaderBase::safeStrCpy(f->getMesh()->getName(),MED_NAME_SIZE,nommaa,MEDLoader::_TOO_LONG_STR);
med_idt fid=appendFieldSimpleAtt(fileName,f,numdt,numo,dt);
int nbOfNodes=f->getMesh()->getNumberOfNodes();
const double *pt=f->getArray()->getConstPointer();
- int *profile=new int[nbOfNodes];
+ INTERP_KERNEL::AutoPtr<int> profile=new int[nbOfNodes];
std::ostringstream oss; oss << "Pfln" << f->getName();
- char *profileName=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- MEDLoaderBase::safeStrCpy(oss.str().c_str(),MED_TAILLE_NOM,profileName,MEDLoader::_TOO_LONG_STR);
- std::transform(thisMeshNodeIds,thisMeshNodeIds+nbOfNodes,profile,std::bind2nd(std::plus<int>(),1));
- MEDprofilEcr(fid,profile,nbOfNodes,profileName);
- delete [] profile;
- MEDchampEcr(fid,nommaa,(char *)f->getName(),(unsigned char*)pt,MED_FULL_INTERLACE,nbOfNodes,
- (char *)MED_NOGAUSS,MED_ALL,profileName,MED_COMPACT,MED_NOEUD,
- MED_NONE,numdt,(char *)"",dt,numo);
- delete [] profileName;
- delete [] nommaa;
- MEDfermer(fid);
+ INTERP_KERNEL::AutoPtr<char> profileName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDLoaderBase::safeStrCpy(oss.str().c_str(),MED_NAME_SIZE,profileName,MEDLoader::_TOO_LONG_STR);
+ std::transform(thisMeshNodeIds,thisMeshNodeIds+nbOfNodes,(int *)profile,std::bind2nd(std::plus<int>(),1));
+ MEDprofileWr(fid,profileName,nbOfNodes,profile);
+ MEDfieldValueWithProfileWr(fid,f->getName(),numdt,numo,dt,MED_NODE,MED_NONE,MED_COMPACT_PFLMODE,profileName,MED_NO_LOCALIZATION,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,nbOfNodes,(const unsigned char*)pt);
+ MEDfileClose(fid);
}
/*!
int number=0;
for(std::list<MEDLoader::MEDFieldDoublePerCellType>::const_iterator iter=split.begin();iter!=split.end();iter++)
{
- char *nommaa=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- MEDLoaderBase::safeStrCpy(f->getMesh()->getName(),MED_TAILLE_NOM,nommaa,MEDLoader::_TOO_LONG_STR);
- char *profileName=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ INTERP_KERNEL::AutoPtr<char> nommaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDLoaderBase::safeStrCpy(f->getMesh()->getName(),MED_NAME_SIZE,nommaa,MEDLoader::_TOO_LONG_STR);
+ INTERP_KERNEL::AutoPtr<char> profileName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
std::ostringstream oss; oss << "Pfl" << f->getName() << "_" << number++;
- MEDLoaderBase::safeStrCpy(oss.str().c_str(),MED_TAILLE_NOM,profileName,MEDLoader::_TOO_LONG_STR);
+ MEDLoaderBase::safeStrCpy(oss.str().c_str(),MED_NAME_SIZE,profileName,MEDLoader::_TOO_LONG_STR);
const std::vector<int>& ids=(*iter).getCellIdPerType();
int *profile=new int [ids.size()];
std::transform(ids.begin(),ids.end(),profile,std::bind2nd(std::plus<int>(),1));
- MEDprofilEcr(fid,profile,ids.size(),profileName);
+ MEDprofileWr(fid,profileName,ids.size(),profile);
delete [] profile;
- MEDchampEcr(fid,nommaa,(char *)f->getName(),(unsigned char*)pt,MED_FULL_INTERLACE,(*iter).getNbOfTuple(),
- (char *)MED_NOGAUSS,MED_ALL,profileName,MED_COMPACT,MED_MAILLE,
- typmai3[(int)(*iter).getType()],numdt,(char *)"",dt,numo);
- delete [] profileName;
- delete [] nommaa;
+ MEDfieldValueWithProfileWr(fid,f->getName(),numdt,numo,dt,MED_CELL,typmai3[(int)(*iter).getType()],MED_COMPACT_PFLMODE,profileName,
+ MED_NO_LOCALIZATION,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,(*iter).getNbOfTuple(),(const unsigned char*)pt);
pt+=(*iter).getNbOfTuple()*nbComp;
}
- MEDfermer(fid);
+ MEDfileClose(fid);
}
/*!
*/
med_idt MEDLoaderNS::appendFieldSimpleAtt(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, med_int& numdt, med_int& numo, med_float& dt)
{
- med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE_ECRITURE);
+ med_idt fid=MEDfileOpen(fileName,MED_ACC_RDWR);
int nbComp=f->getNumberOfComponents();
- char *comp=MEDLoaderBase::buildEmptyString(nbComp*MED_TAILLE_PNOM);
- char *unit=MEDLoaderBase::buildEmptyString(nbComp*MED_TAILLE_PNOM);
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE);
for(int i=0;i<nbComp;i++)
{
std::string info=f->getArray()->getInfoOnComponent(i);
std::string c,u;
MEDLoaderBase::splitIntoNameAndUnit(info,c,u);
- MEDLoaderBase::safeStrCpy(c.c_str(),MED_TAILLE_PNOM-1,comp+i*MED_TAILLE_PNOM,MEDLoader::_TOO_LONG_STR);
- MEDLoaderBase::safeStrCpy(u.c_str(),MED_TAILLE_PNOM-1,unit+i*MED_TAILLE_PNOM,MEDLoader::_TOO_LONG_STR);
- }
- MEDchampCr(fid,(char *)f->getName(),MED_FLOAT64,comp,unit,nbComp);
+ MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,MEDLoader::_TOO_LONG_STR);
+ MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,MEDLoader::_TOO_LONG_STR);
+ }
+ INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> maaname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> fname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDLoaderBase::safeStrCpy(f->getName(),MED_NAME_SIZE,fname,MEDLoader::_TOO_LONG_STR);
+ MEDLoaderBase::safeStrCpy(f->getMesh()->getName(),MED_NAME_SIZE,maaname,MEDLoader::_TOO_LONG_STR);
+ MEDLoaderBase::safeStrCpy(f->getTimeUnit(),MED_SNAME_SIZE,dt_unit,MEDLoader::_TOO_LONG_STR);
+ MEDfieldCr(fid,fname,MED_FLOAT64,nbComp,comp,unit,dt_unit,maaname);
ParaMEDMEM::TypeOfTimeDiscretization td=f->getTimeDiscretization();
if(td==ParaMEDMEM::NO_TIME)
{
- numdt=MED_NOPDT; numo=MED_NONOR; dt=0.0;
+ numdt=MED_NO_DT; numo=MED_NO_IT; dt=0.0;
}
else if(td==ParaMEDMEM::ONE_TIME)
{
numdt=(med_int)tmp1; numo=(med_int)tmp2;
dt=(med_float)tmp0;
}
- delete [] comp;
- delete [] unit;
return fid;
}
const MEDCouplingUMesh *meshC=dynamic_cast<const MEDCouplingUMesh *>(mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Not implemented yet for not unstructured mesh !");
- bool renum=!meshC->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2);
+ bool renum=!meshC->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
if(renum)
{
ParaMEDMEM::MEDCouplingFieldDouble *f3=f2->clone(true);
- DataArrayInt *da=meshC->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=meshC->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
f3->renumberCells(da->getConstPointer(),false);
- da->decrRef();
f=f3;
}
//end renumbering
int nbComp=f->getNumberOfComponents();
med_idt fid=appendFieldSimpleAtt(fileName,f,numdt,numo,dt);
const double *pt=f->getArray()->getConstPointer();
- char *nommaa=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
- MEDLoaderBase::safeStrCpy(f->getMesh()->getName(),MED_TAILLE_NOM,nommaa,MEDLoader::_TOO_LONG_STR);
+ INTERP_KERNEL::AutoPtr<char> nommaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDLoaderBase::safeStrCpy(f->getMesh()->getName(),MED_NAME_SIZE,nommaa,MEDLoader::_TOO_LONG_STR);
switch(f->getTypeOfField())
{
case ParaMEDMEM::ON_CELLS:
prepareCellFieldDoubleForWriting(f,0,split);
for(std::list<MEDLoader::MEDFieldDoublePerCellType>::const_iterator iter=split.begin();iter!=split.end();iter++)
{
- MEDchampEcr(fid,nommaa,(char *)f->getName(),(unsigned char*)pt,MED_FULL_INTERLACE,(*iter).getNbOfTuple(),
- (char *)MED_NOGAUSS,MED_ALL,(char *)MED_NOPFL,MED_NO_PFLMOD,MED_MAILLE,
- typmai3[(int)(*iter).getType()],numdt,(char *)"",dt,numo);
+ MEDfieldValueWithProfileWr(fid,f->getName(),numdt,numo,dt,MED_CELL,typmai3[(int)(*iter).getType()],MED_COMPACT_PFLMODE,
+ MED_ALLENTITIES_PROFILE,MED_NO_LOCALIZATION,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,(*iter).getNbOfTuple(),(const unsigned char*)pt);
pt+=(*iter).getNbOfTuple()*nbComp;
}
break;
case ParaMEDMEM::ON_NODES:
{
int nbOfTuples=f->getArray()->getNumberOfTuples();
- MEDchampEcr(fid,nommaa,(char *)f->getName(),(unsigned char*)pt,MED_FULL_INTERLACE,nbOfTuples,(char *)MED_NOGAUSS,
- MED_ALL,(char *)MED_NOPFL,MED_NO_PFLMOD,MED_NOEUD,MED_NONE,numdt,(char *)"",dt,numo);
+ MEDfieldValueWithProfileWr(fid,f->getName(),numdt,numo,dt,MED_NODE,MED_NONE,MED_COMPACT_PFLMODE,
+ MED_ALLENTITIES_PROFILE,MED_NO_LOCALIZATION,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,nbOfTuples,(const unsigned char*)pt);
break;
}
case ParaMEDMEM::ON_GAUSS_PT:
int idGp=0;
for(std::list<MEDLoader::MEDFieldDoublePerCellType>::const_iterator iter=split.begin();iter!=split.end();iter++)
{
- char *nomGauss=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ INTERP_KERNEL::AutoPtr<char> nomGauss=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
std::ostringstream oss; oss << "GP_" << f->getName() << idGp++;
- MEDLoaderBase::safeStrCpy(oss.str().c_str(),MED_TAILLE_NOM,nomGauss,MEDLoader::_TOO_LONG_STR);
+ MEDLoaderBase::safeStrCpy(oss.str().c_str(),MED_NAME_SIZE,nomGauss,MEDLoader::_TOO_LONG_STR);
int id=f->getGaussLocalizationIdOfOneType((*iter).getType());
const MEDCouplingGaussLocalization& gl=f->getGaussLocalization(id);
- MEDgaussEcr(fid,typmai3[(int)(*iter).getType()],(med_float*)&gl.getRefCoords()[0],MED_FULL_INTERLACE,gl.getNumberOfGaussPt(),
- (med_float*)&gl.getGaussCoords()[0],
- (med_float*)&gl.getWeights()[0],nomGauss);
- int nbOfValues=gl.getNumberOfGaussPt()*f->getMesh()->getNumberOfCellsWithType((*iter).getType());
- MEDchampEcr(fid,nommaa,(char *)f->getName(),(unsigned char*)pt,MED_FULL_INTERLACE,nbOfValues,
- nomGauss,MED_ALL,(char *)MED_NOPFL,MED_NO_PFLMOD,MED_MAILLE,
- typmai3[(int)(*iter).getType()],numdt,(char *)"",dt,numo);
+ MEDlocalizationWr(fid,nomGauss,typmai3[(int)(*iter).getType()],mesh->getMeshDimension(),&gl.getRefCoords()[0],MED_FULL_INTERLACE,
+ gl.getNumberOfGaussPt(),&gl.getGaussCoords()[0],&gl.getWeights()[0],MED_NO_INTERPOLATION, MED_NO_MESH_SUPPORT);
+ int nbOfEntity=f->getMesh()->getNumberOfCellsWithType((*iter).getType());
+ int nbOfValues=gl.getNumberOfGaussPt()*nbOfEntity;
+ INTERP_KERNEL::AutoPtr<char> fieldname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ MEDLoaderBase::safeStrCpy(f->getName(),MED_NAME_SIZE,fieldname,MEDLoader::_TOO_LONG_STR);
+ MEDfieldValueWithProfileWr(fid,fieldname,numdt,numo,dt,MED_CELL,typmai3[(int)(*iter).getType()],MED_COMPACT_PFLMODE,
+ MED_ALLENTITIES_PROFILE,nomGauss,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,nbOfEntity,(const unsigned char*)pt);
pt+=nbOfValues*nbComp;
- delete [] nomGauss;
}
break;
}
prepareCellFieldDoubleForWriting(f,0,split);
for(std::list<MEDLoader::MEDFieldDoublePerCellType>::const_iterator iter=split.begin();iter!=split.end();iter++)
{
- int nbPtPerCell=(int)INTERP_KERNEL::CellModel::getCellModel((*iter).getType()).getNumberOfNodes();
- int nbOfValues=nbPtPerCell*f->getMesh()->getNumberOfCellsWithType((*iter).getType());
- MEDchampEcr(fid,nommaa,(char *)f->getName(),(unsigned char*)pt,MED_FULL_INTERLACE,nbOfValues,
- (char *)MED_GAUSS_ELNO,MED_ALL,(char *)MED_NOPFL,MED_NO_PFLMOD,MED_MAILLE,
- typmai3[(int)(*iter).getType()],numdt,(char *)"",dt,numo);
+ int nbPtPerCell=(int)INTERP_KERNEL::CellModel::GetCellModel((*iter).getType()).getNumberOfNodes();
+ int nbOfEntity=f->getMesh()->getNumberOfCellsWithType((*iter).getType());
+ int nbOfValues=nbPtPerCell*nbOfEntity;
+ MEDfieldValueWithProfileWr(fid,f->getName(),numdt,numo,dt,MED_NODE_ELEMENT,typmai3[(int)(*iter).getType()],MED_COMPACT_PFLMODE,
+ MED_ALLENTITIES_PROFILE,MED_NO_LOCALIZATION,MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,nbOfEntity,(const unsigned char*)pt);
pt+=nbOfValues*nbComp;
}
break;
default:
throw INTERP_KERNEL::Exception("Not managed this type of FIELD !");
}
- delete [] nommaa;
- MEDfermer(fid);
+ MEDfileClose(fid);
if(renum)
((ParaMEDMEM::MEDCouplingFieldDouble *)f)->decrRef();
}
const MEDCouplingUMesh *meshC=dynamic_cast<const MEDCouplingUMesh *>(mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Not implemented yet for not unstructured mesh !");
- if(!meshC->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2))
+ if(!meshC->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_N_CELL_FIXED_GEO))
throw INTERP_KERNEL::Exception("Unstructuded mesh has not consecutive cell types !");
const int *connI=meshC->getNodalConnectivityIndex()->getConstPointer();
const int *conn=meshC->getNodalConnectivity()->getConstPointer();
writeUMeshesDirectly(fileName,meshV,famV,forceFromScratch,isRenumbering);
if(isRenumbering)
{
- ParaMEDMEM::MEDCouplingFieldDouble *f2=f->clone(true);
- DataArrayInt *da=mesh->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_NBR_GEOMETRIE_MAILLE+2);
+ MEDCouplingAutoRefCountObjectPtr<ParaMEDMEM::MEDCouplingFieldDouble> f2=f->clone(true);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=mesh->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
f2->renumberCells(da->getConstPointer(),false);
- da->decrRef();
appendFieldDirectly(fileName,f2);
- f2->decrRef();
}
else
appendFieldDirectly(fileName,f);
oss << "\" but meshdimension does not match !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingUMesh *m=MEDLoader::ReadUMeshFromFile(fileName,f->getMesh()->getName(),f2);
- MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshes(m,(MEDCouplingUMesh *)f->getMesh());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=MEDLoader::ReadUMeshFromFile(fileName,f->getMesh()->getName(),f2);
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m2=MEDCouplingUMesh::MergeUMeshes(m,(MEDCouplingUMesh *)f->getMesh());
bool areNodesMerged;
int newNbOfNodes;
- DataArrayInt *da=m2->mergeNodes(MEDLoader::_EPS_FOR_NODE_COMP,areNodesMerged,newNbOfNodes);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=m2->mergeNodes(MEDLoader::_EPS_FOR_NODE_COMP,areNodesMerged,newNbOfNodes);
if(!areNodesMerged || newNbOfNodes!=m->getNumberOfNodes())
{
- da->decrRef();
- m2->decrRef();
- m->decrRef();
std::ostringstream oss; oss << "Nodes in already written mesh \"" << f->getMesh()->getName() << "\" in file \"" << fileName << "\" does not fit coordinates of unstructured grid f->getMesh() !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
{
case ParaMEDMEM::ON_CELLS:
{
- da->decrRef();
- DataArrayInt *da2=m2->zipConnectivityTraducer(MEDLoader::_COMP_FOR_CELL);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da2=m2->zipConnectivityTraducer(MEDLoader::_COMP_FOR_CELL);
if(m2->getNumberOfCells()!=m->getNumberOfCells())
{
- da2->decrRef();
- m2->decrRef();
- m->decrRef();
std::ostringstream oss1; oss1 << "Cells in already written mesh \"" << f->getMesh()->getName() << "\" in file \"" << fileName << "\" does not fit connectivity of unstructured grid f->getMesh() !";
throw INTERP_KERNEL::Exception(oss1.str().c_str());
}
da=m2->convertCellArrayPerGeoType(da2);
- DataArrayInt *da3=da->substr(m2->getNumberOfCells());
- da2->decrRef();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=da->substr(m2->getNumberOfCells());
da2=m2->convertCellArrayPerGeoType(da3);
- da3->decrRef();
appendCellProfileField(fileName,f,da2->getConstPointer());
- da2->decrRef();
break;
}
case ParaMEDMEM::ON_NODES:
}
default:
{
- da->decrRef();
- m2->decrRef();
- m->decrRef();
throw INTERP_KERNEL::Exception("Not implemented other profile fitting from already written mesh for fields than on NODES and on CELLS.");
}
}
- da->decrRef();
- m2->decrRef();
- m->decrRef();
}
void MEDLoader::WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
}
if(meshes.empty())
throw INTERP_KERNEL::Exception("List of meshes must be not empty !");
- DataArrayDouble *coords=meshes.front()->getCoords();
+ const DataArrayDouble *coords=meshes.front()->getCoords();
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=meshes.begin();iter!=meshes.end();iter++)
if(coords!=(*iter)->getCoords())
throw INTERP_KERNEL::Exception("Meshes does not not share the same coordinates : try method MEDCouplingPointSet::tryToShareSameCoords !");
}
if(meshes.empty())
throw INTERP_KERNEL::Exception("List of meshes must be not empty !");
- DataArrayDouble *coords=meshes.front()->getCoords();
+ const DataArrayDouble *coords=meshes.front()->getCoords();
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=meshes.begin();iter!=meshes.end();iter++)
if(coords!=(*iter)->getCoords())
throw INTERP_KERNEL::Exception("Meshes does not not share the same coordinates : try method MEDCouplingPointSet::tryToShareSameCoords !");
std::string meshName(meshes[0]->getName());
if(meshName.empty())
throw INTERP_KERNEL::Exception("Trying to write a unstructured mesh with no name ! MED file format needs a not empty mesh name : change name of first element of 2nd parameter !");
- DataArrayDouble *coords=meshes.front()->getCoords();
+ const DataArrayDouble *coords=meshes.front()->getCoords();
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=meshes.begin();iter!=meshes.end();iter++)
if(coords!=(*iter)->getCoords())
throw INTERP_KERNEL::Exception("Meshes does not not share the same coordinates : try method MEDCouplingPointSet::tryToShareSameCoords !");
std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions or not exists !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- std::string fieldName(f->getName());
- if(fieldName.empty())
- throw INTERP_KERNEL::Exception("Trying to write a field with no name ! MED file format needs a not empty field name !");
MEDLoaderNS::appendFieldDirectly(fileName,f);
}
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MEDLOADER_HXX__
static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
- static std::vector<ParaMEDMEM::TypeOfField> GetTypesOfField(const char *fileName, const char *fieldName, const char *meshName) throw(INTERP_KERNEL::Exception);
+ static std::vector<ParaMEDMEM::TypeOfField> GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsCellOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsNodeOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsGaussOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsGaussNEOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
- const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
+ const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDLoaderBase.hxx"
std::string unitCpp(buildStringFromFortran(unit,unitLgth));
if(unitCpp[0]=='\0')
return ret;
- ret+=" (";
+ ret+=" [";
ret+=unitCpp;
- ret+=")";
+ ret+="]";
return ret;
}
void MEDLoaderBase::splitIntoNameAndUnit(const std::string& s, std::string& name, std::string& unit)
{
- std::string::size_type f1=s.find_first_of('(');
- std::string::size_type f2=s.find_last_of(')');
+ std::string::size_type f1=s.find_first_of('[');
+ std::string::size_type f2=s.find_last_of(']');
if(f1!=std::string::npos && f2!=std::string::npos)
{
if(f1<f2)
strcpy(dest,src);
}
+/*!
+ * This method is equivalent to MEDLoaderBase::safeStrCpy except that here no '\0' car is put.
+ * This method should be used for multi string in one string.
+ */
+void MEDLoaderBase::safeStrCpy2(const char *src, int maxLgth, char *dest, int behaviour) throw(INTERP_KERNEL::Exception)
+{
+ if((int)strlen(src)>maxLgth)
+ {
+ if(behaviour==0 || behaviour>1)
+ {
+ std::ostringstream oss; oss << "A string : \"" << src << "\" has been detected to be too long for MED File ( > " << maxLgth << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ else if(behaviour==1)
+ {
+ std::string s=zipString(src,maxLgth);
+ std::cerr << "A string : \"" << src << "\" has been detected to be too long for MED File ( > " << maxLgth << ") : ";
+ std::cerr << "zipping to : " << s << "\n";
+ strcpy(dest,s.c_str());
+ return ;
+ }
+ }
+ int n=strlen(src);
+ strncpy(dest,src,n);
+}
+
std::string MEDLoaderBase::buildStringFromFortran(const char *expr, int lgth)
{
std::string ret(expr,lgth);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MEDLOADERBASE_HXX__
static void splitIntoNameAndUnit(const std::string& s, std::string& name, std::string& unit);
static void strip(std::string& s);
static void safeStrCpy(const char *src, int maxLgth, char *dest, int behaviour) throw(INTERP_KERNEL::Exception);
+ static void safeStrCpy2(const char *src, int maxLgth, char *dest, int behaviour) throw(INTERP_KERNEL::Exception);
static std::string buildStringFromFortran(const char *expr, int lgth);
static void zipEqualConsChar(std::string& s, int minConsSmChar);
static std::string zipString(const char *src, int sizeToRespect);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MEDLOADERDEFINES_HXX__
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
salomeinclude_HEADERS= \
MEDLoaderDefines.hxx \
MEDLoader.hxx MEDLoaderBase.hxx MEDFileUtilities.hxx MEDFileMesh.hxx MEDFileMeshLL.hxx \
-MEDFileMeshElt.hxx MEDFileBasis.hxx
+MEDFileMeshElt.hxx MEDFileBasis.hxx MEDFileField.hxx MEDFileData.hxx
dist_libmedloader_la_SOURCES= \
MEDLoader.cxx MEDLoaderBase.cxx MEDFileUtilities.cxx \
MEDFileMesh.cxx MEDFileMeshElt.cxx MEDFileBasis.cxx \
-MEDFileMeshLL.cxx
+MEDFileMeshLL.cxx MEDFileField.cxx MEDFileData.cxx
libmedloader_la_CPPFLAGS= $(MED2_INCLUDES) $(HDF5_INCLUDES) @CXXTMPDPTHFLAGS@ \
-I$(srcdir)/../INTERP_KERNEL \
-I$(srcdir)/../MEDCoupling
libmedloader_la_LDFLAGS= ../MEDCoupling/libmedcoupling.la \
-../INTERP_KERNEL/libinterpkernel.la $(MED2_LIBS) $(HDF5_LIBS)
+../INTERP_KERNEL/libinterpkernel.la $(MED2_LIBS_C_ONLY) $(HDF5_LIBS)
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
from MEDLoader import *
mesh.finishInsertingCells();
myCoords=DataArrayDouble.New();
myCoords.setValues(coords,6,1);
- myCoords.setInfoOnComponent(0,"tototototototot (m*m*m*m*m*m*m*m)");
+ myCoords.setInfoOnComponent(0,"tototototototot [m*m*m*m*m*m*m*m]");
mesh.setCoords(myCoords);
return mesh;
targetMesh.finishInsertingCells();
myCoords=DataArrayDouble.New();
myCoords.setValues(targetCoords,12,2);
- myCoords.setInfoOnComponent(0,"tototototototot (m)");
- myCoords.setInfoOnComponent(1,"energie (kW)");
+ myCoords.setInfoOnComponent(0,"tototototototot [m]");
+ myCoords.setInfoOnComponent(1,"energie [kW]");
targetMesh.setCoords(myCoords)
return targetMesh;
targetMesh.setName("2DMesh_2");
targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
+ targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[12:16])
+ targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[16:20])
targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
+ targetMesh.finishInsertingCells();
+ myCoords=DataArrayDouble.New();
+ myCoords.setValues(targetCoords,12,2);
+ myCoords.setInfoOnComponent(0,"toto [m]");
+ myCoords.setInfoOnComponent(1,"energie [kW]");
+ targetMesh.setCoords(myCoords);
+ return targetMesh;
+
+ #this mesh has several cells duplicated ! it is not beautiful but efficient to test file WR.
+ def build2DMesh_3(cls):
+ targetCoords=[-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7,
+ -0.05,0.95, 0.2,1.2, 0.45,0.95]
+ targetConn=[1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4]
+ targetMesh=MEDCouplingUMesh.New();
+ targetMesh.setMeshDimension(2);
+ targetMesh.allocateCells(13);
+ targetMesh.setName("2DMesh_3");
+ targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
+ targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
+ targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
+ targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
+ targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
+ targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
+ targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[12:16])
+ targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[16:20])
targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[12:16])
targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[16:20])
+ targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
+ targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
+ targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
targetMesh.finishInsertingCells();
myCoords=DataArrayDouble.New();
myCoords.setValues(targetCoords,12,2);
- myCoords.setInfoOnComponent(0,"toto (m)");
- myCoords.setInfoOnComponent(1,"energie (kW)");
+ myCoords.setInfoOnComponent(0,"toto [m]");
+ myCoords.setInfoOnComponent(1,"energie [kW]");
targetMesh.setCoords(myCoords);
return targetMesh;
ret.finishInsertingCells();
myCoords=DataArrayDouble.New();
myCoords.setValues(coords,60,3);
- myCoords.setInfoOnComponent(0,"titi (m)");
- myCoords.setInfoOnComponent(1,"density power (MW/m^3)");
- myCoords.setInfoOnComponent(2,"t (kW)");
+ myCoords.setInfoOnComponent(0,"titi [m]");
+ myCoords.setInfoOnComponent(1,"density power [MW/m^3]");
+ myCoords.setInfoOnComponent(2,"t [kW]");
ret.setCoords(myCoords);
return ret;
targetMesh.setName("3DSurfMesh_1");
targetMesh.insertNextCell(NORM_TRI3,3,targetConn[0:3])
targetMesh.insertNextCell(NORM_TRI3,3,targetConn[3:6])
- targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[12:16])
targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[16:20])
+ targetMesh.insertNextCell(NORM_TRI6,6,targetConn[6:12])
targetMesh.insertNextCell(NORM_POLYGON,4,targetConn[20:24])
targetMesh.finishInsertingCells();
myCoords=DataArrayDouble.New();
myCoords.setValues(targetCoords,12,3);
- myCoords.setInfoOnComponent(0,"toto (m)");
- myCoords.setInfoOnComponent(2,"ff (km)");#component 1 is not set for test
+ myCoords.setInfoOnComponent(0,"toto [m]");
+ myCoords.setInfoOnComponent(2,"ff [km]");#component 1 is not set for test
targetMesh.setCoords(myCoords);
return targetMesh;
def build3DMesh_2(cls):
m3dsurfBase=MEDLoaderDataForTest.build3DSurfMesh_1();
- numbers=[0,1,3,4,5]
+ numbers=[0,1,2,3,5]
m3dsurf=m3dsurfBase.buildPartOfMySelf(numbers,False);
m1dBase=MEDLoaderDataForTest.build1DMesh_1();
numbers2=[0,1,2,3]
ret=m3dsurf.buildExtrudedMesh(m1d,0);
return ret;
+ def buildMultiLevelMesh_1(cls):
+ coo=[10.,0.,10.,1.25,10.,2.5,10.,3.75,10.,5.,8.75,0.,8.75,1.25,8.75,2.5,8.75,3.75,8.75,5.,7.5,0.,7.5,1.25,7.5,2.5,7.5,3.75,7.5,5.,6.25,0.,6.25,1.25,6.25,2.5,6.25,3.75,6.25,5.,5.,0.,5.,1.25,5.,2.5,5.,3.75,5.,5.,3.75,0.,3.75,1.25,3.75,2.5,3.75,3.75,3.75,5.,2.5,0.,2.5,1.25,2.5,2.5,2.5,3.75,2.5,5.,1.25,0.,1.25,1.25,1.25,2.5,1.25,3.75,1.25,5.,0.,1.25,0.,2.5,0.,3.75,0.,5.,0.,0.,0.,5.,10.,5.,0.,10.,10.,10.,5.,5.,5.,5.,5.,10.,5.,10.,0.625,5.,1.25,5.,1.875,5.,2.5,5.,3.125,5.,3.75,5.,4.375,5.,5.,6.25,5.,7.5,5.,8.75,4.375,10.,3.75,10.,3.125,10.,2.5,10.,1.875,10.,1.25,10.,0.625,10.,0.,8.75,0.,7.5,0.,6.25,4.375,6.25,4.375,7.5,4.375,8.75,3.75,6.25,3.75,7.5,3.75,8.75,3.125,6.25,3.125,7.5,3.125,8.75,2.5,6.25,2.5,7.5,2.5,8.75,1.875,6.25,1.875,7.5,1.875,8.75,1.25,6.25,1.25,7.5,1.25,8.75,0.625,6.25,0.625,7.5,0.625,8.75,5.625,5.,6.25,5.,6.875,5.,7.5,5.,8.125,5.,8.75,5.,9.375,5.,10.,6.25,10.,7.5,10.,8.75,9.375,10.,8.75,10.,8.125,10.,7.5,10.,6.875,10.,6.25,10.,5.625,10.,5.,8.75,5.,7.5,5.,6.25,9.375,6.25,9.375,7.5,9.375,8.75,8.75,6.25,8.75,7.5,8.75,8.75,8.125,6.25,8.125,7.5,8.125,8.75,7.5,6.25,7.5,7.5,7.5,8.75,6.875,6.25,6.875,7.5,6.875,8.75,6.25,6.25,6.25,7.5,6.25,8.75,5.625,6.25,5.625,7.5,5.625,8.75]
+ coo2=DataArrayDouble.New()
+ coo2.setValues(coo,135,2)
+ coo2=coo2.changeNbOfComponents(3,0.)
+ coo2.setInfoOnComponent(0,"X [INCONNUE]")
+ coo2.setInfoOnComponent(1,"Y [INCONNUE]")
+ coo2.setInfoOnComponent(2,"Z [INCONNUE]")
+ c2tri=[0,1,6,0,6,5,1,2,6,2,7,6,2,3,8,2,8,7,3,4,8,4,9,8,5,6,11,5,11,10,6,7,11,7,12,11,7,8,13,7,13,12,8,9,13,9,14,13,10,11,16,10,16,15,11,12,16,12,17,16,12,13,18,12,18,17,13,14,18,14,19,18,15,16,21,15,21,20,16,17,21,17,22,21,17,18,23,17,23,22,18,19,23,19,24,23,20,21,26,20,26,25,21,22,26,22,27,26,22,23,28,22,28,27,23,24,28,24,29,28,25,26,31,25,31,30,26,27,31,27,32,31,27,28,33,27,33,32,28,29,33,29,34,33,30,31,36,30,36,35,31,32,36,32,37,36,32,33,38,32,38,37,33,34,38,34,39,38,35,36,40,35,40,44,36,37,40,37,41,40,37,38,42,37,42,41,38,39,42,39,43,42]
+ c2quad4=[46,101,114,100,101,102,115,114,102,103,116,115,103,48,104,116,100,114,117,99,114,115,118,117,115,116,119,118,116,104,105,119,99,117,120,98,117,118,121,120,118,119,122,121,119,105,106,122,98,120,123,97,120,121,124,123,121,122,125,124,122,106,107,125,97,123,126,96,123,124,127,126,124,125,128,127,125,107,108,128,96,126,129,95,126,127,130,129,127,128,131,130,128,108,109,131,95,129,132,94,129,130,133,132,130,131,134,133,131,109,110,134,94,132,113,50,132,133,112,113,133,134,111,112,134,110,51,111,49,60,73,59,60,61,74,73,61,62,75,74,62,52,63,75,59,73,76,58,73,74,77,76,74,75,78,77,75,63,64,78,58,76,79,57,76,77,80,79,77,78,81,80,78,64,65,81,57,79,82,56,79,80,83,82,80,81,84,83,81,65,66,84,56,82,85,55,82,83,86,85,83,84,87,86,84,66,67,87,55,85,88,54,85,86,89,88,86,87,90,89,87,67,68,90,54,88,91,53,88,89,92,91,89,90,93,92,90,68,69,93,53,91,72,45,91,92,71,72,92,93,70,71,93,69,47,70]
+ m2=MEDCouplingUMesh.New("ma",2)
+ m2.setCoords(coo2)
+ m2.allocateCells(128)
+ nbTri=len(c2tri)/3
+ for i in xrange(nbTri):
+ m2.insertNextCell(NORM_TRI3,3,c2tri[3*i:3*i+3])
+ pass
+ nbQua=len(c2quad4)/4
+ for i in xrange(nbQua):
+ m2.insertNextCell(NORM_QUAD4,4,c2quad4[4*i:4*i+4])
+ pass
+ m2.finishInsertingCells()
+ m2.setDescription("CREE PAR CODE_ASTER")
+ m1=MEDCouplingUMesh.New("ma",1)
+ m1.setCoords(coo2)
+ c1seg=[0,1,1,2,2,3,3,4,4,9,9,14,14,19,19,24,24,29,29,34,34,39,39,43,43,42,42,41,41,40,40,44,44,35,35,30,30,25,25,20,20,15,15,10,10,5,5,0,43,39,39,34,34,29,29,24,24,19,19,14,14,9,9,4,45,53,53,54,54,55,55,56,56,57,57,58,58,59,59,49,49,60,60,61,61,62,62,52,52,63,63,64,64,65,65,66,66,67,67,68,68,69,69,47,47,70,70,71,71,72,72,45,50,94,94,95,95,96,96,97,97,98,98,99,99,100,100,46,46,101,101,102,102,103,103,48,48,104,104,105,105,106,106,107,107,108,108,109,109,110,110,51,51,111,111,112,112,113,113,50]
+ m1.allocateCells(80)
+ for i in xrange(80):
+ m1.insertNextCell(NORM_SEG2,2,c1seg[2*i:2*i+2])
+ pass
+ m1.finishInsertingCells()
+ m1.setDescription("CREE PAR CODE_ASTER")
+ m0=MEDCouplingUMesh.New("ma",0)
+ m0.setCoords(coo2)
+ c0pt=[44,0,47,48]
+ m0.allocateCells(4)
+ for i in xrange(4):
+ m0.insertNextCell(NORM_POINT1,1,[c0pt[i]])
+ pass
+ m0.finishInsertingCells()
+ f2=DataArrayInt.New()
+ f2.alloc(128,1)
+ f2[:64]=-1
+ f2[64:96]=-2
+ f2[96:]=-3
+ f1=DataArrayInt.New()
+ f1.alloc(80,1)
+ f1[:4]=-8
+ f1[4:12]=-9
+ f1[12:16]=-10
+ f1[16:24]=-11
+ f1[24:28]=-12
+ f1[28:32]=-13
+ f1[32:40]=-14
+ f1[40:44]=-15
+ f1[44:52]=-16
+ f1[52:56]=-17
+ f1[56:64]=-18
+ f1[64:68]=-19
+ f1[68:76]=-20
+ f1[76:]=-21
+ f0=DataArrayInt.New()
+ f0.setValues([-4,-5,-6,-7],4,1)
+ p=DataArrayInt.New()
+ p.alloc(135,1)
+ p.fillWithZero()
+ p1=DataArrayInt.New()
+ p1.alloc(13,1)
+ p1.iota(1)
+ p[[0,4,24,43,44,45,46,47,48,49,50,51,52]]=p1
+ n2=DataArrayInt.New()
+ n2.alloc(128,1)
+ n2.iota(1)
+ n1=DataArrayInt.New()
+ n1.alloc(80,1)
+ n1.iota(133)
+ n0=DataArrayInt.New()
+ n0.alloc(4,1)
+ n0.iota(129)
+ fns=['A1A2____________________________', 'A1______________________________', 'A2A4____________________________', 'A2______________________________', 'A3A1____________________________', 'A3C5____________________________', 'A3______________________________', 'A4A3____________________________', 'A4______________________________', 'B1C1____________________________', 'B1______________________________', 'B2B4____________________________', 'B2______________________________', 'B3B1____________________________', 'B3______________________________', 'B4C3____________________________', 'B4______________________________', 'C1C4____________________________', 'C1______________________________', 'C2B2____________________________', 'C2______________________________', 'C3C2____________________________', 'C3______________________________', 'C4B3____________________________', 'C4______________________________', 'C5A4____________________________', 'C5______PMMA____________________', 'FAMILLE_ZERO', 'MESH____APPS____AP1_____________', 'MESH____APPS____AP2_____________', 'MESH____APPS____AP3_____________', 'MESH____APPS____AP4_____________', 'MESH____DALQ1___DALLE___________', 'MESH____DALQ2___DALLE___________', 'MESH____DALT3___DALLE___________']
+ fids=[-11, 5, -8, 1, -10, -12, 4, -9, 2, -14, 6, -19, 7, -17, 8, -20, 9, -15, 10, -18, 11, -21, 12, -16, 13, -13, 3, 0, -4, -5, -6, -7, -3, -2, -1]
+ grpns=['A1', 'A1A2', 'A2', 'A2A4', 'A3', 'A3A1', 'A3C5', 'A4', 'A4A3', 'AP1', 'AP2', 'AP3', 'AP4', 'APPS', 'B1', 'B1C1', 'B2', 'B2B4', 'B3', 'B3B1', 'B4', 'B4C3', 'C1', 'C1C4', 'C2', 'C2B2', 'C3', 'C3C2', 'C4', 'C4B3', 'C5', 'C5A4', 'DALLE', 'DALQ1', 'DALQ2', 'DALT3', 'MESH', 'PMMA']
+ famIdsPerGrp=[[5],[-11],[1],[-8],[4],[-10],[-12],[2],[-9],[-4],[-5],[-6],[-7],[-4,-5,-6,-7],[6],[-14],[7],[-19],[8],[-17],[9],[-20],[10],[-15],[11],[-18],[12],[-21],[13],[-16],[3],[-13],[-3,-2,-1],[-3],[-2],[-1],[-4,-5,-6,-7,-3,-2,-1],[3]]
+ return m2,m1,m0,f2,f1,f0,p,n2,n1,n0,fns,fids,grpns,famIdsPerGrp
+
def buildVecFieldOnCells_1(cls):
mesh=MEDLoaderDataForTest.build3DSurfMesh_1();
nbOfCells=mesh.getNumberOfCells();
array=DataArrayDouble.New();
arr1=[0.,10.,20.,1.,11.,21.,2.,12.,22.,3.,13.,23.,4.,14.,24.,5.,15.,25.]
array.setValues(arr1,nbOfCells,3);
- array.setInfoOnComponent(0,"power (MW/m^3)");
- array.setInfoOnComponent(1,"density (g/cm^3)");
- array.setInfoOnComponent(2,"temperature (K)");
+ array.setInfoOnComponent(0,"power [MW/m^3]");
+ array.setInfoOnComponent(1,"density [g/cm^3]");
+ array.setInfoOnComponent(2,"temperature [K]");
f1.setArray(array);
tmp=array.getPointer();
f1.setTime(2.,0,1);
arr1=[70.,80.,90.,71.,81.,91.,72.,82.,92.,73.,83.,93.,74.,84.,94.,75.,85.,95.,
1000.,10010.,10020.,1001.,10011.,10021.,1002.,10012.,10022.,1003.,10013.,10023.,1004.,10014.,10024.,1005.,10015.,10025.]
array.setValues(arr1,nbOfNodes,3);
- array.setInfoOnComponent(0,"power (MW/m^3)");
- array.setInfoOnComponent(1,"density (g/cm^3)");
- array.setInfoOnComponent(2,"temperature (K)");
+ array.setInfoOnComponent(0,"power [MW/m^3]");
+ array.setInfoOnComponent(1,"density [g/cm^3]");
+ array.setInfoOnComponent(2,"temperature [K]");
f1.setTime(2.12,2,3);
f1.checkCoherency();
return f1;
refCoo2=[-1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 ]
_refCoo2=refCoo2;
_gsCoo1=_gsCoo1[0:6];
+ _gsCoo2=_gsCoo1
_wg1=_wg1[0:3];
- f.setGaussLocalizationOnType(NORM_TRI6,_refCoo2,_gsCoo1,_wg1);
+ _wg2=_wg1
refCoo3=[ 0.,0., 1.,0., 1.,1., 0.,1. ]
_refCoo3=refCoo3;
_gsCoo1=_gsCoo1[0:4];
_wg1=_wg1[0:2];
f.setGaussLocalizationOnType(NORM_QUAD4,_refCoo3,_gsCoo1,_wg1);
+ f.setGaussLocalizationOnType(NORM_TRI6,_refCoo2,_gsCoo2,_wg2);
array=DataArrayDouble.New();
array.alloc(19,2);
ptr=array.getPointer();
pass
f.setArray(array);
f.setName("MyFirstFieldOnGaussPoint");
- array.setInfoOnComponent(0,"power (MW/m^3)");
+ array.setInfoOnComponent(0,"power [MW/m^3]");
+ array.setInfoOnComponent(1,"density");
+ f.checkCoherency();
+ return f;
+
+ def buildVecFieldOnGauss_2(cls):
+ _a=0.446948490915965;
+ _b=0.091576213509771;
+ _p1=0.11169079483905;
+ _p2=0.0549758718227661;
+ refCoo1=[ 0.,0., 1.,0., 0.,1. ]
+ gsCoo1=[ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b,
+ 2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 ];
+ wg1=[ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 ]
+ _refCoo1=refCoo1;
+ _gsCoo1=gsCoo1;
+ _wg1=wg1;
+ m=MEDLoaderDataForTest.build2DMesh_3();
+ f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,ONE_TIME);
+ f.setTime(3.14,1,5);
+ f.setMesh(m);
+ di=DataArrayInt.New(); di.setValues([0,2,3],3,1)
+ f.setGaussLocalizationOnCells(di,_refCoo1,_gsCoo1,_wg1)
+ _wg1[-1]*=2
+ f.setGaussLocalizationOnCells([1,5],_refCoo1,_gsCoo1,_wg1);
+ _wg1[-1]*=2
+ f.setGaussLocalizationOnCells([4],_refCoo1,_gsCoo1,_wg1);
+ refCoo2=[-1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 ]
+ _refCoo2=refCoo2;
+ _gsCoo1=_gsCoo1[0:6];
+ _gsCoo2=_gsCoo1
+ _wg1=_wg1[0:3];
+ _wg2=_wg1
+ refCoo3=[ 0.,0., 1.,0., 1.,1., 0.,1. ]
+ _refCoo3=refCoo3;
+ _gsCoo1=_gsCoo1[0:4];
+ _wg1=_wg1[0:2];
+ f.setGaussLocalizationOnCells([6,7,8],_refCoo3,_gsCoo1,_wg1);
+ _wg1[-1]*=2
+ f.setGaussLocalizationOnCells([9],_refCoo3,_gsCoo1,_wg1);
+ f.setGaussLocalizationOnType(NORM_TRI6,_refCoo2,_gsCoo2,_wg2);
+ array=DataArrayDouble.New();
+ array.alloc(53,2);
+ ptr=array.getPointer();
+ for i in xrange(53*2):
+ array.setIJ(0,i,float(i+7));
+ pass
+ f.setArray(array);
+ f.setName("MyFirstFieldOnGaussPoint");
+ array.setInfoOnComponent(0,"power [MW/m^3]");
+ array.setInfoOnComponent(1,"density");
+ f.checkCoherency();
+ return f;
+
+ # idem buildVecFieldOnGauss_2 except that different discretizations are sorted inside one type
+ def buildVecFieldOnGauss_2_Simpler(cls):
+ _a=0.446948490915965;
+ _b=0.091576213509771;
+ _p1=0.11169079483905;
+ _p2=0.0549758718227661;
+ refCoo1=[ 0.,0., 1.,0., 0.,1. ]
+ gsCoo1=[ 2*_b-1, 1-4*_b, 2*_b-1, 2.07*_b-1, 1-4*_b,
+ 2*_b-1, 1-4*_a, 2*_a-1, 2*_a-1, 1-4*_a, 2*_a-1, 2*_a-1 ];
+ wg1=[ 4*_p2, 4*_p2, 4*_p2, 4*_p1, 4*_p1, 4*_p1 ]
+ _refCoo1=refCoo1;
+ _gsCoo1=gsCoo1;
+ _wg1=wg1;
+ m=MEDLoaderDataForTest.build2DMesh_3();
+ f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,ONE_TIME);
+ f.setTime(3.14,1,5);
+ f.setMesh(m);
+ di=DataArrayInt.New(); di.setValues([0,1,2],3,1)
+ f.setGaussLocalizationOnCells(di,_refCoo1,_gsCoo1,_wg1)
+ _wg1[-1]*=2
+ f.setGaussLocalizationOnCells([3,4],_refCoo1,_gsCoo1,_wg1);
+ _wg1[-1]*=2
+ f.setGaussLocalizationOnCells([5],_refCoo1,_gsCoo1,_wg1);
+ refCoo2=[-1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 ]
+ _refCoo2=refCoo2;
+ _gsCoo1=_gsCoo1[0:6];
+ _gsCoo2=_gsCoo1
+ _wg1=_wg1[0:3];
+ _wg2=_wg1
+ refCoo3=[ 0.,0., 1.,0., 1.,1., 0.,1. ]
+ _refCoo3=refCoo3;
+ _gsCoo1=_gsCoo1[0:4];
+ _wg1=_wg1[0:2];
+ f.setGaussLocalizationOnCells([6,7,8],_refCoo3,_gsCoo1,_wg1);
+ _wg1[-1]*=2
+ f.setGaussLocalizationOnCells([9],_refCoo3,_gsCoo1,_wg1);
+ f.setGaussLocalizationOnType(NORM_TRI6,_refCoo2,_gsCoo2,_wg2);
+ array=DataArrayDouble.New();
+ array.alloc(53,2);
+ ptr=array.getPointer();
+ for i in xrange(53*2):
+ array.setIJ(0,i,float(i+7));
+ pass
+ f.setArray(array);
+ f.setName("MyFirstFieldOnGaussPoint");
+ array.setInfoOnComponent(0,"power [MW/m^3]");
array.setInfoOnComponent(1,"density");
f.checkCoherency();
return f;
for i in xrange(2*20):
array.setIJ(0,i,float(i+8));
f.setArray(array);
- array.setInfoOnComponent(0,"power (W)");
+ array.setInfoOnComponent(0,"power [W]");
array.setInfoOnComponent(1,"temperature");
f.setName("MyFieldOnGaussNE");
f.checkCoherency();
build2DCurveMesh_1=classmethod(build2DCurveMesh_1)
build2DMesh_1=classmethod(build2DMesh_1)
build2DMesh_2=classmethod(build2DMesh_2)
+ build2DMesh_3=classmethod(build2DMesh_3)
build3DMesh_1=classmethod(build3DMesh_1)
build3DSurfMesh_1=classmethod(build3DSurfMesh_1)
build3DMesh_2=classmethod(build3DMesh_2)
+ buildMultiLevelMesh_1=classmethod(buildMultiLevelMesh_1)
buildVecFieldOnCells_1=classmethod(buildVecFieldOnCells_1)
buildVecFieldOnNodes_1=classmethod(buildVecFieldOnNodes_1)
buildVecFieldOnGauss_1=classmethod(buildVecFieldOnGauss_1)
+ buildVecFieldOnGauss_2=classmethod(buildVecFieldOnGauss_2)
+ buildVecFieldOnGauss_2_Simpler=classmethod(buildVecFieldOnGauss_2_Simpler)
buildVecFieldOnGaussNE_1=classmethod(buildVecFieldOnGaussNE_1)
pass
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import MEDLoader
MEDLoader.MEDLoader.WriteField("Pyfile7.med",f1,True);
f2=MEDLoader.MEDLoader.ReadFieldNode("Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3);
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
+ self.assertRaises(Exception,MEDLoader.MEDLoader.ReadFieldCell,"Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3);
pass
def testFieldRW2(self):
VAL2=-1111111111111.;
name1="AField";
name3="AMesh1";
- name2="AMesh2";
f1=MEDLoaderDataForTest.buildVecFieldOnCells_1();
f1.getMesh().setName(name3);
f1.setName(name1);
f1.setTime(10.14,18,19);
f1.getArray().setIJ(0,0,VAL2);
MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
- f1.getMesh().setName(name2);
+ f1.getMesh().setName(name3);
f1.setTime(10.55,28,29);
f1.getArray().setIJ(0,0,3*VAL1);
- MEDLoader.MEDLoader.WriteField(fileName,f1,False);
+ MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
vec=MEDLoader.MEDLoader.GetMeshNamesOnField(fileName,name1);
- self.assertEqual(2,len(vec));
- self.assertTrue(vec[0]==name3);
- self.assertTrue(vec[1]==name2);
f1.setTime(10.66,38,39);
f1.getArray().setIJ(0,0,3*VAL2);
MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
#ON NODES
f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1();
f1.setName(name1);
- f1.getMesh().setName(name2);
+ f1.getMesh().setName(name3);
f1.setTime(110.,8,9);
MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.setTime(110.,108,109);
MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
#
it1=MEDLoader.MEDLoader.GetCellFieldIterations(fileName,name3,name1);
- self.assertEqual(2,len(it1));
+ self.assertEqual(5,len(it1));
self.assertEqual(8,it1[0][0]); self.assertEqual(9,it1[0][1]);
self.assertEqual(18,it1[1][0]); self.assertEqual(19,it1[1][1]);
- it2=MEDLoader.MEDLoader.GetCellFieldIterations(fileName,name2,name1);
- self.assertEqual(3,len(it2));
- self.assertEqual(28,it2[0][0]); self.assertEqual(29,it2[0][1]);
- self.assertEqual(38,it2[1][0]); self.assertEqual(39,it2[1][1]);
- self.assertEqual(48,it2[2][0]); self.assertEqual(49,it2[2][1]);
- it3=MEDLoader.MEDLoader.GetNodeFieldIterations(fileName,name2,name1);
+ self.assertEqual(28,it1[2][0]); self.assertEqual(29,it1[2][1]);
+ self.assertEqual(38,it1[3][0]); self.assertEqual(39,it1[3][1]);
+ self.assertEqual(48,it1[4][0]); self.assertEqual(49,it1[4][1]);
+ it3=MEDLoader.MEDLoader.GetNodeFieldIterations(fileName,name3,name1);
self.assertEqual(3,len(it3));
self.assertEqual(8,it3[0][0]); self.assertEqual(9,it3[0][1]);
self.assertEqual(108,it3[1][0]); self.assertEqual(109,it3[1][1]);
self.assertEqual(208,it3[2][0]); self.assertEqual(209,it3[2][1]);
- it4=MEDLoader.MEDLoader.GetNodeFieldIterations(fileName,name3,name1);
- self.assertTrue(len(it4)==0);
#
#
f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,8,9);
self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,0),13);
f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,18,19);
self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,0),13);
- f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name2,0,name1,28,29);
+ f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,28,29);
self.assertAlmostEqual(3*VAL1,f1.getArray().getIJ(0,0),13);
- f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name2,0,name1,38,39);
+ f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,38,39);
self.assertAlmostEqual(3*VAL2,f1.getArray().getIJ(0,0),13);
- f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name2,0,name1,48,49);
+ f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,48,49);
self.assertAlmostEqual(4*VAL2,f1.getArray().getIJ(0,0),13);
#
- f1=MEDLoader.MEDLoader.ReadFieldNode(fileName,name2,0,name1,8,9);
+ f1=MEDLoader.MEDLoader.ReadFieldNode(fileName,name3,0,name1,8,9);
self.assertAlmostEqual(71.,f1.getArray().getIJ(0,3),13);
- f1=MEDLoader.MEDLoader.ReadFieldNode(fileName,name2,0,name1,108,109);
+ f1=MEDLoader.MEDLoader.ReadFieldNode(fileName,name3,0,name1,108,109);
self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,3),13);
- f1=MEDLoader.MEDLoader.ReadFieldNode(fileName,name2,0,name1,208,209);
+ f1=MEDLoader.MEDLoader.ReadFieldNode(fileName,name3,0,name1,208,209);
self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,3),13);
pass
MEDLoader.MEDLoader.WriteField(fileName,f1,False);#<- False important for the test
#
f2=MEDLoader.MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),2,7);
+ tt=MEDLoader.MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName());
+ self.assertEqual(tt,[MEDLoader.ON_CELLS]);
f2.checkCoherency();
self.assertTrue(f1.isEqual(f2,1e-12,1e-12));
#
array=MEDLoader.DataArrayDouble.New();
arr1=[71.,171.,10.,110.,20.,120.,30.,130.,40.,140.]
array.setValues(arr1,m2d.getNumberOfCells(),2);
- array.setInfoOnComponent(0,"plkj (mm)");
- array.setInfoOnComponent(1,"pqqqss (mm)");
+ array.setInfoOnComponent(0,"plkj [mm]");
+ array.setInfoOnComponent(1,"pqqqss [mm]");
f1.setArray(array);
tmp=array.setValues(arr1,m2d.getNumberOfCells(),2);
f1.setTime(3.14,2,7);
arr1=[1.,101.,2.,102.,3.,103.,4.,104.,5.,105.,6.,106.,7.,107.,8.,108.,9.,109.,10.,110.,11.,111.,12.,112.]
array.setValues(arr1,nbOfNodes,2);
f1.setArray(array);
- array.setInfoOnComponent(0,"tyty (mm)");
- array.setInfoOnComponent(1,"uiop (MW)");
+ array.setInfoOnComponent(0,"tyty [mm]");
+ array.setInfoOnComponent(1,"uiop [MW]");
f1.setTime(3.14,2,7);
f1.checkCoherency();
arr2=[2,4,5,3,6,7]
array=MEDLoader.DataArrayDouble.New();
array.setValues(arr2,12,2);
f1.setArray(array);
- array.setInfoOnComponent(0,"plkj (mm)");
- array.setInfoOnComponent(1,"pqqqss (mm)");
+ array.setInfoOnComponent(0,"plkj [mm]");
+ array.setInfoOnComponent(1,"pqqqss [mm]");
tmp=array.getPointer();
f1.setTime(3.17,2,7);
#
f1.setArray(array);
arr1=[71.,171.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.]
array.setValues(arr1,6,2);
- array.setInfoOnComponent(0,"plkj (mm)");
- array.setInfoOnComponent(1,"pqqqss (mm)");
+ array.setInfoOnComponent(0,"plkj [mm]");
+ array.setInfoOnComponent(1,"pqqqss [mm]");
f1.setTime(3.14,2,7);
f1.checkCoherency();
#
arr2=[1071.,1171.,1010.,1110.,1020.,1120.,1030.,1130.,1040.,1140.,1050.,1150.,
1060.,1160.,1070.,1170.,1080.,1180.,1090.,1190.,1091.,1191.,1092.,1192.]
array.setValues(arr2,12,2)
- array.setInfoOnComponent(0,"plkj (mm)");
- array.setInfoOnComponent(1,"pqqqss (mm)");
- f2.setTime(3.17,2,7);
+ array.setInfoOnComponent(0,"plkj [mm]");
+ array.setInfoOnComponent(1,"pqqqss [mm]");
+ f2.setTime(3.14,2,7);
f2.checkCoherency();
#
MEDLoader.MEDLoader.WriteField(fileName,f1,True);
- ts=MEDLoader.MEDLoader.GetTypesOfField(fileName,f1.getName(),f1.getMesh().getName());
+ ts=MEDLoader.MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName());
self.assertEqual(1,len(ts));
self.assertEqual(MEDLoader.ON_CELLS,ts[0]);
fs=MEDLoader.MEDLoader.GetAllFieldNamesOnMesh(fileName,f1.getMesh().getName());
self.assertEqual(1,len(fs));
self.assertTrue(fs[0]=="FieldMix");
#
- ts=MEDLoader.MEDLoader.GetTypesOfField(fileName,f1.getName(),f1.getMesh().getName());
+ ts=MEDLoader.MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName());
self.assertEqual(2,len(ts));
self.assertEqual(MEDLoader.ON_NODES,ts[0]);
self.assertEqual(MEDLoader.ON_CELLS,ts[1]);
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
from MEDLoader import *
VAL2=-1111111111111.;
name1="AField";
name3="AMesh1";
- name2="AMesh2";
f1=MEDLoaderDataForTest.buildVecFieldOnCells_1();
f1.getMesh().setName(name3);
f1.setName(name1);
f1.setTime(10.14,18,19);
f1.getArray().setIJ(0,0,VAL2);
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
- f1.getMesh().setName(name2);
+ f1.getMesh().setName(name3);
f1.setTime(10.55,28,29);
f1.getArray().setIJ(0,0,3*VAL1);
- MEDLoader.WriteFieldDep(fileName,f1,False);
+ MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.setTime(10.66,38,39);
f1.getArray().setIJ(0,0,3*VAL2);
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
#ON NODES
f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1();
f1.setName(name1);
- f1.getMesh().setName(name2);
+ f1.getMesh().setName(name3);
f1.setTime(110.,8,9);
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1.setTime(110.,108,109);
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
#
it1=MEDLoader.GetCellFieldIterations(fileName,name3,name1);
- self.assertEqual(2,len(it1));
+ self.assertEqual(5,len(it1));
self.assertEqual(8,it1[0][0]); self.assertEqual(9,it1[0][1]);
self.assertEqual(18,it1[1][0]); self.assertEqual(19,it1[1][1]);
- it2=MEDLoader.GetCellFieldIterations(fileName,name2,name1);
- self.assertEqual(3,len(it2));
- self.assertEqual(28,it2[0][0]); self.assertEqual(29,it2[0][1]);
- self.assertEqual(38,it2[1][0]); self.assertEqual(39,it2[1][1]);
- self.assertEqual(48,it2[2][0]); self.assertEqual(49,it2[2][1]);
- it3=MEDLoader.GetNodeFieldIterations(fileName,name2,name1);
+ self.assertEqual(28,it1[2][0]); self.assertEqual(29,it1[2][1]);
+ self.assertEqual(38,it1[3][0]); self.assertEqual(39,it1[3][1]);
+ self.assertEqual(48,it1[4][0]); self.assertEqual(49,it1[4][1]);
+ it3=MEDLoader.GetNodeFieldIterations(fileName,name3,name1);
self.assertEqual(3,len(it3));
self.assertEqual(8,it3[0][0]); self.assertEqual(9,it3[0][1]);
self.assertEqual(108,it3[1][0]); self.assertEqual(109,it3[1][1]);
self.assertEqual(208,it3[2][0]); self.assertEqual(209,it3[2][1]);
- it4=MEDLoader.GetNodeFieldIterations(fileName,name3,name1);
- self.assertTrue(len(it4)==0);
#
#
f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,8,9);
self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,0),13);
f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,18,19);
self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,0),13);
- f1=MEDLoader.ReadFieldCell(fileName,name2,0,name1,28,29);
+ f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,28,29);
self.assertAlmostEqual(3*VAL1,f1.getArray().getIJ(0,0),13);
- f1=MEDLoader.ReadFieldCell(fileName,name2,0,name1,38,39);
+ f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,38,39);
self.assertAlmostEqual(3*VAL2,f1.getArray().getIJ(0,0),13);
- f1=MEDLoader.ReadFieldCell(fileName,name2,0,name1,48,49);
+ f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,48,49);
self.assertAlmostEqual(4*VAL2,f1.getArray().getIJ(0,0),13);
#
- f1=MEDLoader.ReadFieldNode(fileName,name2,0,name1,8,9);
+ f1=MEDLoader.ReadFieldNode(fileName,name3,0,name1,8,9);
self.assertAlmostEqual(71.,f1.getArray().getIJ(0,3),13);
- f1=MEDLoader.ReadFieldNode(fileName,name2,0,name1,108,109);
+ f1=MEDLoader.ReadFieldNode(fileName,name3,0,name1,108,109);
self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,3),13);
- f1=MEDLoader.ReadFieldNode(fileName,name2,0,name1,208,209);
+ f1=MEDLoader.ReadFieldNode(fileName,name3,0,name1,208,209);
self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,3),13);
pass
array=DataArrayDouble.New();
arr1=[71.,171.,10.,110.,20.,120.,30.,130.,40.,140.]
array.setValues(arr1,m2d.getNumberOfCells(),2);
- array.setInfoOnComponent(0,"plkj (mm)");
- array.setInfoOnComponent(1,"pqqqss (mm)");
+ array.setInfoOnComponent(0,"plkj [mm]");
+ array.setInfoOnComponent(1,"pqqqss [mm]");
f1.setArray(array);
tmp=array.setValues(arr1,m2d.getNumberOfCells(),2);
f1.setTime(3.14,2,7);
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <vector>
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# MED MEDMEM_SWIG : binding of C++ implementation and Python
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "MEDLoaderTest.hxx"
MEDLoader::WriteField("file7.med",f1,true);
f2=MEDLoader::ReadFieldNode("file7.med",f1->getMesh()->getName(),0,f1->getName(),2,3);
CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
+ // testing kind message on error of field type.
+ CPPUNIT_ASSERT_THROW(MEDLoader::ReadFieldCell("file7.med",f1->getMesh()->getName(),0,f1->getName(),2,3),INTERP_KERNEL::Exception);
+ //
f1->decrRef();
f2->decrRef();
}
static const double VAL2=-1111111111111.;
const char name1[]="AField";
const char name3[]="AMesh1";
- const char name2[]="AMesh2";
MEDCouplingFieldDouble *f1=buildVecFieldOnCells_1();
((MEDCouplingMesh *)f1->getMesh())->setName(name3);
f1->setName(name1);
f1->setTime(10.14,18,19);
tmp[0]=VAL2;
MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
- ((MEDCouplingMesh *)f1->getMesh())->setName(name2);
f1->setTime(10.55,28,29);
tmp[0]=3*VAL1;
- MEDLoader::WriteField(fileName,f1,false);
- std::vector<std::string> vec=MEDLoader::GetMeshNamesOnField(fileName,name1);
- CPPUNIT_ASSERT_EQUAL(2,(int)vec.size());
- CPPUNIT_ASSERT(vec[0]==name3);
- CPPUNIT_ASSERT(vec[1]==name2);
+ MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1->setTime(10.66,38,39);
tmp[0]=3*VAL2;
MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1->decrRef();
f1=buildVecFieldOnNodes_1();
f1->setName(name1);
- ((MEDCouplingMesh *)f1->getMesh())->setName(name2);
+ ((MEDCouplingMesh *)f1->getMesh())->setName(name3);
f1->setTime(110.,8,9);
MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
f1->setTime(110.,108,109);
MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
//
std::vector< std::pair<int,int> > it1=MEDLoader::GetCellFieldIterations(fileName,name3,name1);
- CPPUNIT_ASSERT_EQUAL(2,(int)it1.size());
+ CPPUNIT_ASSERT_EQUAL(5,(int)it1.size());
CPPUNIT_ASSERT_EQUAL(8,it1[0].first); CPPUNIT_ASSERT_EQUAL(9,it1[0].second);
CPPUNIT_ASSERT_EQUAL(18,it1[1].first); CPPUNIT_ASSERT_EQUAL(19,it1[1].second);
- std::vector< std::pair<int,int> > it2=MEDLoader::GetCellFieldIterations(fileName,name2,name1);
- CPPUNIT_ASSERT_EQUAL(3,(int)it2.size());
- CPPUNIT_ASSERT_EQUAL(28,it2[0].first); CPPUNIT_ASSERT_EQUAL(29,it2[0].second);
- CPPUNIT_ASSERT_EQUAL(38,it2[1].first); CPPUNIT_ASSERT_EQUAL(39,it2[1].second);
- CPPUNIT_ASSERT_EQUAL(48,it2[2].first); CPPUNIT_ASSERT_EQUAL(49,it2[2].second);
- std::vector< std::pair<int,int> > it3=MEDLoader::GetNodeFieldIterations(fileName,name2,name1);
+ CPPUNIT_ASSERT_EQUAL(28,it1[2].first); CPPUNIT_ASSERT_EQUAL(29,it1[2].second);
+ CPPUNIT_ASSERT_EQUAL(38,it1[3].first); CPPUNIT_ASSERT_EQUAL(39,it1[3].second);
+ CPPUNIT_ASSERT_EQUAL(48,it1[4].first); CPPUNIT_ASSERT_EQUAL(49,it1[4].second);
+ std::vector< std::pair<int,int> > it3=MEDLoader::GetNodeFieldIterations(fileName,name3,name1);
CPPUNIT_ASSERT_EQUAL(3,(int)it3.size());
CPPUNIT_ASSERT_EQUAL(8,it3[0].first); CPPUNIT_ASSERT_EQUAL(9,it3[0].second);
CPPUNIT_ASSERT_EQUAL(108,it3[1].first); CPPUNIT_ASSERT_EQUAL(109,it3[1].second);
CPPUNIT_ASSERT_EQUAL(208,it3[2].first); CPPUNIT_ASSERT_EQUAL(209,it3[2].second);
- std::vector< std::pair<int,int> > it4=MEDLoader::GetNodeFieldIterations(fileName,name3,name1);
- CPPUNIT_ASSERT(it4.empty());
//
f1->decrRef();
//
f1=MEDLoader::ReadFieldCell(fileName,name3,0,name1,18,19);
CPPUNIT_ASSERT_DOUBLES_EQUAL(VAL2,f1->getArray()->getConstPointer()[0],1e-13);
f1->decrRef();
- f1=MEDLoader::ReadFieldCell(fileName,name2,0,name1,28,29);
+ f1=MEDLoader::ReadFieldCell(fileName,name3,0,name1,28,29);
CPPUNIT_ASSERT_DOUBLES_EQUAL(3*VAL1,f1->getArray()->getConstPointer()[0],1e-13);
f1->decrRef();
- f1=MEDLoader::ReadFieldCell(fileName,name2,0,name1,38,39);
+ f1=MEDLoader::ReadFieldCell(fileName,name3,0,name1,38,39);
CPPUNIT_ASSERT_DOUBLES_EQUAL(3*VAL2,f1->getArray()->getConstPointer()[0],1e-13);
f1->decrRef();
- f1=MEDLoader::ReadFieldCell(fileName,name2,0,name1,48,49);
+ f1=MEDLoader::ReadFieldCell(fileName,name3,0,name1,48,49);
CPPUNIT_ASSERT_DOUBLES_EQUAL(4*VAL2,f1->getArray()->getConstPointer()[0],1e-13);
f1->decrRef();
//
- f1=MEDLoader::ReadFieldNode(fileName,name2,0,name1,8,9);
+ f1=MEDLoader::ReadFieldNode(fileName,name3,0,name1,8,9);
CPPUNIT_ASSERT_DOUBLES_EQUAL(71.,f1->getArray()->getConstPointer()[3],1e-13);
f1->decrRef();
- f1=MEDLoader::ReadFieldNode(fileName,name2,0,name1,108,109);
+ f1=MEDLoader::ReadFieldNode(fileName,name3,0,name1,108,109);
CPPUNIT_ASSERT_DOUBLES_EQUAL(VAL1,f1->getArray()->getConstPointer()[3],1e-13);
f1->decrRef();
- f1=MEDLoader::ReadFieldNode(fileName,name2,0,name1,208,209);
+ f1=MEDLoader::ReadFieldNode(fileName,name3,0,name1,208,209);
CPPUNIT_ASSERT_DOUBLES_EQUAL(VAL2,f1->getArray()->getConstPointer()[3],1e-13);
f1->decrRef();
}
MEDLoader::WriteField(fileName,f1,false);//<- false important for the test
//
MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName(),0,f1->getName(),2,7);
+ std::vector<ParaMEDMEM::TypeOfField> types=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName(),f1->getName());
+ CPPUNIT_ASSERT_EQUAL(1,(int)types.size());
+ CPPUNIT_ASSERT(types[0]==ON_CELLS);
f2->checkCoherency();
CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
//
mesh2->decrRef();
}
+/*!
+ * Test MED file profiles.
+ */
void MEDLoaderTest::testFieldNodeProfilRW1()
{
const char fileName[]="file19.med";
array->alloc(nbOfNodes,2);
std::copy(arr1,arr1+24,array->getPointer());
f1->setArray(array);
- array->setInfoOnComponent(0,"tyty (mm)");
- array->setInfoOnComponent(1,"uiop (MW)");
+ array->setInfoOnComponent(0,"tyty [mm]");
+ array->setInfoOnComponent(1,"uiop [MW]");
array->decrRef();
f1->setTime(3.14,2,7);
f1->checkCoherency();
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(12,2);
f1->setArray(array);
- array->setInfoOnComponent(0,"plkj (mm)");
- array->setInfoOnComponent(1,"pqqqss (mm)");
+ array->setInfoOnComponent(0,"plkj [mm]");
+ array->setInfoOnComponent(1,"pqqqss [mm]");
array->decrRef();
double *tmp=array->getPointer();
std::copy(arr2,arr2+24,tmp);
f1->decrRef();
}
+/*!
+ * Shuffle de cells but no profile. Like pointe.med
+ */
void MEDLoaderTest::testMultiFieldShuffleRW1()
{
const char fileName[]="file17.med";
f1->setMesh(m2d);
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(m2d->getNumberOfCells(),2);
- array->setInfoOnComponent(0,"plkj (mm)");
- array->setInfoOnComponent(1,"pqqqss (mm)");
+ array->setInfoOnComponent(0,"plkj [mm]");
+ array->setInfoOnComponent(1,"pqqqss [mm]");
f1->setArray(array);
array->decrRef();
double *tmp=array->getPointer();
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(6,2);
f1->setArray(array);
- array->setInfoOnComponent(0,"plkj (mm)");
- array->setInfoOnComponent(1,"pqqqss (mm)");
+ array->setInfoOnComponent(0,"plkj [mm]");
+ array->setInfoOnComponent(1,"pqqqss [mm]");
array->decrRef();
double *tmp=array->getPointer();
const double arr1[12]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.};
array=DataArrayDouble::New();
array->alloc(12,2);
f2->setArray(array);
- array->setInfoOnComponent(0,"plkj (mm)");
- array->setInfoOnComponent(1,"pqqqss (mm)");
+ array->setInfoOnComponent(0,"plkj [mm]");
+ array->setInfoOnComponent(1,"pqqqss [mm]");
array->decrRef();
tmp=array->getPointer();
const double arr2[24]={
1060.,1160.,1070.,1170.,1080.,1180.,1090.,1190.,1091.,1191.,1092.,1192.
};
std::copy(arr2,arr2+24,tmp);
- f2->setTime(3.17,2,7);
+ f2->setTime(3.14,2,7);
f2->checkCoherency();
//
MEDLoader::WriteField(fileName,f1,true);
- std::vector<ParaMEDMEM::TypeOfField> ts=MEDLoader::GetTypesOfField(fileName,f1->getName(),f1->getMesh()->getName());
+ std::vector<ParaMEDMEM::TypeOfField> ts=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName(),f1->getName());
CPPUNIT_ASSERT_EQUAL(1,(int)ts.size());
CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[0]);
std::vector<std::string> fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName());
CPPUNIT_ASSERT_EQUAL(1,(int)fs.size());
CPPUNIT_ASSERT(fs[0]=="FieldMix");
//
- ts=MEDLoader::GetTypesOfField(fileName,f1->getName(),f1->getMesh()->getName());
+ ts=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName(),f1->getName());
CPPUNIT_ASSERT_EQUAL(2,(int)ts.size());
CPPUNIT_ASSERT_EQUAL(ON_NODES,ts[0]);
CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[1]);
mesh->finishInsertingCells();
DataArrayDouble *myCoords=DataArrayDouble::New();
myCoords->alloc(6,1);
- myCoords->setInfoOnComponent(0,"tototototototot (m*m*m*m*m*m*m*m)");
+ myCoords->setInfoOnComponent(0,"tototototototot [m*m*m*m*m*m*m*m]");
std::copy(coords,coords+6,myCoords->getPointer());
mesh->setCoords(myCoords);
myCoords->decrRef();
targetMesh->finishInsertingCells();
DataArrayDouble *myCoords=DataArrayDouble::New();
myCoords->alloc(12,2);
- myCoords->setInfoOnComponent(0,"tototototototot (m)");
- myCoords->setInfoOnComponent(1,"energie (kW)");
+ myCoords->setInfoOnComponent(0,"tototototototot [m]");
+ myCoords->setInfoOnComponent(1,"energie [kW]");
std::copy(targetCoords,targetCoords+24,myCoords->getPointer());
targetMesh->setCoords(myCoords);
myCoords->decrRef();
targetMesh->setName("2DMesh_2");
targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3);
- targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI6,6,targetConn+6);
targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+12);
targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+16);
+ targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI6,6,targetConn+6);
targetMesh->finishInsertingCells();
DataArrayDouble *myCoords=DataArrayDouble::New();
myCoords->alloc(12,2);
- myCoords->setInfoOnComponent(0,"toto (m)");
- myCoords->setInfoOnComponent(1,"energie (kW)");
+ myCoords->setInfoOnComponent(0,"toto [m]");
+ myCoords->setInfoOnComponent(1,"energie [kW]");
std::copy(targetCoords,targetCoords+24,myCoords->getPointer());
targetMesh->setCoords(myCoords);
myCoords->decrRef();
targetMesh->setName("3DSurfMesh_1");
targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3);
- targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI6,6,targetConn+6);
targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+12);
targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+16);
+ targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI6,6,targetConn+6);
targetMesh->insertNextCell(INTERP_KERNEL::NORM_POLYGON,4,targetConn+20);
targetMesh->finishInsertingCells();
DataArrayDouble *myCoords=DataArrayDouble::New();
myCoords->alloc(12,3);
- myCoords->setInfoOnComponent(0,"toto (m)");
- myCoords->setInfoOnComponent(2,"ff (km)");//component 1 is not set for test
+ myCoords->setInfoOnComponent(0,"toto [m]");
+ myCoords->setInfoOnComponent(2,"ff [km]");//component 1 is not set for test
std::copy(targetCoords,targetCoords+36,myCoords->getPointer());
targetMesh->setCoords(myCoords);
myCoords->decrRef();
ret->finishInsertingCells();
DataArrayDouble *myCoords=DataArrayDouble::New();
myCoords->alloc(60,3);
- myCoords->setInfoOnComponent(0,"titi (m)");
- myCoords->setInfoOnComponent(1,"density power (MW/m^3)");
- myCoords->setInfoOnComponent(2,"t (kW)");
+ myCoords->setInfoOnComponent(0,"titi [m]");
+ myCoords->setInfoOnComponent(1,"density power [MW/m^3]");
+ myCoords->setInfoOnComponent(2,"t [kW]");
std::copy(coords,coords+180,myCoords->getPointer());
ret->setCoords(myCoords);
myCoords->decrRef();
MEDCouplingUMesh *MEDLoaderTest::build3DMesh_2()
{
MEDCouplingUMesh *m3dsurfBase=build3DSurfMesh_1();
- int numbers[5]={0,1,3,4,5};
+ int numbers[5]={0,1,2,3,5};
MEDCouplingUMesh *m3dsurf=(MEDCouplingUMesh *)m3dsurfBase->buildPartOfMySelf(numbers,numbers+5,false);
m3dsurfBase->decrRef();
MEDCouplingUMesh *m1dBase=build1DMesh_1();
f1->setMesh(mesh);
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(nbOfCells,3);
- array->setInfoOnComponent(0,"power (MW/m^3)");
- array->setInfoOnComponent(1,"density (g/cm^3)");
- array->setInfoOnComponent(2,"temperature (K)");
+ array->setInfoOnComponent(0,"power [MW/m^3]");
+ array->setInfoOnComponent(1,"density [g/cm^3]");
+ array->setInfoOnComponent(2,"temperature [K]");
f1->setArray(array);
array->decrRef();
double *tmp=array->getPointer();
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(nbOfNodes,3);
f1->setArray(array);
- array->setInfoOnComponent(0,"power (MW/m^3)");
- array->setInfoOnComponent(1,"density (g/cm^3)");
- array->setInfoOnComponent(2,"temperature (K)");
+ array->setInfoOnComponent(0,"power [MW/m^3]");
+ array->setInfoOnComponent(1,"density [g/cm^3]");
+ array->setInfoOnComponent(2,"temperature [K]");
array->decrRef();
double *tmp=array->getPointer();
const double arr1[36]={
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1);
const double refCoo2[12]={-1.0,1.0, -1.0,-1.0, 1.0,-1.0, -1.0,0.0, 0.0,-1.0, 0.0,0.0 };
std::vector<double> _refCoo2(refCoo2,refCoo2+12);
- _gsCoo1.resize(6); _wg1.resize(3);
- f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI6,_refCoo2,_gsCoo1,_wg1);
+ std::vector<double> _gsCoo2(_gsCoo1);
+ std::vector<double> _wg2(_wg1);
+ _gsCoo2.resize(6); _wg2.resize(3);
const double refCoo3[8]={ 0.,0., 1.,0., 1.,1., 0.,1. };
std::vector<double> _refCoo3(refCoo3,refCoo3+8);
_gsCoo1.resize(4); _wg1.resize(2);
f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo3,_gsCoo1,_wg1);
+ f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI6,_refCoo2,_gsCoo2,_wg2);
DataArrayDouble *array=DataArrayDouble::New();
array->alloc(19,2);
double *ptr=array->getPointer();
ptr[i]=(double)(i+7);
f->setArray(array);
f->setName("MyFirstFieldOnGaussPoint");
- array->setInfoOnComponent(0,"power (MW/m^3)");
+ array->setInfoOnComponent(0,"power [MW/m^3]");
array->setInfoOnComponent(1,"density");
array->decrRef();
f->checkCoherency();
for(int i=0;i<20*2;i++)
ptr[i]=(double)(i+8);
f->setArray(array);
- array->setInfoOnComponent(0,"power (W)");
+ array->setInfoOnComponent(0,"power [W]");
array->setInfoOnComponent(1,"temperature");
f->setName("MyFieldOnGaussNE");
array->decrRef();
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef __MEDLOADERTEST_HXX__
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2011 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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2011 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "CppUnitTest.hxx"