-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
ENDIF(COMMAND cmake_policy)
ENABLE_TESTING()
-SET(VERSION "6.4.0")
+SET(VERSION "6.5.0")
SET(VERSION_DEV "1")
SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
SET(MED_ENABLE_KERNEL ON)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
+ INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
- INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
ELSE(KERNEL_ROOT_DIR)
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-dnl Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl Copyright (C) 2007-2012 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
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012 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
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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
#!/usr/bin/env python
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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
MEDCouplingExtrudedMesh.* \
MEDCouplingFieldDouble.* \
MEDCouplingField.* \
+ MEDCouplingNatureOfField.hxx \
MEDCouplingFieldTemplate.* \
MEDCouplingFieldDiscretization.* \
MEDCouplingTimeDiscretization.* \
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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
</div>
<div class="footer1">
<div style="text-align: center;">
- Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+ Copyright © 2007-2012 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>
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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
fi;
uninstall-local:
- rm -rf $(DESTDIR)$(docdir)/tui/MED
\ No newline at end of file
+ @test -d $(DESTDIR)$(tuidocdir) && chmod -R +w $(DESTDIR)$(tuidocdir) ; \
+ for filen in `find $(DESTDIR)$(tuidocdir) -mindepth 1 -maxdepth 1` dummy ; do \
+ case $${filen} in \
+ dummy ) ;; \
+ $(DESTDIR)$(tuidocdir)/head.png ) ;; \
+ * ) echo "removing $${filen}" && rm -rf $${filen} ;; \
+ esac ; \
+ done
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2012 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
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = jpg
+DOT_IMAGE_FORMAT = png
DOT_FONTNAME = Arial
DOT_PATH =
DOTFILE_DIRS =
<div class="footer1">
<!--hr style="width: 100%; height: 2px;"-->
<div style="text-align: center;">
-Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+Copyright © 2007-2012 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>
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
_map_of_unique_instance.insert(std::make_pair(NORM_POLYHED,CellModel(NORM_POLYHED)));
_map_of_unique_instance.insert(std::make_pair(NORM_QPOLYG,CellModel(NORM_QPOLYG)));
_map_of_unique_instance.insert(std::make_pair(NORM_POLYL,CellModel(NORM_POLYL)));
+ _map_of_unique_instance.insert(std::make_pair(NORM_ERROR,CellModel(NORM_ERROR)));
}
CellModel::CellModel(NormalizedCellType type):_type(type)
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
}
}
+bool QuadraticPolygon::isButterflyAbs()
+{
+ INTERP_KERNEL::Bounds b;
+ double xBary,yBary;
+ b.prepareForAggregation();
+ fillBounds(b);
+ double dimChar=b.getCaracteristicDim();
+ b.getBarycenter(xBary,yBary);
+ applyGlobalSimilarity(xBary,yBary,dimChar);
+ //
+ return isButterfly();
+}
+
bool QuadraticPolygon::isButterfly() const
{
for(std::list<ElementaryEdge *>::const_iterator it=_sub_edges.begin();it!=_sub_edges.end();it++)
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
~QuadraticPolygon();
void closeMe() const;
void circularPermute();
+ bool isButterflyAbs();
bool isButterfly() const;
void dumpInXfigFile(const char *fileName) const;
void dumpInXfigFileWithOther(const ComposedEdge& other, const char *fileName) const;
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
/// that result from the split.
typedef enum { PLANAR_FACE_5 = 5, PLANAR_FACE_6 = 6, GENERAL_24 = 24, GENERAL_48 = 48 } SplittingPolicy;
+ /*!
+ * \class InterpolationOptions
+ * Class defining the options for all interpolation algorithms.
+ *
+ * List of options, possible values and default values can be found on this page:
+ * \ref InterpKerIntersectors
+ */
class INTERPKERNEL_EXPORT InterpolationOptions
{
private:
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2009-2011 OPEN CASCADE
+// Copyright (C) 2009-2012 OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#! /bin/env python
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#!/bin/bash
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
void MEDCouplingCMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
{
- //not implemented yet
+ int spaceDim=getSpaceDimension();
+ int tmpCell[3],tmpNode[3];
+ getSplitCellValues(tmpCell);
+ getSplitNodeValues(tmpNode);
+ int tmp2[3];
+ GetPosFromId(cellId,spaceDim,tmpCell,tmp2);
+ switch(spaceDim)
+ {
+ case 1:
+ conn.push_back(tmp2[0]); conn.push_back(tmp2[0]+1);
+ break;
+ case 2:
+ conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]); conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+1);
+ conn.push_back((tmp2[1]+1)*(tmpCell[1]+1)+tmp2[0]+1); conn.push_back((tmp2[1]+1)*(tmpCell[1]+1)+tmp2[0]);
+ break;
+ case 3:
+ conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+tmp2[2]*tmpNode[2]); conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+1+tmp2[2]*tmpNode[2]);
+ conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]+1+tmp2[2]*tmpNode[2]); conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]+tmp2[2]*tmpNode[2]);
+ conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+(tmp2[2]+1)*tmpNode[2]); conn.push_back(tmp2[1]*tmpCell[1]+tmp2[0]+1+(tmp2[2]+1)*tmpNode[2]);
+ conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]+1+(tmp2[2]+1)*tmpNode[2]); conn.push_back((tmp2[1]+1)*tmpNode[1]+tmp2[0]+(tmp2[2]+1)*tmpNode[2]);
+ break;
+ default:
+ throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeIdsOfCell : big problem spacedim must be in 1,2 or 3 !");
+ };
}
-void MEDCouplingCMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
+void MEDCouplingCMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception)
{
int tmp[3];
int spaceDim=getSpaceDimension();
const double *d=getCoordsAt(i)->getConstPointer();
int nbOfNodes=getCoordsAt(i)->getNbOfElems();
double ref=pos[i];
- const double *w=std::find_if(d,d+nbOfNodes,std::bind2nd(std::greater<double>(),ref));
+ const double *w=std::find_if(d,d+nbOfNodes,std::bind2nd(std::greater_equal<double>(),ref));
int w2=(int)std::distance(d,w);
- if(w2<nbOfNodes && w2!=0)
+ if(w2<nbOfNodes)
{
+ if(w2==0)
+ {
+ if(ref>d[0]-eps)
+ w2=1;
+ else
+ return -1;
+ }
ret+=coeff*(w2-1);
coeff*=nbOfNodes-1;
}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
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;
+ void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception);
std::string simpleRepr() const;
std::string advancedRepr() const;
const DataArrayDouble *getCoordsAt(int i) const throw(INTERP_KERNEL::Exception);
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
* because the mesh is aggregated and potentially modified by rotate or translate method.
* @param cell2DId Id of cell in mesh2D mesh where the computation of 1D mesh will be done.
*/
-MEDCouplingExtrudedMesh *MEDCouplingExtrudedMesh::New(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
+MEDCouplingExtrudedMesh *MEDCouplingExtrudedMesh::New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
{
return new MEDCouplingExtrudedMesh(mesh3D,mesh2D,cell2DId);
}
_mesh1D->copyTinyStringsFrom(otherC->_mesh1D);
}
-MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
-try:_mesh2D(mesh2D),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId)
+MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception)
+try:_mesh2D(const_cast<MEDCouplingUMesh *>(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId)
{
if(_mesh2D!=0)
_mesh2D->incrRef();
conn.insert(conn.end(),tmp2.begin(),tmp2.end());
}
-void MEDCouplingExtrudedMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
+void MEDCouplingExtrudedMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception)
{
int nbOfNodes2D=_mesh2D->getNumberOfNodes();
int locId=nodeId%nbOfNodes2D;
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
class MEDCOUPLING_EXPORT MEDCouplingExtrudedMesh : public MEDCouplingMesh
{
public:
- static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
static MEDCouplingExtrudedMesh *New();
MEDCouplingMeshType getType() const;
void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
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;
+ void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception);
std::string simpleRepr() const;
std::string advancedRepr() const;
void checkCoherency() const throw (INTERP_KERNEL::Exception);
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);
+ MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
MEDCouplingExtrudedMesh(const MEDCouplingExtrudedMesh& other, bool deepCopy);
MEDCouplingExtrudedMesh();
void computeExtrusion(const MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception);
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
return _type->getEnum();
}
+/*!
+ * This method returns the nature of field. This information is very important during interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC.
+ * In other context than the two mentioned before this attribute of the field is not sensitive. This attribute is not store in MED file in MEDLoader.
+ * More information of the semantic, and the consequence of this attribute in the result of the interpolation, is available \ref NatureOfField "here".
+ */
+NatureOfField MEDCouplingField::getNature() const
+{
+ return _nature;
+}
+
+/*!
+ * This method set the nature of field in \b this.This information is very important during interpolation process using ParaMEDMEM::MEDCouplingRemapper or ParaMEDMEM::InterpKernelDEC.
+ * In other context than the two mentioned before this attribute of the field is not sensitive. This attribute is not store in MED file in MEDLoader.
+ * More information of the semantic, and the consequence of this attribute in the result of the interpolation, is available \ref TableNatureOfField "here".
+ */
void MEDCouplingField::setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception)
{
_nature=nat;
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
void setDescription(const char *desc) { _desc=desc; }
const char *getName() const { return _name.c_str(); }
TypeOfField getTypeOfField() const;
- NatureOfField getNature() const { return _nature; }
+ NatureOfField getNature() const;
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);
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
}
/*!
- * This method performs a copy of 'this'. The copy is deep if 'recDeepCpy' equals to true, soft if 'recDeepCpy' equals to false.
- * \b WARNING \b the \b underlying \b mesh of the returned field \b is \b the \b same (same pointer) \b than \b 'this'. It allows the user to perform methods
- * MEDCouplingFieldDouble::AddFields, MEDCouplingFieldDouble::MultiplyFields with 'this' and the returned field.
+ * This method performs a copy of \b this \b without \b any \b copy \b of \b the \b underlying \b mesh ( see warning section of this method).
+ * The copy of arrays is deep if \b recDeepCpy equals to true, no copy of arrays is done if \b recDeepCpy equals to false.
+ *
+ * \c clone(false) is rather dedicated for advanced users that want to limit the amount of memory.
+ *
+ * It allows the user to perform methods
+ * MEDCouplingFieldDouble::AddFields, MEDCouplingFieldDouble::MultiplyFields with \b this and the returned field.
+ *
+ * \warning The \b underlying \b mesh of the returned field is \b always the same (same pointer) than \b this \b whatever \b the \b value \b of \b recDeepCpy \b parameter.
* If the user wants to duplicated deeply the underlying mesh he should call MEDCouplingFieldDouble::cloneWithMesh method or MEDCouplingFieldDouble::deepCpy instead.
+ *
+ * \param [in] recDeepCpy specifies if underlying arrays in \b this should be copied of only attached to the returned field.
+ * \return a newly allocated MEDCouplingFieldDouble instance that the caller should deal with.
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::clone(bool recDeepCpy) const
{
/*!
* This method behaves exactly like MEDCouplingFieldDouble::clone method \b except \b that \b here \b the \b underlying \b mesh \b is \b systematically
- * (whatever the value of the input parameter 'recDeepCpy') \b deeply \b duplicated.
- * So the resulting field of this call cannot be called with 'this' with following methods MEDCouplingFieldDouble::AddFields, MEDCouplingFieldDouble::MultiplyFields ...
+ * (whatever the value of the input parameter 'recDeepCpy') \b deeply \b duplicated.\n \n
+ * The result of \c cloneWithMesh(true) is exactly the same than calling \ref MEDCouplingFieldDouble::deepCpy "deepCpy".
+ *
+ * So the resulting field of this call cannot be called with \b this with the following methods MEDCouplingFieldDouble::AddFields, MEDCouplingFieldDouble::MultiplyFields ...
* To avoid to deep copy the underlying mesh the user should call MEDCouplingFieldDouble::clone method instead.
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::cloneWithMesh(bool recDeepCpy) const
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
return (end-1-begin)/step+1;
}
+int DataArray::GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception)
+{
+ if(step==0)
+ throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES : step=0 is not allowed !");
+ if(end<begin && step>0)
+ {
+ std::ostringstream oss; oss << msg << " : end before begin whereas step is positive !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(begin<end && step<0)
+ {
+ std::ostringstream oss; oss << msg << " : invalid step should be > 0 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(begin!=end)
+ return (std::max(begin,end)-1-std::min(begin,end))/std::abs(step)+1;
+ else
+ return 0;
+}
+
DataArrayDouble *DataArrayDouble::New()
{
return new DataArrayDouble;
alloc(nbOfTuple,nbOfCompo);
}
-void DataArrayDouble::alloc(int nbOfTuple, int nbOfCompo)
+void DataArrayDouble::alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
+ if(nbOfTuple<0 || nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::alloc : request for negative length of data !");
_nb_of_tuples=nbOfTuple;
_info_on_compo.resize(nbOfCompo);
_mem.alloc(nbOfCompo*_nb_of_tuples);
declareAsNew();
}
+/*!
+ * This method makes the assumption that \b this is allocated. If not an INTERP_KERNEL::Exception will be raised.
+ * This method does not echange the values stored in \b this. Simply, the number of components before the call becomes the number of
+ * tuples and inversely the number of tuples becomes the number of components. \b WARNING the info on components can be alterated by this method.
+ */
+void DataArrayDouble::transpose() throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ int nbOfTuples=getNumberOfTuples();
+ rearrange(nbOfTuples);
+}
+
DataArrayDouble *DataArrayDouble::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
}
}
+/*!
+ * This method is equivalent to DataArrayDouble::getIJ except that here \b tupleId is checked to be in [0,this->getNumberOfTuples()) and compoId to be in [0,this->getNumberOfComponents()).
+ * If one of these check fails an INTERP_KERNEL::Exception will be thrown.
+ * So this method is safe but expensive if used to go through all data of \b this.
+ */
+double DataArrayDouble::getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(tupleId<0 || tupleId>=getNumberOfTuples())
+ {
+ std::ostringstream oss; oss << "DataArrayDouble::getIJSafe : request for tupleId " << tupleId << " should be in [0," << getNumberOfTuples() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(compoId<0 || compoId>=getNumberOfComponents())
+ {
+ std::ostringstream oss; oss << "DataArrayDouble::getIJSafe : request for compoId " << compoId << " should be in [0," << getNumberOfComponents() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return _mem[tupleId*((int)_info_on_compo.size())+compoId];
+}
+
/*!
* This method returns the last element in 'this'. So this method makes the hypothesis that 'this' is allocated.
* This method works only for arrays that have exactly number of components equal to 1. If not an exception is thrown.
throw INTERP_KERNEL::Exception("A value 0.0 have been detected !");
}
+/*!
+ * This method assume that \b this is allocated. If not an INTERP_KERNEL::Exception will be thrown.
+ * This method fills \b bounds params like that : \b bounds[0]=XMin, \b bounds[1]=XMax, \b bounds[2]=YMin, \b bounds[3]=YMax...
+ * Where X refers to component #0, and Y to component #1...
+ * This method set 2*this->getNumberOfComponents() elements in \b bounds, so it is up to the caller to allocated enough space before calling this method.
+ *
+ * @param [out] bounds array of size 2*this->getNumberOfComponents().
+ */
+void DataArrayDouble::getMinMaxPerComponent(double *bounds) const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ int dim=getNumberOfComponents();
+ for (int idim=0; idim<dim; idim++)
+ {
+ bounds[idim*2]=std::numeric_limits<double>::max();
+ bounds[idim*2+1]=-std::numeric_limits<double>::max();
+ }
+ const double *ptr=getConstPointer();
+ int nbOfTuples=getNumberOfTuples();
+ for(int i=0;i<nbOfTuples;i++)
+ {
+ for(int idim=0;idim<dim;idim++)
+ {
+ if(bounds[idim*2]>ptr[i*dim+idim])
+ {
+ bounds[idim*2]=ptr[i*dim+idim];
+ }
+ if(bounds[idim*2+1]<ptr[i*dim+idim])
+ {
+ bounds[idim*2+1]=ptr[i*dim+idim];
+ }
+ }
+ }
+}
+
double DataArrayDouble::getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception)
{
if(getNumberOfComponents()!=1)
declareAsNew();
}
+/*!
+ * This method returns a newly allocated array containing the application of negate on \b this.
+ * This method throws an INTERP_KERNEL::Exception if \b this is not allocated.
+ */
+DataArrayDouble *DataArrayDouble::negate() const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ DataArrayDouble *newArr=DataArrayDouble::New();
+ int nbOfTuples=getNumberOfTuples();
+ int nbOfComp=getNumberOfComponents();
+ newArr->alloc(nbOfTuples,nbOfComp);
+ const double *cptr=getConstPointer();
+ std::transform(cptr,cptr+nbOfTuples*nbOfComp,newArr->getPointer(),std::negate<double>());
+ newArr->copyStringInfoFrom(*this);
+ return newArr;
+}
+
DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
DataArrayDouble *DataArrayDouble::Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
{
- 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->begin(),a1->end(),a2->begin(),ret->getPointer(),std::plus<double>());
- ret->copyStringInfoFrom(*a1);
+ 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 Add !");
+ DataArrayDouble *ret=0;
+ if(nbOfComp==nbOfComp2)
+ {
+ ret=DataArrayDouble::New();
+ ret->alloc(nbOfTuple,nbOfComp);
+ std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::plus<double>());
+ ret->copyStringInfoFrom(*a1);
+ }
+ else
+ {
+ int nbOfCompMin,nbOfCompMax;
+ const DataArrayDouble *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=DataArrayDouble::New();
+ ret->alloc(nbOfTuple,nbOfCompMax);
+ const double *aMinPtr=aMin->getConstPointer();
+ const double *aMaxPtr=aMax->getConstPointer();
+ double *res=ret->getPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ res=std::transform(aMaxPtr+i*nbOfCompMax,aMaxPtr+(i+1)*nbOfCompMax,res,std::bind2nd(std::plus<double>(),aMinPtr[i]));
+ ret->copyStringInfoFrom(*aMax);
+ }
+ else
+ throw INTERP_KERNEL::Exception("Nb of components mismatch for array Add !");
+ }
return ret;
}
void DataArrayDouble::addEqual(const DataArrayDouble *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(begin(),end(),other->begin(),getPointer(),std::plus<double>());
+ const char *msg="Nb of tuples mismatch for DataArrayDouble::addEqual !";
+ int nbOfTuple=getNumberOfTuples();
+ int nbOfTuple2=other->getNumberOfTuples();
+ int nbOfComp=getNumberOfComponents();
+ int nbOfComp2=other->getNumberOfComponents();
+ if(nbOfTuple==nbOfTuple2)
+ {
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(begin(),end(),other->begin(),getPointer(),std::plus<double>());
+ }
+ else if(nbOfComp2==1)
+ {
+ double *ptr=getPointer();
+ const double *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::plus<double>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else if(nbOfTuple2==1)
+ {
+ if(nbOfComp2==nbOfComp)
+ {
+ double *ptr=getPointer();
+ const double *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::plus<double>());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
declareAsNew();
}
void DataArrayDouble::substractEqual(const DataArrayDouble *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(begin(),end(),other->begin(),getPointer(),std::minus<double>());
+ const char *msg="Nb of tuples mismatch for DataArrayDouble::substractEqual !";
+ int nbOfTuple=getNumberOfTuples();
+ int nbOfTuple2=other->getNumberOfTuples();
+ int nbOfComp=getNumberOfComponents();
+ int nbOfComp2=other->getNumberOfComponents();
+ if(nbOfTuple==nbOfTuple2)
+ {
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(begin(),end(),other->begin(),getPointer(),std::minus<double>());
+ }
+ else if(nbOfComp2==1)
+ {
+ double *ptr=getPointer();
+ const double *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::minus<double>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else if(nbOfTuple2==1)
+ {
+ if(nbOfComp2==nbOfComp)
+ {
+ double *ptr=getPointer();
+ const double *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::minus<double>());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
declareAsNew();
}
void DataArrayDouble::multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
{
+ const char *msg="Nb of tuples mismatch for DataArrayDouble::multiplyEqual !";
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)
+ if(nbOfTuple==nbOfTuple2)
{
- std::transform(begin(),end(),other->begin(),getPointer(),std::multiplies<double>());
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(begin(),end(),other->begin(),getPointer(),std::multiplies<double>());
+ }
+ else if(nbOfComp2==1)
+ {
+ double *ptr=getPointer();
+ const double *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::multiplies<double>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
}
- else
+ else if(nbOfTuple2==1)
{
- if(nbOfComp2==1)
+ if(nbOfComp2==nbOfComp)
{
- const double *ptr=other->getConstPointer();
- double *myPtr=getPointer();
+ double *ptr=getPointer();
+ const double *ptrc=other->getConstPointer();
for(int i=0;i<nbOfTuple;i++)
- myPtr=std::transform(myPtr,myPtr+nbOfComp,myPtr,std::bind2nd(std::multiplies<double>(),ptr[i]));
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::multiplies<double>());
}
else
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array multiplyEqual !");
+ throw INTERP_KERNEL::Exception(msg);
}
+ else
+ throw INTERP_KERNEL::Exception(msg);
declareAsNew();
}
void DataArrayDouble::divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception)
{
+ const char *msg="Nb of tuples mismatch for DataArrayDouble::divideEqual !";
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)
+ if(nbOfTuple==nbOfTuple2)
{
- std::transform(begin(),end(),other->begin(),getPointer(),std::divides<double>());
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(begin(),end(),other->begin(),getPointer(),std::divides<double>());
+ }
+ else if(nbOfComp2==1)
+ {
+ double *ptr=getPointer();
+ const double *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::divides<double>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
}
- else
+ else if(nbOfTuple2==1)
{
- if(nbOfComp2==1)
+ if(nbOfComp2==nbOfComp)
{
- const double *ptr=other->getConstPointer();
- double *myPtr=getPointer();
+ double *ptr=getPointer();
+ const double *ptrc=other->getConstPointer();
for(int i=0;i<nbOfTuple;i++)
- myPtr=std::transform(myPtr,myPtr+nbOfComp,myPtr,std::bind2nd(std::divides<double>(),ptr[i]));
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::divides<double>());
}
else
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array divideEqual !");
+ throw INTERP_KERNEL::Exception(msg);
}
+ else
+ throw INTERP_KERNEL::Exception(msg);
declareAsNew();
}
throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::doubleValue : DataArrayDoubleTuple instance has not exactly 1 component -> Not possible to convert it into a double precision float !");
}
+/*!
+ * This method returns a newly allocated instance the caller should dealed with by a ParaMEDMEM::DataArrayDouble::decrRef.
+ * This method performs \b no copy of data. The content is only referenced using ParaMEDMEM::DataArrayDouble::useArray with ownership set to \b false.
+ * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
+ * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
+ */
+DataArrayDouble *DataArrayDoubleTuple::buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception)
+{
+ if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
+ {
+ DataArrayDouble *ret=DataArrayDouble::New();
+ ret->useArray(_pt,false,CPP_DEALLOC,nbOfTuples,nbOfCompo);
+ return ret;
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayDoubleTuple::buildDADouble : unable to build a requested DataArrayDouble instance with nbofTuple=" << nbOfTuples << " and nbOfCompo=" << nbOfCompo;
+ oss << ".\nBecause the number of elements in this is " << _nb_of_compo << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
DataArrayInt *DataArrayInt::New()
{
return new DataArrayInt;
throw INTERP_KERNEL::Exception("DataArrayInt::intValue : DataArrayInt instance is not allocated !");
}
+/*!
+ * This method expects that \b this is well allocated. If not an INTERP_KERNEL::Exception will be thrown. This method is useful for a quick comparison of many instances of DataArrayInt.
+ */
+int DataArrayInt::getHashCode() const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ int nbOfElems=getNbOfElems();
+ int ret=nbOfElems*65536;
+ int delta=3;
+ if(nbOfElems>48)
+ delta=nbOfElems/8;
+ int ret0=0;
+ const int *pt=begin();
+ for(int i=0;i<nbOfElems;i+=delta)
+ ret0+=pt[i] & 0x1FFF;
+ return ret+ret0;
+}
+
/*!
* This method should be called on an allocated DataArrayInt instance. If not an exception will be throw !
* This method checks the number of tupes. If it is equal to 0, it returns true, if not false is returned.
alloc(nbOfTuple,nbOfCompo);
}
-void DataArrayInt::alloc(int nbOfTuple, int nbOfCompo)
+void DataArrayInt::alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
+ if(nbOfTuple<0 || nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::alloc : request for negative length of data !");
_nb_of_tuples=nbOfTuple;
_info_on_compo.resize(nbOfCompo);
_mem.alloc(nbOfCompo*_nb_of_tuples);
declareAsNew();
}
+/*!
+ * This method makes the assumption that \b this is allocated. If not an INTERP_KERNEL::Exception will be raised.
+ * This method does not echange the values stored in \b this. Simply, the number of components before the call becomes the number of
+ * tuples and inversely the number of tuples becomes the number of components. \b WARNING the info on components can be alterated by this method.
+ */
+void DataArrayInt::transpose() throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ int nbOfTuples=getNumberOfTuples();
+ rearrange(nbOfTuples);
+}
+
/*!
* This method builds a new instance of DataArrayInt (to deal with) that is reduction or an extension of 'this'.
* if 'newNbOfComp' < this->getNumberOfComponents() a reduction is done and for each tuple 'newNbOfComp' first components are kept.
}
}
+/*!
+ * This method is equivalent to DataArrayInt::getIJ except that here \b tupleId is checked to be in [0,this->getNumberOfTuples()) and compoId to be in [0,this->getNumberOfComponents()).
+ * If one of these check fails an INTERP_KERNEL::Exception will be thrown.
+ * So this method is safe but expensive if used to go through all data of \b this.
+ */
+int DataArrayInt::getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(tupleId<0 || tupleId>=getNumberOfTuples())
+ {
+ std::ostringstream oss; oss << "DataArrayInt::getIJSafe : request for tupleId " << tupleId << " should be in [0," << getNumberOfTuples() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(compoId<0 || compoId>=getNumberOfComponents())
+ {
+ std::ostringstream oss; oss << "DataArrayInt::getIJSafe : request for compoId " << compoId << " should be in [0," << getNumberOfComponents() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return _mem[tupleId*((int)_info_on_compo.size())+compoId];
+}
+
/*!
* This method returns the last element in 'this'. So this method makes the hypothesis that 'this' is allocated.
* This method works only for arrays that have exactly number of components equal to 1. If not an exception is thrown.
declareAsNew();
}
+/*!
+ * This method returns a newly allocated array containing the application of negate on \b this.
+ * This method throws an INTERP_KERNEL::Exception if \b this is not allocated.
+ */
+DataArrayInt *DataArrayInt::negate() const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ DataArrayInt *newArr=DataArrayInt::New();
+ int nbOfTuples=getNumberOfTuples();
+ int nbOfComp=getNumberOfComponents();
+ newArr->alloc(nbOfTuples,nbOfComp);
+ const int *cptr=getConstPointer();
+ std::transform(cptr,cptr+nbOfTuples*nbOfComp,newArr->getPointer(),std::negate<int>());
+ newArr->copyStringInfoFrom(*this);
+ return newArr;
+}
+
/*!
* 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.
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->begin(),a1->end(),a2->begin(),ret->getPointer(),std::plus<int>());
- ret->copyStringInfoFrom(*a1);
+ 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 Add !");
+ DataArrayInt *ret=0;
+ if(nbOfComp==nbOfComp2)
+ {
+ ret=DataArrayInt::New();
+ ret->alloc(nbOfTuple,nbOfComp);
+ std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::plus<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::plus<int>(),aMinPtr[i]));
+ ret->copyStringInfoFrom(*aMax);
+ }
+ else
+ throw INTERP_KERNEL::Exception("Nb of components mismatch for array Add !");
+ }
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(begin(),end(),other->begin(),getPointer(),std::plus<int>());
+ const char *msg="Nb of tuples mismatch for DataArrayInt::addEqual !";
+ int nbOfTuple=getNumberOfTuples();
+ int nbOfTuple2=other->getNumberOfTuples();
+ int nbOfComp=getNumberOfComponents();
+ int nbOfComp2=other->getNumberOfComponents();
+ if(nbOfTuple==nbOfTuple2)
+ {
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(begin(),end(),other->begin(),getPointer(),std::plus<int>());
+ }
+ else if(nbOfComp2==1)
+ {
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::plus<int>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else if(nbOfTuple2==1)
+ {
+ if(nbOfComp2==nbOfComp)
+ {
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::plus<int>());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
declareAsNew();
}
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(begin(),end(),other->begin(),getPointer(),std::minus<int>());
+ const char *msg="Nb of tuples mismatch for DataArrayInt::substractEqual !";
+ int nbOfTuple=getNumberOfTuples();
+ int nbOfTuple2=other->getNumberOfTuples();
+ int nbOfComp=getNumberOfComponents();
+ int nbOfComp2=other->getNumberOfComponents();
+ if(nbOfTuple==nbOfTuple2)
+ {
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(begin(),end(),other->begin(),getPointer(),std::minus<int>());
+ }
+ else if(nbOfComp2==1)
+ {
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::minus<int>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else if(nbOfTuple2==1)
+ {
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::minus<int>());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
declareAsNew();
}
void DataArrayInt::multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
{
+ const char *msg="Nb of tuples mismatch for DataArrayInt::multiplyEqual !";
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)
+ if(nbOfTuple==nbOfTuple2)
{
- std::transform(begin(),end(),other->begin(),getPointer(),std::multiplies<int>());
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(begin(),end(),other->begin(),getPointer(),std::multiplies<int>());
+ }
+ else if(nbOfComp2==1)
+ {
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::multiplies<int>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
}
- else
+ else if(nbOfTuple2==1)
{
- if(nbOfComp2==1)
+ if(nbOfComp2==nbOfComp)
{
- const int *ptr=other->getConstPointer();
- int *myPtr=getPointer();
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
for(int i=0;i<nbOfTuple;i++)
- myPtr=std::transform(myPtr,myPtr+nbOfComp,myPtr,std::bind2nd(std::multiplies<int>(),ptr[i]));
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::multiplies<int>());
}
else
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array multiplyEqual !");
+ throw INTERP_KERNEL::Exception(msg);
}
+ else
+ throw INTERP_KERNEL::Exception(msg);
declareAsNew();
}
void DataArrayInt::divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception)
{
+ const char *msg="Nb of tuples mismatch for DataArrayInt::divideEqual !";
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)
+ if(nbOfTuple==nbOfTuple2)
{
- std::transform(begin(),end(),other->begin(),getPointer(),std::divides<int>());
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(begin(),end(),other->begin(),getPointer(),std::divides<int>());
+ }
+ else if(nbOfComp2==1)
+ {
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::divides<int>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
}
- else
+ else if(nbOfTuple2==1)
{
- if(nbOfComp2==1)
+ if(nbOfComp2==nbOfComp)
{
- const int *ptr=other->getConstPointer();
- int *myPtr=getPointer();
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
for(int i=0;i<nbOfTuple;i++)
- myPtr=std::transform(myPtr,myPtr+nbOfComp,myPtr,std::bind2nd(std::divides<int>(),ptr[i]));
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::divides<int>());
}
else
- throw INTERP_KERNEL::Exception("Nb of components mismatch for array divideEqual !");
+ throw INTERP_KERNEL::Exception(msg);
}
+ else
+ throw INTERP_KERNEL::Exception(msg);
declareAsNew();
}
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(begin(),end(),other->begin(),getPointer(),std::modulus<int>());
+ const char *msg="Nb of tuples mismatch for DataArrayInt::modulusEqual !";
+ int nbOfTuple=getNumberOfTuples();
+ int nbOfTuple2=other->getNumberOfTuples();
+ int nbOfComp=getNumberOfComponents();
+ int nbOfComp2=other->getNumberOfComponents();
+ if(nbOfTuple==nbOfTuple2)
+ {
+ if(nbOfComp==nbOfComp2)
+ {
+ std::transform(begin(),end(),other->begin(),getPointer(),std::modulus<int>());
+ }
+ else if(nbOfComp2==1)
+ {
+ if(nbOfComp2==nbOfComp)
+ {
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptr+i*nbOfComp,std::bind2nd(std::modulus<int>(),*ptrc++));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else if(nbOfTuple2==1)
+ {
+ int *ptr=getPointer();
+ const int *ptrc=other->getConstPointer();
+ for(int i=0;i<nbOfTuple;i++)
+ std::transform(ptr+i*nbOfComp,ptr+(i+1)*nbOfComp,ptrc,ptr+i*nbOfComp,std::modulus<int>());
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
declareAsNew();
}
return ret;
}
+DataArrayInt *DataArrayInt::Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception)
+{
+ int nbOfTuples=GetNumberOfItemGivenBESRelative(begin,end,step,"DataArrayInt::Range");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ ret->alloc(nbOfTuples,1);
+ int *ptr=ret->getPointer();
+ if(step>0)
+ {
+ for(int i=begin;i<end;i+=step,ptr++)
+ *ptr=i;
+ }
+ else
+ {
+ for(int i=begin;i>end;i+=step,ptr++)
+ *ptr=i;
+ }
+ ret->incrRef();
+ return ret;
+}
+
/*!
* Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class.
* Server side.
return *_pt;
throw INTERP_KERNEL::Exception("DataArrayIntTuple::intValue : DataArrayIntTuple instance has not exactly 1 component -> Not possible to convert it into an integer !");
}
+
+/*!
+ * This method returns a newly allocated instance the caller should dealed with by a ParaMEDMEM::DataArrayInt::decrRef.
+ * This method performs \b no copy of data. The content is only referenced using ParaMEDMEM::DataArrayInt::useArray with ownership set to \b false.
+ * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
+ * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
+ */
+DataArrayInt *DataArrayIntTuple::buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception)
+{
+ if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
+ {
+ DataArrayInt *ret=DataArrayInt::New();
+ ret->useArray(_pt,false,CPP_DEALLOC,nbOfTuples,nbOfCompo);
+ return ret;
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayIntTuple::buildDAInt : unable to build a requested DataArrayInt instance with nbofTuple=" << nbOfTuples << " and nbOfCompo=" << nbOfCompo;
+ oss << ".\nBecause the number of elements in this is " << _nb_of_compo << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
T *toNoInterlace(int nbOfComp) const;
void sort();
void reverse();
- void alloc(int nbOfElements);
- void reAlloc(int newNbOfElements);
+ void alloc(int nbOfElements) throw(INTERP_KERNEL::Exception);
+ void reAlloc(int newNbOfElements) throw(INTERP_KERNEL::Exception);
void useArray(const T *array, bool ownership, DeallocType type, int nbOfElem);
void writeOnPlace(int id, T element0, const T *others, int sizeOfOthers);
~MemArray() { destroy(); }
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);
MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
protected:
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 alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
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 DataArrayDouble *selectByTupleRanges(const std::vector<std::pair<int,int> >& ranges) 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 void transpose() 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 getTuple(int tupleId, double *res) const { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; }
MEDCOUPLING_EXPORT double back() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, double newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
MEDCOUPLING_EXPORT double *getPointer() { return _mem.getPointer(); }
MEDCOUPLING_EXPORT void useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
MEDCOUPLING_EXPORT void writeOnPlace(int id, double element0, const double *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
MEDCOUPLING_EXPORT void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void getMinMaxPerComponent(double *bounds) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double getMinValue(int& tupleId) const 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 *negate() const 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);
const double *getConstPointer() const { return _pt; }
double *getPointer() { return _pt; }
double doubleValue() const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
private:
double *_pt;
int _nb_of_compo;
MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int intValue() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT int getHashCode() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool empty() 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 alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
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 isUniform(int val) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void transpose() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) 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 setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayInt *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; }
+ MEDCOUPLING_EXPORT int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int back() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, int newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
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 DataArrayInt *negate() const 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 void updateTime() const { }
public:
MEDCOUPLING_EXPORT static int *CheckAndPreparePermutation(const int *start, const int *end);
+ MEDCOUPLING_EXPORT static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
public:
MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
const int *getConstPointer() const { return _pt; }
int *getPointer() { return _pt; }
int intValue() const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
private:
int *_pt;
int _nb_of_compo;
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
}
template<class T>
- void MemArray<T>::alloc(int nbOfElements)
+ void MemArray<T>::alloc(int nbOfElements) throw(INTERP_KERNEL::Exception)
{
destroy();
+ if(nbOfElements<0)
+ throw INTERP_KERNEL::Exception("MemArray::alloc : request for negative length of data !");
_nb_of_elem=nbOfElements;
_pointer.setInternal(new T[_nb_of_elem]);
_ownership=true;
}
template<class T>
- void MemArray<T>::reAlloc(int newNbOfElements)
+ void MemArray<T>::reAlloc(int newNbOfElements) throw(INTERP_KERNEL::Exception)
{
+ if(newNbOfElements<0)
+ throw INTERP_KERNEL::Exception("MemArray::reAlloc : request for negative length of data !");
T *pointer=new T[newNbOfElements];
std::copy(_pointer.getConstPointer(),_pointer.getConstPointer()+std::min<int>(_nb_of_elem,newNbOfElements),pointer);
if(_ownership)
return ;
}
default:
- std::stringstream stream;
+ std::ostringstream stream;
stream << "Invalid deallocation requested for pointer " << pt;
throw INTERP_KERNEL::Exception(stream.str().c_str());
}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
#include "MEDCouplingMesh.hxx"
+#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingMemArray.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
/*!
* 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.
+ * that is the union of \b mesh1 and \b mesh2 if possible. The cells of \b mesh2 will appear after cells of \b mesh1. Idem for nodes.
+ * The only contraint is that \b mesh1 an \b mesh2 have the same mesh types. If it is not the case please use the other API of MEDCouplingMesh::MergeMeshes,
+ * with input vector of meshes.
*/
-MEDCouplingMesh *MEDCouplingMesh::MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2)
+MEDCouplingMesh *MEDCouplingMesh::MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception)
{
+ if(!mesh1)
+ throw INTERP_KERNEL::Exception("MEDCouplingMesh::MergeMeshes : first parameter is an empty mesh !");
+ if(!mesh2)
+ throw INTERP_KERNEL::Exception("MEDCouplingMesh::MergeMeshes : second parameter is an empty mesh !");
return mesh1->mergeMyselfWith(mesh2);
}
+/*!
+ * retruns a newly created mesh with counter=1
+ * that is the union of meshes if possible. The cells of \b meshes[1] will appear after cells of \b meshes[0]. Idem for nodes.
+ * This method performs a systematic conversion to unstructured meshes before performing aggregation contrary to the other ParaMEDMEM::MEDCouplingMesh::MergeMeshes with
+ * two parameters that work only on the same type of meshes. So here it is possible to mix different type of meshes.
+ */
+MEDCouplingMesh *MEDCouplingMesh::MergeMeshes(std::vector<const MEDCouplingMesh *>& meshes) throw(INTERP_KERNEL::Exception)
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > ms1(meshes.size());
+ std::vector< const MEDCouplingUMesh * > ms2(meshes.size());
+ for(std::size_t i=0;i<meshes.size();i++)
+ {
+ if(meshes[i])
+ {
+ MEDCouplingUMesh *cur=meshes[i]->buildUnstructured();
+ ms1[i]=cur; ms2[i]=cur;
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDCouplingMesh::MergeMeshes(std::vector<const MEDCouplingMesh *>& meshes) : mesh at pos #" << i << " of input vector of size " << meshes.size() << " is empty !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ return MEDCouplingUMesh::MergeUMeshes(ms2);
+}
+
void MEDCouplingMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const
{
int ret=getCellContainingPoint(pos,eps);
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
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 void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception) = 0;
virtual std::string simpleRepr() const = 0;
virtual std::string advancedRepr() const = 0;
// tools
virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception) = 0;
virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception) = 0;
virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
- static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
+ static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingMesh *MergeMeshes(std::vector<const MEDCouplingMesh *>& meshes) throw(INTERP_KERNEL::Exception);
//serialisation-unserialization
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;
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
return _coords->isEqualWithoutConsideringStr(*other._coords,prec);
}
+/*!
+ * Returns coordinates of node with id 'nodeId' and append it in 'coo'.
+ */
+void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception)
+{
+ if(!_coords)
+ throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCoordinatesOfNode : no coordinates array set !");
+ int nbNodes=getNumberOfNodes();
+ if(nodeId>=0 && nodeId<nbNodes)
+ {
+ const double *cooPtr=_coords->getConstPointer();
+ int spaceDim=getSpaceDimension();
+ coo.insert(coo.end(),cooPtr+spaceDim*nodeId,cooPtr+spaceDim*(nodeId+1));
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDCouplingPointSet::getCoordinatesOfNode : request of nodeId \"" << nodeId << "\" but it should be in [0,"<< nbNodes << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
/*!
* This method is typically the base method used for implementation of mergeNodes. This method computes this permutation array using as input,
* This method is const ! So this method simply computes the array, no permutation of nodes is done.
* The returned bounding box is arranged along trihedron.
* @param bbox out array of size 2*this->getSpaceDimension().
*/
-void MEDCouplingPointSet::getBoundingBox(double *bbox) const
+void MEDCouplingPointSet::getBoundingBox(double *bbox) const throw(INTERP_KERNEL::Exception)
{
- int dim=getSpaceDimension();
- for (int idim=0; idim<dim; idim++)
- {
- bbox[idim*2]=std::numeric_limits<double>::max();
- bbox[idim*2+1]=-std::numeric_limits<double>::max();
- }
- const double *coords=_coords->getConstPointer();
- int nbnodes=getNumberOfNodes();
- for (int i=0; i<nbnodes; i++)
- {
- for (int idim=0; idim<dim;idim++)
- {
- if ( bbox[idim*2] > coords[i*dim+idim] )
- {
- bbox[idim*2] = coords[i*dim+idim] ;
- }
- if ( bbox[idim*2+1] < coords[i*dim+idim] )
- {
- bbox[idim*2+1] = coords[i*dim+idim] ;
- }
- }
- }
+ if(!_coords)
+ throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getBoundingBox : Coordinates not set !");
+ _coords->getMinMaxPerComponent(bbox);
}
/*!
/*!
* low level method that checks that the 2D cell is not a butterfly cell.
*/
-bool MEDCouplingPointSet::isButterfly2DCell(const std::vector<double>& res, bool isQuad)
+bool MEDCouplingPointSet::isButterfly2DCell(const std::vector<double>& res, bool isQuad, double eps)
{
std::size_t nbOfNodes=res.size()/2;
std::vector<INTERP_KERNEL::Node *> nodes(nbOfNodes);
INTERP_KERNEL::Node *tmp=new INTERP_KERNEL::Node(res[2*i],res[2*i+1]);
nodes[i]=tmp;
}
+ INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
+ INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
INTERP_KERNEL::QuadraticPolygon *pol=0;
if(isQuad)
pol=INTERP_KERNEL::QuadraticPolygon::BuildArcCirclePolygon(nodes);
else
pol=INTERP_KERNEL::QuadraticPolygon::BuildLinearPolygon(nodes);
- bool ret=pol->isButterfly();
+ bool ret=pol->isButterflyAbs();
delete pol;
return ret;
}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
bool areCoordsEqualWithoutConsideringStr(const MEDCouplingPointSet& other, double prec) const;
virtual DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes) = 0;
virtual DataArrayInt *mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes) = 0;
+ void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception);
DataArrayInt *buildPermArrayForMergeNode(double precision, int limitNodeId, bool& areNodesMerged, int& newNbOfNodes) const;
std::vector<int> getNodeIdsNearPoint(const double *pos, double eps) const throw(INTERP_KERNEL::Exception);
void getNodeIdsNearPoints(const double *pos, int nbOfNodes, double eps, std::vector<int>& c, std::vector<int>& cI) const throw(INTERP_KERNEL::Exception);
void findCommonNodes(double prec, int limitNodeId, DataArrayInt *&comm, DataArrayInt *&commIndex) const;
DataArrayInt *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex,
int& newNbOfNodes) const;
- void getBoundingBox(double *bbox) const;
+ void getBoundingBox(double *bbox) const throw(INTERP_KERNEL::Exception);
void zipCoords();
double getCaracteristicDimension() const;
void rotate(const double *center, const double *vector, double angle);
void rotate2D(const double *center, double angle);
void rotate3D(const double *center, const double *vect, double angle);
void project2DCellOnXY(const int *startConn, const int *endConn, std::vector<double>& res) const;
- static bool isButterfly2DCell(const std::vector<double>& res, bool isQuad);
+ static bool isButterfly2DCell(const std::vector<double>& res, bool isQuad, double eps);
template<int SPACEDIM>
void findNodeIdsNearPointAlg(std::vector<double>& bbox, const double *pos, int nbNodes, double eps,
std::vector<int>& c, std::vector<int>& cI) const;
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
return prepare(src->getMesh(),target->getMesh(),meth.c_str());
}
+/*!
+ * This method performs the operation source to target using matrix computed in ParaMEDMEM::MEDCouplingRemapper::prepare method.
+ * If meshes of \b srcField and \b targetField do not match exactly those given into \ref ParaMEDMEM::MEDCouplingRemapper::prepare "prepare method" an exception will be thrown.
+ *
+ * \param [in] srcField is the source field from which the interpolation will be done. The mesh into \b srcField should be the same than those specified on ParaMEDMEM::MEDCouplingRemapper::prepare.
+ * \param [out] targetField the destination field with the allocated array in which all tuples will be overwritten.
+ */
void MEDCouplingRemapper::transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception)
{
- if(_src_method!=srcField->getDiscretization()->getStringRepr())
- throw INTERP_KERNEL::Exception("Incoherency with prepare call for source field");
- if(_target_method!=targetField->getDiscretization()->getStringRepr())
- throw INTERP_KERNEL::Exception("Incoherency with prepare call for target field");
- if(srcField->getNature()!=targetField->getNature())
- throw INTERP_KERNEL::Exception("Natures of fields mismatch !");
- DataArrayDouble *array=targetField->getArray();
- int srcNbOfCompo=srcField->getNumberOfComponents();
- if(array)
- {
- if(srcNbOfCompo!=targetField->getNumberOfComponents())
- throw INTERP_KERNEL::Exception("Number of components mismatch !");
- }
- else
- {
- array=DataArrayDouble::New();
- array->alloc(targetField->getNumberOfTuples(),srcNbOfCompo);
- targetField->setArray(array);
- array->decrRef();
- }
- computeDeno(srcField->getNature(),srcField,targetField);
- double *resPointer=array->getPointer();
- const double *inputPointer=srcField->getArray()->getConstPointer();
- computeProduct(inputPointer,srcNbOfCompo,dftValue,resPointer);
+ transferUnderground(srcField,targetField,true,dftValue);
+}
+
+/*!
+ * This method is equivalent to ParaMEDMEM::MEDCouplingRemapper::transfer except that here \b targetField is a in/out parameter.
+ * If an entity (cell for example) in targetField is not fetched by any entity (cell for example) of \b srcField, the value in targetField is
+ * let unchanged.
+ * This method requires that \b targetField was fully defined and allocated. If the array is not allocated an exception will be thrown.
+ *
+ * \param [in] srcField is the source field from which the interpolation will be done. The mesh into \b srcField should be the same than those specified on ParaMEDMEM::MEDCouplingRemapper::prepare.
+ * \param [in,out] targetField the destination field with the allocated array in which only tuples whose entities are fetched by interpolation will be overwritten only.
+ */
+void MEDCouplingRemapper::partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField) throw(INTERP_KERNEL::Exception)
+{
+ transferUnderground(srcField,targetField,false,std::numeric_limits<double>::max());
}
void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception)
}
}
+void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, bool isDftVal, double dftValue) throw(INTERP_KERNEL::Exception)
+{
+ if(_src_method!=srcField->getDiscretization()->getStringRepr())
+ throw INTERP_KERNEL::Exception("Incoherency with prepare call for source field");
+ if(_target_method!=targetField->getDiscretization()->getStringRepr())
+ throw INTERP_KERNEL::Exception("Incoherency with prepare call for target field");
+ if(srcField->getNature()!=targetField->getNature())
+ throw INTERP_KERNEL::Exception("Natures of fields mismatch !");
+ DataArrayDouble *array=targetField->getArray();
+ int srcNbOfCompo=srcField->getNumberOfComponents();
+ if(array)
+ {
+ if(srcNbOfCompo!=targetField->getNumberOfComponents())
+ throw INTERP_KERNEL::Exception("Number of components mismatch !");
+ }
+ else
+ {
+ if(!isDftVal)
+ throw INTERP_KERNEL::Exception("MEDCouplingRemapper::partialTransfer : This method requires that the array of target field exists ! Allocate it or call MEDCouplingRemapper::transfer instead !");
+ array=DataArrayDouble::New();
+ array->alloc(targetField->getNumberOfTuples(),srcNbOfCompo);
+ targetField->setArray(array);
+ array->decrRef();
+ }
+ computeDeno(srcField->getNature(),srcField,targetField);
+ double *resPointer=array->getPointer();
+ const double *inputPointer=srcField->getArray()->getConstPointer();
+ computeProduct(inputPointer,srcNbOfCompo,isDftVal,dftValue,resPointer);
+}
+
void MEDCouplingRemapper::computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField)
{
if(nat==NoNature)
}
}
-void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer)
+void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNbOfCompo, bool isDftVal, double dftValue, double *resPointer)
{
int idx=0;
double *tmp=new double[inputNbOfCompo];
{
if((*iter1).empty())
{
- std::fill(resPointer+idx*inputNbOfCompo,resPointer+(idx+1)*inputNbOfCompo,dftValue);
+ if(isDftVal)
+ std::fill(resPointer+idx*inputNbOfCompo,resPointer+(idx+1)*inputNbOfCompo,dftValue);
continue;
}
else
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
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 partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField) 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);
MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
int prepareEE(const char *method) throw(INTERP_KERNEL::Exception);
void updateTime() const;
void releaseData(bool matrixSuppression);
+ void transferUnderground(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, bool isDftVal, double dftValue) throw(INTERP_KERNEL::Exception);
void computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField);
void computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) throw(INTERP_KERNEL::Exception);
- void computeProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer);
+ void computeProduct(const double *inputPointer, int inputNbOfCompo, bool isDftVal, double dftValue, double *resPointer);
void computeReverseProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer);
void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map<int,double> >& m1D,
const std::vector< std::map<int,double> >& m2D,
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
return buildDescendingConnectivityGen(desc,descIndx,revDesc,revDescIndx,MEDCouplingOrientationSensitiveNbrer);
}
+/*!
+ * \b WARNING this method do the assumption that connectivity lies on the coordinates set.
+ * For speed reasons no check of this will be done. This method calls MEDCouplingUMesh::buildDescendingConnectivity to compute the result.
+ * This method lists cell by cell in \b this which are its neighbors. To compute the result only connectivities are considered.
+ * The a cell with id 'cellId' its neighbors are neighbors[neighborsIdx[cellId]:neighborsIdx[cellId+1]].
+ *
+ * \param [out] neighbors is an array storing all the neighbors of all cells in \b this. This array is newly allocated and should be dealt by the caller. \b neighborsIdx 2nd output
+ * parameter allows to select the right part in this array. The number of tuples is equal to the last values in \b neighborsIdx.
+ * \param [out] neighborsIdx is an array of size this->getNumberOfCells()+1 newly allocated and should be dealt by the caller. This arrays allow to use the first output parameter \b neighbors.
+ */
+void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> descIndx=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDesc=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
+ meshDM1=0;
+ const int *descPtr=desc->getConstPointer();
+ const int *descIPtr=descIndx->getConstPointer();
+ const int *revDescPtr=revDesc->getConstPointer();
+ const int *revDescIPtr=revDescIndx->getConstPointer();
+ //
+ int nbCells=getNumberOfCells();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> out0=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> out1=DataArrayInt::New(); out1->alloc(nbCells+1,1);
+ int *out1Ptr=out1->getPointer();
+ *out1Ptr++=0;
+ std::vector<int> out0v;
+ out0v.reserve(desc->getNumberOfTuples());
+ for(int i=0;i<nbCells;i++,descIPtr++,out1Ptr++)
+ {
+ for(const int *w1=descPtr+descIPtr[0];w1!=descPtr+descIPtr[1];w1++)
+ {
+ std::set<int> s(revDescPtr+revDescIPtr[*w1],revDescPtr+revDescIPtr[(*w1)+1]);
+ s.erase(i);
+ out0v.insert(out0v.end(),s.begin(),s.end());
+ }
+ *out1Ptr=out0v.size();
+ }
+ out0->alloc((int)out0v.size(),1);
+ std::copy(out0v.begin(),out0v.end(),out0->getPointer());
+ neighbors=out0; out0->incrRef();
+ neighborsIdx=out1; out1->incrRef();
+}
+
/// @cond INTERNAL
/*!
{
const int *conn=getNodalConnectivity()->getConstPointer();
const int *connI=getNodalConnectivityIndex()->getConstPointer();
- return std::equal(conn+connI[cell1],conn+connI[cell1+1],conn+connI[cell2]);
+ if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2])
+ return std::equal(conn+connI[cell1]+1,conn+connI[cell1+1],conn+connI[cell2]+1);
+ return false;
}
/*!
*/
bool MEDCouplingUMesh::areCellsEqual1(int cell1, int cell2) const
{
- throw INTERP_KERNEL::Exception("Policy comparison, not implemented yet !");
+ const int *conn=getNodalConnectivity()->getConstPointer();
+ const int *connI=getNodalConnectivityIndex()->getConstPointer();
+ int sz=connI[cell1+1]-connI[cell1];
+ if(sz==connI[cell2+1]-connI[cell2])
+ {
+ if(conn[connI[cell1]]==conn[connI[cell2]])
+ {
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[cell1]]);
+ unsigned dim=cm.getDimension();
+ if(dim!=3)
+ {
+ if(dim!=1)
+ {
+ int sz1=2*(sz-1);
+ int *tmp=new int[sz1];
+ int *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],tmp);
+ std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],work);
+ work=std::search(tmp,tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]);
+ delete [] tmp;
+ return work!=tmp+sz1;
+ }
+ else
+ return std::equal(conn+connI[cell1]+1,conn+connI[cell1+1],conn+connI[cell2]+1);//case of SEG2 and SEG3
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::areCellsEqual1 : not implemented yet for meshdim == 3 !");
+ }
+ }
+ return false;
}
/*!
{
const int *conn=getNodalConnectivity()->getConstPointer();
const int *connI=getNodalConnectivityIndex()->getConstPointer();
- std::set<int> s1(conn+connI[cell1],conn+connI[cell1+1]);
- std::set<int> s2(conn+connI[cell2],conn+connI[cell2+1]);
- return s1==s2;
+ if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2])
+ {
+ if(conn[connI[cell1]]==conn[connI[cell2]])
+ {
+ std::set<int> s1(conn+connI[cell1]+1,conn+connI[cell1+1]);
+ std::set<int> s2(conn+connI[cell2]+1,conn+connI[cell2+1]);
+ return s1==s2;
+ }
+ }
+ return false;
}
/*!
* This method keeps the coordiantes of 'this'.
*
* @param compType input specifying the technique used to compare cells each other.
- * 0 : exactly. A cell is detected to be the same if and only if the connectivity is exactly the same without permutation and types same too. This is the strongest policy.
- * 1 : permutation. cell1 and cell2 are equal if and the connectivity of cell2 can be deduced by those of cell1 by direct permutation and their type equal.
- * 2 : nodal. cell1 and cell2 are equal if and only if cell1 and cell2 have same type and have the same nodes constituting connectivity. This is the laziest policy.
+ * - 0 : exactly. A cell is detected to be the same if and only if the connectivity is exactly the same without permutation and types same too. This is the strongest policy.
+ * - 1 : permutation same orientation. cell1 and cell2 are considered equal if the connectivity of cell2 can be deduced by those of cell1 by direct permutation (with exactly the same orientation)
+ * and their type equal. For 1D mesh the policy 1 is equivalent to 0.
+ * - 2 : nodal. cell1 and cell2 are equal if and only if cell1 and cell2 have same type and have the same nodes constituting connectivity. This is the laziest policy. This policy
+ * can be used for users not sensitive to orientation of cell
* @return the correspondance array old to new.
*/
DataArrayInt *MEDCouplingUMesh::zipConnectivityTraducer(int compType) throw(INTERP_KERNEL::Exception)
}
/*!
- * This method renumbers nodes in connectivity only without any reference with coords.
- * Use it with care !
- * @param 'newNodeNumbers' in old2New convention
+ * This method renumbers nodes \b in \b connectivity \b only \b without \b any \b reference \b to \b coords.
+ * This method performs no check on the fact that new coordinate ids are valid. \b Use \b it \b with \b care !
+ * This method is an generalization of \ref ParaMEDMEM::MEDCouplingUMesh::shiftNodeNumbersInConn "shiftNodeNumbersInConn method".
+ * @param [in] newNodeNumbers in old2New convention
*/
-void MEDCouplingUMesh::renumberNodesInConn(const int *newNodeNumbers)
+void MEDCouplingUMesh::renumberNodesInConn(const int *newNodeNumbersO2N)
{
+ checkConnectivityFullyDefined();
+ int *conn=getNodalConnectivity()->getPointer();
+ const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
+ int nbOfCells=getNumberOfCells();
+ for(int i=0;i<nbOfCells;i++)
+ for(int iconn=connIndex[i]+1;iconn!=connIndex[i+1];iconn++)
+ {
+ int& node=conn[iconn];
+ if(node>=0)//avoid polyhedron separator
+ {
+ node=newNodeNumbersO2N[node];
+ }
+ }
+ _nodal_connec->declareAsNew();
+ updateTime();
+}
+
+/*!
+ * This method renumbers nodes \b in \b connectivity \b only \b without \b any \b reference \b to \b coords.
+ * This method performs no check on the fact that new coordinate ids are valid. \b Use \b it \b with \b care !
+ * This method is an specialization of \ref ParaMEDMEM::MEDCouplingUMesh::renumberNodesInConn "renumberNodesInConn method".
+ *
+ * @param [in] delta specifies the shift size applied to nodeId in nodal connectivity in \b this.
+ */
+void MEDCouplingUMesh::shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception)
+{
+ checkConnectivityFullyDefined();
int *conn=getNodalConnectivity()->getPointer();
const int *connIndex=getNodalConnectivityIndex()->getConstPointer();
int nbOfCells=getNumberOfCells();
int& node=conn[iconn];
if(node>=0)//avoid polyhedron separator
{
- node=newNodeNumbers[node];
+ node+=delta;
}
}
_nodal_connec->declareAsNew();
conn.push_back(*w);
}
-/*!
- * Returns coordinates of node with id 'nodeId' and append it in 'coo'.
- */
-void MEDCouplingUMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
-{
- const double *cooPtr=_coords->getConstPointer();
- int spaceDim=getSpaceDimension();
- coo.insert(coo.end(),cooPtr+spaceDim*nodeId,cooPtr+spaceDim*(nodeId+1));
-}
-
std::string MEDCouplingUMesh::simpleRepr() const
{
static const char msg0[]="No coordinates specified !";
* A 2D cell is considered to be butterfly if it exists at least one pair of distinct edges of it that intersect each other
* anywhere excepted their extremities. An INTERP_KERNEL::NORM_NORI3 could \b not be butterfly.
*/
-void MEDCouplingUMesh::checkButterflyCells(std::vector<int>& cells) const
+void MEDCouplingUMesh::checkButterflyCells(std::vector<int>& cells, double eps) const
{
const char msg[]="Butterfly detection work only for 2D cells with spaceDim==2 or 3!";
if(getMeshDimension()!=2)
continue;
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))
+ if(isButterfly2DCell(cell2DinS2,isQuad,eps))
cells.push_back(i);
cell2DinS2.clear();
}
/*!
* This method returns in case of success a mesh constitued from union of all meshes in 'a'.
- * There should be \b no presence of null pointer into 'a'.
+ * There should be \b no presence of null pointer into 'a'. If any an INTERP_KERNEL::Exception will be thrown.
* The returned mesh will contain aggregation of nodes in 'a' (in the same order) and aggregation of
* cells in meshes in 'a' (in the same order too).
*/
std::size_t sz=a.size();
if(sz==0)
return MergeUMeshesLL(a);
+ for(std::size_t ii=0;ii<sz;ii++)
+ if(!a[ii])
+ {
+ std::ostringstream oss; oss << "MEDCouplingUMesh::MergeUMeshes : item #" << ii << " in input array of size "<< sz << " is empty !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > bb(sz);
std::vector< const MEDCouplingUMesh * > aa(sz);
int spaceDim=-3;
for(std::size_t i=0;i<sz && spaceDim==-3;i++)
{
const MEDCouplingUMesh *cur=a[i];
- if(!cur)
- {
- std::ostringstream oss; oss << "MEDCouplingUMesh::MergeUMeshes : item #" << i << " in input array is empty !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
- }
const DataArrayDouble *coo=cur->getCoords();
if(coo)
spaceDim=coo->getNumberOfComponents();
{
if(meshes.empty())
throw INTERP_KERNEL::Exception("meshes input parameter is expected to be non empty.");
+ for(std::size_t ii=0;ii<meshes.size();ii++)
+ if(!meshes[ii])
+ {
+ std::ostringstream oss; oss << "MEDCouplingUMesh::MergeUMeshesOnSameCoords : item #" << ii << " in input array of size "<< meshes.size() << " is empty !";;
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
const DataArrayDouble *coords=meshes.front()->getCoords();
int meshDim=meshes.front()->getMeshDimension();
std::vector<const MEDCouplingUMesh *>::const_iterator iter=meshes.begin();
return ret;
}
+/*!
+ * This method takes in input meshes \b meshes containing no null reference. If any an INTERP_KERNEL::Exception will be thrown.
+ * \b meshes should have a good coherency (connectivity and coordinates well defined).
+ * All mesh in \b meshes must have the same space dimension. If not an INTERP_KERNEL:Exception will be thrown.
+ * But mesh in \b meshes \b can \b have \b different \b mesh \b dimension \b each \b other.
+ *
+ * This method performs nothing if size of \b meshes is in [0,1].
+ * This method is particulary usefull in MEDLoader context to build a \ref ParaMEDMEM::MEDFileUMesh "MEDFileUMesh" instance that expects that underlying
+ * coordinates DataArrayDouble instance.
+ *
+ * \param [in,out] meshes : vector containing no null instance of MEDCouplingUMesh that in case of success of this method will be modified.
+ */
+void MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(const std::vector<MEDCouplingUMesh *>& meshes) throw(INTERP_KERNEL::Exception)
+{
+ std::size_t sz=meshes.size();
+ if(sz==0 || sz==1)
+ return;
+ std::vector< const DataArrayDouble * > coords(meshes.size());
+ std::vector< const DataArrayDouble * >::iterator it2=coords.begin();
+ for(std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();it!=meshes.end();it++,it2++)
+ {
+ if((*it))
+ {
+ (*it)->checkConnectivityFullyDefined();
+ const DataArrayDouble *coo=(*it)->getCoords();
+ if(coo)
+ *it2=coo;
+ else
+ {
+ std::ostringstream oss; oss << " MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords : Item #" << std::distance(meshes.begin(),it) << " inside the vector of length " << meshes.size();
+ oss << " has no coordinate array defined !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ else
+ {
+ std::ostringstream oss; oss << " MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords : Item #" << std::distance(meshes.begin(),it) << " inside the vector of length " << meshes.size();
+ oss << " is null !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> res=DataArrayDouble::Aggregate(coords);
+ std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();
+ int offset=(*it)->getNumberOfNodes();
+ (*it++)->setCoords(res);
+ for(;it!=meshes.end();it++)
+ {
+ int oldNumberOfNodes=(*it)->getNumberOfNodes();
+ (*it)->setCoords(res);
+ (*it)->shiftNodeNumbersInConn(offset);
+ offset+=oldNumberOfNodes;
+ }
+}
+
+/*!
+ * This method takes in input meshes \b meshes containing no null reference. If any an INTERP_KERNEL::Exception will be thrown.
+ * \b meshes should have a good coherency (connectivity and coordinates well defined).
+ * All mesh in \b meshes must have the same space dimension. If not an INTERP_KERNEL:Exception will be thrown.
+ * But mesh in \b meshes \b can \b have \b different \b mesh \b dimension \b each \b other.
+ * If \b meshes share the same instance of DataArrayDouble as coordinates and that this instance is null, this method do nothing and no exception will be thrown.
+ *
+ * This method performs nothing if size of \b meshes is empty.
+ * This method is particulary usefull in MEDLoader context to perform a treatment of a MEDFileUMesh instance on different levels.
+ * coordinates DataArrayDouble instance.
+ *
+ * \param [in,out] meshes :vector containing no null instance of MEDCouplingUMesh sharing the same DataArrayDouble instance of coordinates, that in case of success of this method will be modified.
+ * \param [in] eps is the distance in absolute (that should be positive !), so that 2 or more points within a distance of eps will be merged into a single point.
+ */
+void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vector<MEDCouplingUMesh *>& meshes, double eps) throw(INTERP_KERNEL::Exception)
+{
+ if(meshes.empty())
+ return ;
+ std::set<const DataArrayDouble *> s;
+ for(std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();it!=meshes.end();it++)
+ {
+ if(*it)
+ s.insert((*it)->getCoords());
+ else
+ {
+ std::ostringstream oss; oss << "MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords : In input vector of unstructured meshes of size " << meshes.size() << " the element #" << std::distance(meshes.begin(),it) << " is null !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ if(s.size()!=1)
+ {
+ std::ostringstream oss; oss << "MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords : In input vector of unstructured meshes of size " << meshes.size() << ", it appears that they do not share the same instance of DataArrayDouble for coordiantes ! tryToShareSameCoordsPermute method can help to reach that !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ const DataArrayDouble *coo=*(s.begin());
+ if(!coo)
+ return;
+ //
+ DataArrayInt *comm,*commI;
+ coo->findCommonTuples(eps,-1,comm,commI);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1(comm),tmp2(commI);
+ int oldNbOfNodes=coo->getNumberOfTuples();
+ int newNbOfNodes;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(oldNbOfNodes,comm,commI,newNbOfNodes);
+ if(oldNbOfNodes==newNbOfNodes)
+ return ;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords=coo->renumberAndReduce(o2n->getConstPointer(),newNbOfNodes);
+ for(std::vector<MEDCouplingUMesh *>::const_iterator it=meshes.begin();it!=meshes.end();it++)
+ {
+ (*it)->renumberNodesInConn(o2n->getConstPointer());
+ (*it)->setCoords(newCoords);
+ }
+}
+
/*!
* This method takes in input a cell defined by its MEDcouplingUMesh connectivity [connBg,connEnd) and returns its extruded cell by inserting the result at the end of ret.
* @param nbOfNodesPerLev in parameter that specifies the number of nodes of one slice of global dataset
void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception)
{
+ if(getNumberOfCells()<=0)
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::writeVTK : the unstructured mesh has no cells !");
static const int PARAMEDMEM2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]={1,3,21,5,9,7,22,-1,23,-1,-1,-1,-1,-1,10,14,13,-1,12,-1,24,-1,16,27,-1,26,-1,-1,-1,-1,25,42,-1,4};
ofs << " <" << getVTKDataSetType() << ">\n";
ofs << " <Piece NumberOfPoints=\"" << getNumberOfNodes() << "\" NumberOfCells=\"" << getNumberOfCells() << "\">\n";
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
MEDCOUPLING_EXPORT DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const;
- MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT std::string reprConnectivityOfThis() const;
MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const throw(INTERP_KERNEL::Exception);
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);
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 renumberNodesInConn(const int *newNodeNumbersO2N);
+ MEDCOUPLING_EXPORT void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void getCellsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems) const;
MEDCOUPLING_EXPORT void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector<int>& elems);
MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, std::vector<int>& elts, std::vector<int>& eltsIndex) const;
- MEDCOUPLING_EXPORT void checkButterflyCells(std::vector<int>& cells) const;
+ MEDCOUPLING_EXPORT void checkButterflyCells(std::vector<int>& cells, double eps=1e-12) const;
MEDCOUPLING_EXPORT void findAndCorrectBadOriented3DExtrudedCells(std::vector<int>& cells) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void getBoundingBoxForBBTree(std::vector<double>& bbox) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes);
MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes, int compType, std::vector<DataArrayInt *>& corr);
+ MEDCOUPLING_EXPORT static void PutUMeshesOnSameAggregatedCoords(const std::vector<MEDCouplingUMesh *>& meshes) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT static void MergeNodesOnUMeshesSharingSameCoords(const std::vector<MEDCouplingUMesh *>& meshes, double eps) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static bool IsPolygonWellOriented(bool isQuadratic, const double *vec, const int *begin, const int *end, const double *coords);
MEDCOUPLING_EXPORT static bool IsPolyhedronWellOriented(const int *begin, const int *end, const double *coords);
MEDCOUPLING_EXPORT static void TryToCorrectPolyhedronOrientation(int *begin, int *end, const double *coords) throw(INTERP_KERNEL::Exception);
DataArrayInt *simplexizePol0() throw(INTERP_KERNEL::Exception);
DataArrayInt *simplexizePol1() throw(INTERP_KERNEL::Exception);
void subDivide2DMesh(const int *nodeSubdived, const int *nodeIndxSubdived, const int *desc, const int *descIndex) throw(INTERP_KERNEL::Exception);
- void renumberNodesInConn(const int *newNodeNumbers);
void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, std::vector<int>& cellIdsKept) const;
void split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector<int>& cut3DCurve) throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *buildExtrudedMeshFromThisLowLev(int nbOfNodesOf1Lev, bool isQuad) const;
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
return ret;
}
-/*!
- * not implemented
- */
MEDCouplingMesh *MEDCouplingUMeshDesc::deepCpy() const
{
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
void MEDCouplingUMeshDesc::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
{
- //not implemented yet.
-}
-
-void MEDCouplingUMeshDesc::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
-{
- //not implemented yet.
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
}
std::string MEDCouplingUMeshDesc::simpleRepr() const
DataArrayInt *MEDCouplingUMeshDesc::mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes)
{
- //not implemented yet.
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
areNodesMerged=false;
return 0;
}
DataArrayInt *MEDCouplingUMeshDesc::mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes)
{
- //not implemented yet.
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
areNodesMerged=false;
return 0;
}
MEDCouplingPointSet *MEDCouplingUMeshDesc::buildPartOfMySelf(const int *start, const int *end, bool keepCoords) const
{
- //not implemented yet.
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
MEDCouplingPointSet *MEDCouplingUMeshDesc::buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const
{
- //not implemented yet
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
MEDCouplingPointSet *MEDCouplingUMeshDesc::buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const
{
- //not implemented yet
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
void MEDCouplingUMeshDesc::findBoundaryNodes(std::vector<int>& nodes) const
{
- //not implemented yet
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
}
MEDCouplingPointSet *MEDCouplingUMeshDesc::buildBoundaryMesh(bool keepCoords) const
{
- //not implemented yet
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
void MEDCouplingUMeshDesc::renumberNodes(const int *newNodeNumbers, int newNbOfNodes)
{
MEDCouplingPointSet::renumberNodes(newNodeNumbers,newNbOfNodes);
- //not implemented yet
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
}
MEDCouplingFieldDouble *MEDCouplingUMeshDesc::getMeasureField(bool isAbs) const
{
- //not implemented yet.
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
MEDCouplingFieldDouble *MEDCouplingUMeshDesc::getMeasureFieldOnNode(bool isAbs) const
{
- //not implemented yet.
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
{
if(getMeshDimension()!=2)
throw INTERP_KERNEL::Exception("Expected a cmesh with meshDim == 2 !");
- //not implemented yet !
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
DataArrayInt *MEDCouplingUMeshDesc::zipCoordsTraducer()
{
- //not implemented yet.
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
MEDCouplingMesh *MEDCouplingUMeshDesc::mergeMyselfWith(const MEDCouplingMesh *other) const
{
- //not implemented yet.
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
DataArrayDouble *MEDCouplingUMeshDesc::getBarycenterAndOwner() const
{
- //not implemented yet.
+ throw INTERP_KERNEL::Exception("Not implemented yet !");
return 0;
}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
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 std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED_DESC; }
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
MEDCouplingUMesh *m3_2=(MEDCouplingUMesh *)m3->buildPartOfMySelf(vec2,vec2+2,false);
//
std::vector<const MEDCouplingUMesh *> ms(3);
+ std::vector<const MEDCouplingMesh *> ms2(3);
ms[0]=m1; ms[1]=m2_2; ms[2]=m3_2;
+ ms2[0]=m1; ms2[1]=m2_2; ms2[2]=m3_2;
//
MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshes(ms);
m4->checkCoherency();
CPPUNIT_ASSERT_EQUAL(20,m4->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(45,m4->getMeshLength());
//
+ MEDCouplingMesh *m4bis=MEDCouplingMesh::MergeMeshes(ms2);
+ CPPUNIT_ASSERT(m4->isEqual(m4bis,1e-12));
+ m4bis->decrRef();
+ //
const int vec3[5]={0,1,2,3,4};
MEDCouplingUMesh *m4_1=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec3,vec3+5,false);
m4_1->setName(m1->getName());
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
d2->decrRef();
d1->decrRef();
}
+
+void MEDCouplingBasicsTest5::testGetValueOn3()
+{
+ const double v[4]={0.,1.,1.5,2.};
+ const double v2[5]={0.7,1.25,0.,2.,1.5};
+ const double disp[12]={5.,50.,500.,6.,60.,600.,7.,70.,700.,8.,80.,800.};
+ MEDCouplingUMesh *m=MEDCouplingUMesh::New("myMesh",1);
+ const int nbNodes=4;
+ const int nbCells=nbNodes-1;
+ m->allocateCells(nbCells);
+ DataArrayDouble *coords=DataArrayDouble::New();
+ coords->alloc(nbNodes,1);
+ std::copy(v,v+nbNodes,coords->getPointer());
+ m->setCoords(coords);
+ coords->decrRef();
+ const int conn[6]={0,1,2,1,2,3};
+ m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn);
+ m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2);
+ m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+4);
+ m->finishInsertingCells();
+ MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES);
+ f->setMesh(m);
+ DataArrayDouble *array=DataArrayDouble::New();
+ array->alloc(m->getNumberOfNodes(),3);
+ std::copy(disp,disp+12,array->getPointer());
+ f->setArray(array);
+ array->decrRef();
+ DataArrayDouble *arr1=f->getValueOnMulti(v2,5);
+ CPPUNIT_ASSERT_EQUAL(5,arr1->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(3,arr1->getNumberOfComponents());
+ const double expected1[15]={5.7,57.,570.,6.5,65.,650.,5.,50.,500.,8.,80.,800.,7.,70.,700.};
+ for(int i=0;i<15;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],arr1->getIJ(0,i),1e-14);
+ arr1->decrRef();
+ f->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest5::testGetNodeIdsOfCell2()
+{
+ MEDCouplingCMesh *m1c=MEDCouplingCMesh::New();
+ DataArrayDouble *coordsX=DataArrayDouble::New();
+ double arrX[5] = { -1., 1., 2., 4., 4.5 };
+ coordsX->useArray(arrX,false, CPP_DEALLOC,5,1);
+ DataArrayDouble *coordsY=DataArrayDouble::New();
+ double arrY[4] = { -2., 2., 4., 8. };
+ coordsY->useArray(arrY,false, CPP_DEALLOC,4,1);
+ DataArrayDouble *coordsZ=DataArrayDouble::New();
+ double arrZ[3] = { -2., 2., 4. };
+ coordsZ->useArray(arrZ,false, CPP_DEALLOC,3,1);
+ // test in 1D
+ m1c->setCoordsAt(0,coordsX);
+ CPPUNIT_ASSERT_EQUAL(4,m1c->getNumberOfCells());
+ const int expected1[4][2]={{0,1},{1,2},{2,3},{3,4}};
+ for(int i=0;i<4;i++)
+ {
+ std::vector<int> v;
+ m1c->getNodeIdsOfCell(i,v);
+ CPPUNIT_ASSERT((int)v.size()==2);
+ std::equal(v.begin(),v.end(),expected1[i]);
+ }
+ // test in 2D
+ m1c->setCoordsAt(1,coordsY);
+ CPPUNIT_ASSERT_EQUAL(12,m1c->getNumberOfCells());
+ const int expected2[12][4]={{0,1,6,5},{1,2,7,6},{2,3,8,7},{3,4,9,8},{4,5,11,10},{5,6,12,11},{6,7,13,12},{7,8,14,13},{8,9,16,15},{9,10,17,16},{10,11,18,17},{11,12,19,18}};
+ for(int i=0;i<12;i++)
+ {
+ std::vector<int> v;
+ m1c->getNodeIdsOfCell(i,v);
+ CPPUNIT_ASSERT((int)v.size()==4);
+ std::equal(v.begin(),v.end(),expected2[i]);
+ }
+ // test in 3D
+ m1c->setCoordsAt(2,coordsZ);
+ CPPUNIT_ASSERT_EQUAL(24,m1c->getNumberOfCells());
+ const int expected3[24][8]={{0,1,6,5,20,21,26,25},{1,2,7,6,21,22,27,26},{2,3,8,7,22,23,28,27},{3,4,9,8,23,24,29,28},{4,5,11,10,24,25,31,30},{5,6,12,11,25,26,32,31},{6,7,13,12,26,27,33,32},{7,8,14,13,27,28,34,33},{8,9,16,15,28,29,36,35},{9,10,17,16,29,30,37,36},{10,11,18,17,30,31,38,37},{11,12,19,18,31,32,39,38},{20,21,26,25,40,41,46,45},{21,22,27,26,41,42,47,46},{22,23,28,27,42,43,48,47},{23,24,29,28,43,44,49,48},{24,25,31,30,44,45,51,50},{25,26,32,31,45,46,52,51},{26,27,33,32,46,47,53,52},{27,28,34,33,47,48,54,53},{28,29,36,35,48,49,56,55},{29,30,37,36,49,50,57,56},{30,31,38,37,50,51,58,57},{31,32,39,38,51,52,59,58}};
+ for(int i=0;i<12;i++)
+ {
+ std::vector<int> v;
+ m1c->getNodeIdsOfCell(i,v);
+ CPPUNIT_ASSERT((int)v.size()==8);
+ std::equal(v.begin(),v.end(),expected3[i]);
+ }
+ //
+ coordsX->decrRef();
+ coordsY->decrRef();
+ coordsZ->decrRef();
+ m1c->decrRef();
+}
+
+void MEDCouplingBasicsTest5::testRenumberNodesInConn1()
+{
+ double mesh2DCoords[27]={-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. };
+ int mesh2DConn[18]={1,4,2, 4,5,2, 0,3,4,1, 6,7,4,3, 7,8,5,4};
+ MEDCouplingUMesh *mesh2D=MEDCouplingUMesh::New("mesh",2);
+ mesh2D->allocateCells(5);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,mesh2DConn);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,mesh2DConn+3);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,mesh2DConn+6);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,mesh2DConn+10);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,mesh2DConn+14);
+ mesh2D->finishInsertingCells();
+ DataArrayDouble *myCoords=DataArrayDouble::New();
+ myCoords->alloc(9,3);
+ std::copy(mesh2DCoords,mesh2DCoords+27,myCoords->getPointer());
+ mesh2D->setCoords(myCoords);
+ myCoords->decrRef();
+ mesh2D->checkCoherency();
+ //
+ double mesh3DCoords[24]={-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1. };
+ int mesh3DConn[8]={0,1,2,3,4,5,6,7};
+ MEDCouplingUMesh *mesh3D=MEDCouplingUMesh::New("mesh",3);
+ mesh3D->allocateCells(1);
+ mesh3D->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,mesh3DConn);
+ mesh3D->finishInsertingCells();
+ DataArrayDouble *myCoords3D=DataArrayDouble::New();
+ myCoords3D->alloc(8,3);
+ std::copy(mesh3DCoords,mesh3DCoords+24,myCoords3D->getPointer());
+ mesh3D->setCoords(myCoords3D);
+ myCoords3D->decrRef();
+ mesh3D->checkCoherency();
+ //
+ MEDCouplingUMesh *mesh3D_2=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCpy());
+ MEDCouplingUMesh *mesh2D_2=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCpy());
+ MEDCouplingUMesh *mesh3D_4=dynamic_cast<MEDCouplingUMesh *>(mesh3D->deepCpy());
+ MEDCouplingUMesh *mesh2D_4=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCpy());
+ DataArrayInt *renumNodes=DataArrayInt::New();
+ int oldNbOf3DNodes=mesh3D->getNumberOfNodes();
+ renumNodes->alloc(mesh2D->getNumberOfNodes(),1);
+ renumNodes->iota(oldNbOf3DNodes);
+ DataArrayDouble *coo=DataArrayDouble::Aggregate(mesh3D->getCoords(),mesh2D->getCoords());
+ mesh3D->setCoords(coo);
+ mesh2D->setCoords(coo);
+ coo->decrRef();
+ MEDCouplingUMesh *mesh2D_3=dynamic_cast<MEDCouplingUMesh *>(mesh2D->deepCpy());
+ mesh2D_3->shiftNodeNumbersInConn(oldNbOf3DNodes);
+ mesh2D->renumberNodesInConn(renumNodes->getConstPointer());
+ renumNodes->decrRef();
+ CPPUNIT_ASSERT(mesh2D_3->isEqual(mesh2D,1e-12));
+ mesh2D_3->decrRef();
+ //
+ DataArrayInt *da1,*da2;
+ mesh3D->checkGeoEquivalWith(mesh3D_2,10,1e-12,da1,da2);
+ CPPUNIT_ASSERT(da1==0);
+ CPPUNIT_ASSERT_EQUAL(8,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ const int expected1[8]={8,11,12,9,4,5,6,7};
+ for(int i=0;i<8;i++)
+ CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0));
+ da2->decrRef();
+ //
+ mesh2D->checkGeoEquivalWith(mesh2D_2,10,1e-12,da1,da2);
+ CPPUNIT_ASSERT(da1==0);
+ CPPUNIT_ASSERT_EQUAL(9,da2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,da2->getNumberOfComponents());
+ for(int i=0;i<9;i++)
+ CPPUNIT_ASSERT_EQUAL(8+i,da2->getIJ(i,0));
+ da2->decrRef();
+ //
+ const double vect[3]={1.,0.,0.};
+ MEDCouplingUMesh *mesh2D_5=dynamic_cast<MEDCouplingUMesh *>(mesh2D_4->deepCpy());
+ mesh2D_5->translate(vect);
+ std::vector<MEDCouplingUMesh *> meshes(3);
+ meshes[0]=mesh3D_4; meshes[1]=mesh2D_4; meshes[2]=mesh2D_5;
+ MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
+ CPPUNIT_ASSERT(mesh3D_4->getCoords()==mesh2D_4->getCoords());
+ CPPUNIT_ASSERT(mesh2D_4->getCoords()==mesh2D_5->getCoords());
+ mesh3D_4->checkCoherency(); mesh2D_4->checkCoherency(); mesh2D_5->checkCoherency();
+ CPPUNIT_ASSERT_EQUAL(26,mesh3D_4->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(3,mesh3D_4->getSpaceDimension());
+ CPPUNIT_ASSERT_EQUAL(9,mesh3D_4->getNodalConnectivity()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(23,mesh2D_4->getNodalConnectivity()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(23,mesh2D_5->getNodalConnectivity()->getNumberOfTuples());
+ const int expected2[9]={18,0,1,2,3,4,5,6,7};
+ const int expected3[23]={3,9,12,10, 3,12,13,10, 4,8,11,12,9, 4,14,15,12,11, 4,15,16,13,12};
+ const int expected4[23]={3,18,21,19, 3,21,22,19, 4,17,20,21,18, 4,23,24,21,20, 4,24,25,22,21};
+ const double expected5[78]={-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1., -0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0., 0.7, -0.3, 0.0, 1.2, -0.3, 0.0, 1.7, -0.3, 0.0, 0.7, 0.2, 0.0, 1.2, 0.2, 0.0, 1.7, 0.2, 0.0, 0.7, 0.7, 0.0, 1.2, 0.7, 0.0, 1.7, 0.7, 0.0};
+ CPPUNIT_ASSERT(std::equal(expected2,expected2+9,mesh3D_4->getNodalConnectivity()->getConstPointer()));
+ CPPUNIT_ASSERT(std::equal(expected3,expected3+23,mesh2D_4->getNodalConnectivity()->getConstPointer()));
+ CPPUNIT_ASSERT(std::equal(expected4,expected4+23,mesh2D_5->getNodalConnectivity()->getConstPointer()));
+ for(int i=0;i<78;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[i],mesh3D_4->getCoords()->getIJ(0,i),1e-12);
+ //
+ MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,1e-12);
+ mesh3D_4->checkCoherency(); mesh2D_4->checkCoherency(); mesh2D_5->checkCoherency();
+ CPPUNIT_ASSERT(mesh3D_4->getCoords()==mesh2D_4->getCoords());
+ CPPUNIT_ASSERT(mesh2D_4->getCoords()==mesh2D_5->getCoords());
+ CPPUNIT_ASSERT_EQUAL(19,mesh3D_4->getNumberOfNodes());
+ CPPUNIT_ASSERT_EQUAL(3,mesh3D_4->getSpaceDimension());
+ CPPUNIT_ASSERT_EQUAL(9,mesh3D_4->getNodalConnectivity()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(23,mesh2D_4->getNodalConnectivity()->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(23,mesh2D_5->getNodalConnectivity()->getNumberOfTuples());
+ const int expected6[9]={18,0,1,2,3,4,5,6,7};
+ const int expected7[23]={3,3,2,8, 3,2,9,8, 4,0,1,2,3, 4,10,11,2,1, 4,11,12,9,2};
+ const int expected8[23]={3,13,15,14, 3,15,16,14, 4,8,9,15,13, 4,12,17,15,9, 4,17,18,16,15};
+ const double expected9[57]={-0.3, -0.3, 0., -0.3, 0.2, 0., 0.2, 0.2, 0., 0.2, -0.3, 0., -0.3, -0.3, 1., -0.3, 0.2, 1.,
+ 0.2, 0.2, 1., 0.2, -0.3, 1., 0.7, -0.3, 0., 0.7, 0.2, 0., -0.3, 0.7, 0., 0.2, 0.7, 0.,
+ 0.7, 0.7, 0., 1.2, -0.3, 0., 1.7, -0.3, 0., 1.2, 0.2, 0., 1.7, 0.2, 0., 1.2, 0.7, 0., 1.7, 0.7, 0.};
+ CPPUNIT_ASSERT(std::equal(expected6,expected6+9,mesh3D_4->getNodalConnectivity()->getConstPointer()));
+ CPPUNIT_ASSERT(std::equal(expected7,expected7+23,mesh2D_4->getNodalConnectivity()->getConstPointer()));
+ CPPUNIT_ASSERT(std::equal(expected8,expected8+23,mesh2D_5->getNodalConnectivity()->getConstPointer()));
+ for(int i=0;i<57;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected9[i],mesh3D_4->getCoords()->getIJ(0,i),1e-12);
+ mesh2D_5->decrRef();
+ //
+ mesh3D_4->decrRef();
+ mesh2D_4->decrRef();
+ mesh3D_2->decrRef();
+ mesh2D_2->decrRef();
+ //
+ mesh3D->decrRef();
+ mesh2D->decrRef();
+}
+
+void MEDCouplingBasicsTest5::testComputeNeighborsOfCells1()
+{
+ MEDCouplingUMesh *m=build2DTargetMesh_1();
+ DataArrayInt *d1=0,*d2=0;
+ m->computeNeighborsOfCells(d1,d2);
+ CPPUNIT_ASSERT_EQUAL(6,d2->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(10,d1->getNumberOfTuples());
+ const int expected1[6]={0,2,4,6,8,10};
+ const int expected2[10]={3,1,0,2,4,1,4,0,2,3};
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+6,d2->getConstPointer()));
+ CPPUNIT_ASSERT(std::equal(expected2,expected2+10,d1->getConstPointer()));
+ d1->decrRef();
+ d2->decrRef();
+ m->decrRef();
+}
+
+void MEDCouplingBasicsTest5::testCheckButterflyCellsBug1()
+{
+ double mesh2DCoords[10]={323.85,120.983748908684,317.5,131.982271536747,336.55,120.983748908686,330.2,131.982271536751,323.85,142.98079416481};
+ int mesh2DConn[5]={4,1,0,2,3};
+ MEDCouplingUMesh *mesh2D=MEDCouplingUMesh::New("mesh",2);
+ mesh2D->allocateCells(1);
+ mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,5,mesh2DConn);
+ mesh2D->finishInsertingCells();
+ DataArrayDouble *myCoords=DataArrayDouble::New();
+ myCoords->alloc(5,2);
+ std::copy(mesh2DCoords,mesh2DCoords+10,myCoords->getPointer());
+ mesh2D->setCoords(myCoords);
+ myCoords->decrRef();
+ mesh2D->checkCoherency();
+ //
+ std::vector<int> v;
+ mesh2D->checkButterflyCells(v);
+ CPPUNIT_ASSERT_EQUAL(0,(int)v.size());
+ //
+ mesh2D->decrRef();
+}
+
+void MEDCouplingBasicsTest5::testDataArrayIntRange1()
+{
+ DataArrayInt *d=DataArrayInt::Range(2,17,7);
+ const int expected1[3]={2,9,16};
+ CPPUNIT_ASSERT_EQUAL(3,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+3,d->getConstPointer()));
+ d->decrRef();
+ //
+ d=DataArrayInt::Range(2,23,7);
+ CPPUNIT_ASSERT_EQUAL(3,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+3,d->getConstPointer()));
+ d->decrRef();
+ //
+ d=DataArrayInt::Range(2,24,7);
+ const int expected2[4]={2,9,16,23};
+ CPPUNIT_ASSERT_EQUAL(4,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected2,expected2+4,d->getConstPointer()));
+ d->decrRef();
+ //
+ d=DataArrayInt::Range(24,2,-7);
+ const int expected3[4]={24,17,10,3};
+ CPPUNIT_ASSERT_EQUAL(4,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected3,expected3+4,d->getConstPointer()));
+ d->decrRef();
+ //
+ d=DataArrayInt::Range(23,2,-7);
+ const int expected4[3]={23,16,9};
+ CPPUNIT_ASSERT_EQUAL(3,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected4,expected4+3,d->getConstPointer()));
+ d->decrRef();
+ //
+ d=DataArrayInt::Range(23,22,-7);
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(23,d->getIJ(0,0));
+ d->decrRef();
+ //
+ d=DataArrayInt::Range(22,23,7);
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ CPPUNIT_ASSERT_EQUAL(22,d->getIJ(0,0));
+ d->decrRef();
+ //
+ d=DataArrayInt::Range(22,22,7);
+ CPPUNIT_ASSERT_EQUAL(0,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ d->decrRef();
+ //
+ d=DataArrayInt::Range(22,22,-7);
+ CPPUNIT_ASSERT_EQUAL(0,d->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,d->getNumberOfComponents());
+ d->decrRef();
+ //
+ CPPUNIT_ASSERT_THROW(DataArrayInt::Range(22,23,-7),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(DataArrayInt::Range(23,22,7),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(DataArrayInt::Range(23,22,0),INTERP_KERNEL::Exception);
+ CPPUNIT_ASSERT_THROW(DataArrayInt::Range(22,23,0),INTERP_KERNEL::Exception);
+}
+
+void MEDCouplingBasicsTest5::testDataArrayDoubleGetMinMaxPerComponent1()
+{
+ const double values1[12]={1.,2.,3.,-0.9,2.1,3.,1.3,1.7,3.,1.,1.8,3.};
+ DataArrayDouble *d1=DataArrayDouble::New();
+ double *res=new double[2*3];
+ CPPUNIT_ASSERT_THROW(d1->getMinMaxPerComponent(res),INTERP_KERNEL::Exception);
+ d1->alloc(4,3);
+ std::copy(values1,values1+12,d1->getPointer());
+ d1->getMinMaxPerComponent(res);
+ const double expected1[6]={-0.9,1.3,1.7,2.1,3.,3.};
+ for(int i=0;i<6;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],res[i],1e-14);
+ delete [] res;
+ //
+ d1->rearrange(2);
+ res=new double[2*2];
+ d1->getMinMaxPerComponent(res);
+ const double expected2[4]={1.,3.,-0.9,3.};
+ for(int i=0;i<4;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],res[i],1e-14);
+ delete [] res;
+ //
+ d1->rearrange(1);
+ res=new double[2*1];
+ d1->getMinMaxPerComponent(res);
+ const double expected3[2]={-0.9,3.};
+ for(int i=0;i<2;i++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(expected3[i],res[i],1e-14);
+ delete [] res;
+ d1->decrRef();
+}
+
+void MEDCouplingBasicsTest5::testDataArrayIntGetHashCode1()
+{
+ DataArrayInt *d1=DataArrayInt::New(); d1->alloc(3545,1); d1->iota(0);
+ DataArrayInt *d2=DataArrayInt::New(); d2->alloc(3545,1); d2->iota(0);
+ //
+ CPPUNIT_ASSERT_EQUAL(d1->getHashCode(),d2->getHashCode());
+ CPPUNIT_ASSERT_EQUAL(232341068,d1->getHashCode());
+ d1->setIJ(886,0,6);
+ CPPUNIT_ASSERT_EQUAL(232340188,d1->getHashCode());
+ //
+ d1->decrRef();
+ d2->decrRef();
+}
+
+void MEDCouplingBasicsTest5::testZipConnectivityPol1()
+{
+ MEDCouplingUMesh *m1=build2DTargetMesh_1();
+ const int cells1[3]={2,3,4};
+ MEDCouplingPointSet *m2_1=m1->buildPartOfMySelf(cells1,cells1+3,true);
+ MEDCouplingUMesh *m2=dynamic_cast<MEDCouplingUMesh *>(m2_1);
+ DataArrayInt *arr=0;
+ CPPUNIT_ASSERT(m2);
+ // no permutation policy 0
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,0,arr));
+ CPPUNIT_ASSERT_EQUAL(3,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer()));
+ arr->decrRef();
+ // no permutation policy 1
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,1,arr));
+ CPPUNIT_ASSERT_EQUAL(3,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer()));
+ arr->decrRef();
+ // no permutation policy 2
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,2,arr));
+ CPPUNIT_ASSERT_EQUAL(3,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer()));
+ arr->decrRef();
+ // some modification into m2
+ const int modif1[3]={2,4,5};
+ std::copy(modif1,modif1+3,m2->getNodalConnectivity()->getPointer()+1);
+ //policy 0 fails because cell0 in m2 has same orientation be not same connectivity
+ const int expected1[3]={5,3,4};
+ CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,0,arr));
+ CPPUNIT_ASSERT_EQUAL(3,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+3,arr->getConstPointer()));
+ arr->decrRef();
+ //policy 1 succeeds because cell0 in m2 has not exactly the same conn
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,1,arr));
+ CPPUNIT_ASSERT_EQUAL(3,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer()));
+ arr->decrRef();
+ //policy 2 succeeds because cell0 in m2 has same nodes in connectivity
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,2,arr));
+ CPPUNIT_ASSERT_EQUAL(3,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer()));
+ arr->decrRef();
+ //some new modification into m2
+ const int modif2[3]={2,5,4};
+ std::copy(modif2,modif2+3,m2->getNodalConnectivity()->getPointer()+1);
+ //policy 0 fails because cell0 in m2 has not exactly the same conn
+ CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,0,arr));
+ CPPUNIT_ASSERT_EQUAL(3,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+3,arr->getConstPointer()));
+ arr->decrRef();
+ //policy 1 fails too because cell0 in m2 has not same orientation
+ CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,1,arr));
+ CPPUNIT_ASSERT_EQUAL(3,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected1,expected1+3,arr->getConstPointer()));
+ arr->decrRef();
+ //policy 2 succeeds because cell0 in m2 has same nodes in connectivity
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,2,arr));
+ CPPUNIT_ASSERT_EQUAL(3,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer()));
+ arr->decrRef();
+ m1->decrRef();
+ m2->decrRef();
+ // Now 1D
+ const int cells2[2]={3,2};
+ m1=build1DSourceMesh_2();
+ m2_1=m1->buildPartOfMySelf(cells2,cells2+2,true);
+ m2=dynamic_cast<MEDCouplingUMesh *>(m2_1);
+ CPPUNIT_ASSERT(m2);
+ arr=0;
+ // no permutation policy 0
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,0,arr));
+ CPPUNIT_ASSERT_EQUAL(2,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells2,cells2+2,arr->getConstPointer()));
+ arr->decrRef();
+ // no permutation policy 1
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,1,arr));
+ CPPUNIT_ASSERT_EQUAL(2,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells2,cells2+2,arr->getConstPointer()));
+ arr->decrRef();
+ // no permutation policy 2
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,2,arr));
+ CPPUNIT_ASSERT_EQUAL(2,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells2,cells2+2,arr->getConstPointer()));
+ arr->decrRef();
+ // some modification into m2
+ const int modif3[2]={4,3};
+ std::copy(modif3,modif3+2,m2->getNodalConnectivity()->getPointer()+1);
+ //policy 0 fails because cell0 in m2 has not exactly the same conn
+ const int expected2[2]={4,2};
+ CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,0,arr));
+ CPPUNIT_ASSERT_EQUAL(2,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected2,expected2+2,arr->getConstPointer()));
+ arr->decrRef();
+ //policy 1 fails too because cell0 in m2 has not same orientation
+ CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,1,arr));
+ CPPUNIT_ASSERT_EQUAL(2,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(expected2,expected2+2,arr->getConstPointer()));
+ arr->decrRef();
+ //policy 2 succeeds because cell0 in m2 has same nodes in connectivity
+ CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,2,arr));
+ CPPUNIT_ASSERT_EQUAL(2,arr->getNumberOfTuples());
+ CPPUNIT_ASSERT_EQUAL(1,arr->getNumberOfComponents());
+ CPPUNIT_ASSERT(std::equal(cells2,cells2+2,arr->getConstPointer()));
+ arr->decrRef();
+ m1->decrRef();
+ m2->decrRef();
+}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
CPPUNIT_TEST( testBuildDescendingConnec2Of3DMesh1 );
CPPUNIT_TEST( testAre2DCellsNotCorrectlyOriented1 );
CPPUNIT_TEST( testDataArrayAbs1 );
+ CPPUNIT_TEST( testGetValueOn3 );
+ CPPUNIT_TEST( testGetNodeIdsOfCell2 );
+ CPPUNIT_TEST( testRenumberNodesInConn1 );
+ CPPUNIT_TEST( testComputeNeighborsOfCells1 );
+ CPPUNIT_TEST( testCheckButterflyCellsBug1 );
+ CPPUNIT_TEST( testDataArrayIntRange1 );
+ CPPUNIT_TEST( testDataArrayDoubleGetMinMaxPerComponent1 );
+ CPPUNIT_TEST( testDataArrayIntGetHashCode1 );
+ CPPUNIT_TEST( testZipConnectivityPol1 );
CPPUNIT_TEST_SUITE_END();
public:
void testUMeshTessellate2D1();
void testBuildDescendingConnec2Of3DMesh1();
void testAre2DCellsNotCorrectlyOriented1();
void testDataArrayAbs1();
+ void testGetValueOn3();
+ void testGetNodeIdsOfCell2();
+ void testRenumberNodesInConn1();
+ void testComputeNeighborsOfCells1();
+ void testCheckButterflyCellsBug1();
+ void testDataArrayIntRange1();
+ void testDataArrayDoubleGetMinMaxPerComponent1();
+ void testDataArrayIntGetHashCode1();
+ void testZipConnectivityPol1();
};
}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
ParaMEDMEM::MEDCouplingFieldDouble *f2=f1->buildSubPart(part1,part1+3);
//! [CppSnippetFieldDoubleBuildSubPart1_2]
f2->zipCoords();
- const double expected1[6]={5.,105.,4.,104.,7.,107.};
CPPUNIT_ASSERT_EQUAL(3,f2->getMesh()->getNumberOfCells());
CPPUNIT_ASSERT_EQUAL(6,f2->getMesh()->getNumberOfNodes());
CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension());
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
myCoords->decrRef();
return ret;
}
+
+void MEDCouplingRemapperTest::testPartialTransfer1()
+{
+ MEDCouplingRemapper remapper;
+ MEDCouplingUMesh *sourceMesh=build1DTargetMesh_2();
+ MEDCouplingUMesh *targetMesh=MEDCouplingBasicsTest::build2DTargetMesh_1();
+ remapper.setIntersectionType(INTERP_KERNEL::PointLocator);
+ CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(sourceMesh,targetMesh,"P0P0"));
+ 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=MEDCouplingFieldDouble::New(ON_CELLS);
+ trgField->setNature(ConservativeVolumic);
+ trgField->setMesh(targetMesh);
+ array=DataArrayDouble::New();
+ array->alloc(targetMesh->getNumberOfCells(),1);
+ ptr=array->getPointer();
+ std::fill(ptr,ptr+targetMesh->getNumberOfCells(),96.3);
+ trgField->setArray(array);
+ array->decrRef();
+ remapper.partialTransfer(srcField,trgField);
+ const double valuesExpected9[5]={10.,8.,7.,96.3,10.};
+ const double *values=trgField->getArray()->getConstPointer();
+ for(int i0=0;i0<5;i0++)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected9[i0],values[i0],1e-12);
+ trgField->decrRef();
+ srcField->decrRef();
+ sourceMesh->decrRef();
+ targetMesh->decrRef();
+}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
CPPUNIT_TEST( testExtruded );
CPPUNIT_TEST( testExtruded2 );
CPPUNIT_TEST( testPrepareEx1 );
+ CPPUNIT_TEST( testPartialTransfer1 );
CPPUNIT_TEST_SUITE_END();
public:
void test2DInterpP0P0_1();
void testExtruded();
void testExtruded2();
void testPrepareEx1();
+ void testPartialTransfer1();
private:
static MEDCouplingUMesh *build1DTargetMesh_2();
static MEDCouplingUMesh *build2DTargetMesh_3();
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
%newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
%newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
%newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
+%newobject ParaMEDMEM::DataArrayInt::negate;
%newobject ParaMEDMEM::DataArrayInt::Aggregate;
%newobject ParaMEDMEM::DataArrayInt::Meld;
%newobject ParaMEDMEM::DataArrayInt::Add;
%newobject ParaMEDMEM::DataArrayInt::Divide;
%newobject ParaMEDMEM::DataArrayInt::BuildUnion;
%newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
+%newobject ParaMEDMEM::DataArrayInt::Range;
%newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
%newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
%newobject ParaMEDMEM::DataArrayInt::buildComplement;
%newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
%newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
%newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
-%newobject ParaMEDMEM::DataArrayInt::__getitem__;
+%newobject ParaMEDMEM::DataArrayInt::__neg__;
%newobject ParaMEDMEM::DataArrayInt::__add__;
%newobject ParaMEDMEM::DataArrayInt::__radd__;
%newobject ParaMEDMEM::DataArrayInt::__sub__;
%newobject ParaMEDMEM::DataArrayInt::__rdiv__;
%newobject ParaMEDMEM::DataArrayInt::__mod__;
%newobject ParaMEDMEM::DataArrayInt::__rmod__;
+%newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
%newobject ParaMEDMEM::DataArrayDouble::New;
%newobject ParaMEDMEM::DataArrayDouble::__iter__;
%newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
%newobject ParaMEDMEM::DataArrayDouble::selectByTupleIdSafe;
%newobject ParaMEDMEM::DataArrayDouble::selectByTupleId2;
%newobject ParaMEDMEM::DataArrayDouble::selectByTupleRanges;
+%newobject ParaMEDMEM::DataArrayDouble::negate;
%newobject ParaMEDMEM::DataArrayDouble::applyFunc;
%newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
%newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
%newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
%newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
%newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
-%newobject ParaMEDMEM::DataArrayDouble::__getitem__;
+%newobject ParaMEDMEM::DataArrayDouble::__neg__;
%newobject ParaMEDMEM::DataArrayDouble::__add__;
%newobject ParaMEDMEM::DataArrayDouble::__radd__;
%newobject ParaMEDMEM::DataArrayDouble::__sub__;
%newobject ParaMEDMEM::DataArrayDouble::__rmul__;
%newobject ParaMEDMEM::DataArrayDouble::__div__;
%newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
+%newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
%newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
%newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
%newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
%newobject ParaMEDMEM::MEDCouplingUMesh::getNodalConnectivityIndex;
%newobject ParaMEDMEM::MEDCouplingUMesh::clone;
%newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
+%newobject ParaMEDMEM::MEDCouplingUMesh::__getitem__;
%newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
%newobject ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer;
%newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
int getCellContainingPoint(PyObject *p, double eps) const throw(INTERP_KERNEL::Exception)
{
int sz;
- double *pos=convertPyToNewDblArr2(p,&sz);
- int ret=self->getCellContainingPoint(pos,eps);
- delete [] pos;
- return ret;
+ INTERP_KERNEL::AutoPtr<double> pos=convertPyToNewDblArr2(p,&sz);
+ return self->getCellContainingPoint(pos,eps);
}
PyObject *getCellsContainingPoints(PyObject *p, int nbOfPoints, double eps) const throw(INTERP_KERNEL::Exception)
void scale(PyObject *point, double factor) throw(INTERP_KERNEL::Exception)
{
int sz;
- double *p=convertPyToNewDblArr2(point,&sz);
+ INTERP_KERNEL::AutoPtr<double> p=convertPyToNewDblArr2(point,&sz);
self->scale(p,factor);
- delete [] p;
}
PyObject *getBoundingBox() const throw(INTERP_KERNEL::Exception)
{
int spaceDim=self->getSpaceDimension();
- double *tmp=new double[2*spaceDim];
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[2*spaceDim];
self->getBoundingBox(tmp);
PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,spaceDim);
- delete [] tmp;
return ret;
}
{
int sz;
INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vector,&sz);
+ if(sz!=self->getSpaceDimension())
+ {
+ std::ostringstream oss; oss << "Python wrap of MEDCouplingPointSet::translate : the space dimension is " << self->getSpaceDimension() << " and the input array size is " << sz;
+ oss << " ! The size of the input list or tuple must be equal to " << self->getSpaceDimension() << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
self->translate(v);
}
PyList_SetItem(res,i,PyInt_FromLong(*iL));
return res;
}
+
+ static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
+ convertPyObjToVecMeshesCst(li,tmp);
+ return MEDCouplingMesh::MergeMeshes(tmp);
+ }
}
};
}
void renumberNodes(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
if (!SWIG_IsOK(res1))
{
int size;
void renumberNodes2(PyObject *li, int newNbOfNodes) throw(INTERP_KERNEL::Exception)
{
void *da=0;
- int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
if (!SWIG_IsOK(res1))
{
int size;
std::vector<int> nodes;
int spaceDim=self->getSpaceDimension();
int sz1,sz2;
- double *p=convertPyToNewDblArr2(pt,&sz1);
- double *v=convertPyToNewDblArr2(vec,&sz2);
+ INTERP_KERNEL::AutoPtr<double> p=convertPyToNewDblArr2(pt,&sz1);
+ INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vec,&sz2);
if(sz1!=spaceDim || sz2!=spaceDim)
throw INTERP_KERNEL::Exception("Mismatch of spaceDimension and the length of the input array point and vector !");
self->findNodesOnLine(p,v,eps,nodes);
- delete [] v;
- delete [] p;
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)nodes.size(),1);
std::copy(nodes.begin(),nodes.end(),ret->getPointer());
{
std::vector<int> nodes;
int sz;
- double *p=convertPyToNewDblArr2(pt,&sz);
- double *v=convertPyToNewDblArr2(vec,&sz);
+ INTERP_KERNEL::AutoPtr<double> p=convertPyToNewDblArr2(pt,&sz);
+ INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vec,&sz);
self->findNodesOnPlane(p,v,eps,nodes);
- delete [] v;
- delete [] p;
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)nodes.size(),1);
std::copy(nodes.begin(),nodes.end(),ret->getPointer());
{
std::vector<int> elems;
int size;
- double *tmp=convertPyToNewDblArr2(bbox,&size);
+ INTERP_KERNEL::AutoPtr<double> tmp=convertPyToNewDblArr2(bbox,&size);
self->getCellsInBoundingBox(tmp,eps,elems);
- delete [] tmp;
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)elems.size(),1);
std::copy(elems.begin(),elems.end(),ret->getPointer());
static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
{
int sz;
- double *c=convertPyToNewDblArr2(center,&sz);
- double *coo=convertPyToNewDblArr2(coords,&sz);
+ INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
+ INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
ParaMEDMEM::MEDCouplingPointSet::Rotate2DAlg(c,angle,nbNodes,coo);
for(int i=0;i<sz;i++)
PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
- delete [] coo;
- delete [] c;
}
static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) throw(INTERP_KERNEL::Exception)
{
int sz,sz2;
- double *c=convertPyToNewDblArr2(center,&sz);
- double *coo=convertPyToNewDblArr2(coords,&sz);
+ INTERP_KERNEL::AutoPtr<double> c=convertPyToNewDblArr2(center,&sz);
+ INTERP_KERNEL::AutoPtr<double> coo=convertPyToNewDblArr2(coords,&sz);
double *v=convertPyToNewDblArr2(vect,&sz2);
ParaMEDMEM::MEDCouplingPointSet::Rotate3DAlg(c,v,angle,nbNodes,coo);
for(int i=0;i<sz;i++)
PyList_SetItem(coords,i,PyFloat_FromDouble(coo[i]));
- delete [] coo;
- delete [] c;
}
}
};
std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
//tools
+ void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception);
std::vector<bool> getQuadraticStatus() const throw(INTERP_KERNEL::Exception);
DataArrayInt *findCellsIdsOnBoundary() const throw(INTERP_KERNEL::Exception);
bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception);
return self->cellIterator();
}
+ MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) throw(INTERP_KERNEL::Exception)
+ {
+ int sw;
+ int singleVal;
+ std::vector<int> multiVal;
+ std::pair<int, std::pair<int,int> > slic;
+ ParaMEDMEM::DataArrayInt *daIntTyypp=0;
+ int nbc=self->getNumberOfCells();
+ convertObjToPossibleCpp2(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
+ switch(sw)
+ {
+ case 1:
+ {
+ if(singleVal>=nbc)
+ {
+ std::ostringstream oss;
+ oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(singleVal>=0)
+ return self->buildPartOfMySelf(&singleVal,&singleVal+1,true);
+ else
+ {
+ if(nbc+singleVal>0)
+ {
+ int tmp=nbc+singleVal;
+ return self->buildPartOfMySelf(&tmp,&tmp+1,true);
+ }
+ else
+ {
+ std::ostringstream oss;
+ oss << "Requesting for cell id " << singleVal << " having only " << nbc << " cells !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ }
+ }
+ case 2:
+ {
+ return static_cast<MEDCouplingUMesh *>(self->buildPartOfMySelf(&multiVal[0],&multiVal[0]+multiVal.size(),true));
+ }
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::Range(slic.first,slic.second.first,slic.second.second);
+ return self->buildPartOfMySelf(d0->begin(),d0->end(),true);
+ }
+ case 4:
+ {
+ if(!daIntTyypp)
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : null instance has been given in input !");
+ daIntTyypp->checkAllocated();
+ return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true);
+ }
+ default:
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !");
+ }
+ }
+
void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) throw(INTERP_KERNEL::Exception)
{
int sz;
INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
+ if(size>sz)
+ {
+ std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << sz << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
self->insertNextCell(type,size,tmp);
}
+
+ void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ int sz;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
+ self->insertNextCell(type,sz,tmp);
+ }
+
DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
{
DataArrayInt *ret=self->getNodalConnectivity();
PyList_SetItem(res,2,SWIG_From_int(ret2));
return res;
}
- PyObject *checkButterflyCells() throw(INTERP_KERNEL::Exception)
+ PyObject *checkButterflyCells(double eps=1e-12) throw(INTERP_KERNEL::Exception)
{
std::vector<int> cells;
- self->checkButterflyCells(cells);
+ self->checkButterflyCells(cells,eps);
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)cells.size(),1);
std::copy(cells.begin(),cells.end(),ret->getPointer());
return ret;
}
+ void renumberNodesInConn(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ self->renumberNodesInConn(tmp);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ self->renumberNodesInConn(da2->getConstPointer());
+ }
+ }
+
PyObject *getLevArrPerCellTypes(PyObject *li) const throw(INTERP_KERNEL::Exception)
{
int sz;
return ret;
}
+ static void PutUMeshesOnSameAggregatedCoords(PyObject *ms) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<MEDCouplingUMesh *> meshes;
+ convertPyObjToVecUMeshes(ms,meshes);
+ MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(meshes);
+ }
+
+ static void MergeNodesOnUMeshesSharingSameCoords(PyObject *ms, double eps) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<MEDCouplingUMesh *> meshes;
+ convertPyObjToVecUMeshes(ms,meshes);
+ MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(meshes,eps);
+ }
+
PyObject *are2DCellsNotCorrectlyOriented(PyObject *vec, bool polyOnly) const throw(INTERP_KERNEL::Exception)
{
std::vector<int> cells;
int sz;
- double *v=convertPyToNewDblArr2(vec,&sz);
- try
- {
- self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
- }
- catch(INTERP_KERNEL::Exception& e)
- {
- delete [] v;
- throw e;
- }
- delete [] v;
+ INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vec,&sz);
+ self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells);
DataArrayInt *ret=DataArrayInt::New();
ret->alloc((int)cells.size(),1);
std::copy(cells.begin(),cells.end(),ret->getPointer());
void orientCorrectly2DCells(PyObject *vec, bool polyOnly) throw(INTERP_KERNEL::Exception)
{
int sz;
- double *v=convertPyToNewDblArr2(vec,&sz);
- try
- {
- self->orientCorrectly2DCells(v,polyOnly);
- }
- catch(INTERP_KERNEL::Exception& e)
- {
- delete [] v;
- throw e;
- }
- delete [] v;
+ INTERP_KERNEL::AutoPtr<double> v=convertPyToNewDblArr2(vec,&sz);
+ self->orientCorrectly2DCells(v,polyOnly);
}
PyObject *arePolyhedronsNotCorrectlyOriented() const throw(INTERP_KERNEL::Exception)
return ret;
}
+ PyObject *computeNeighborsOfCells() const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *neighbors=0,*neighborsIdx=0;
+ self->computeNeighborsOfCells(neighbors,neighborsIdx);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh)
{
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
int pos1;
std::vector<int> pos2;
DataArrayInt *pos3=0;
- convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3);
+ DataArrayIntTuple *pos4=0;
+ convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
switch(sw)
{
case 1:
class MEDCouplingExtrudedMesh : public ParaMEDMEM::MEDCouplingMesh
{
public:
- static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
+ static MEDCouplingExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *build3DUnstructuredMesh() const throw(INTERP_KERNEL::Exception);
%extend {
std::string __str__() const
{
return self->doubleValue();
}
+
+ DataArrayDouble *buildDADouble()
+ {
+ return self->buildDADouble(1,self->getNumberOfCompo());
+ }
PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
%extend ParaMEDMEM::DataArrayDouble
{
+ static DataArrayDouble *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+ {
+ const char *msg="ParaMEDMEM::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n--DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2) !";
+ if(PyList_Check(elt0) || PyTuple_Check(elt0))
+ {
+ if(elt1)
+ {
+ if(PyInt_Check(elt1))
+ {
+ int nbOfTuples=PyInt_AS_LONG(elt1);
+ if(nbOfTuples<0)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
+ if(elt2)
+ {
+ if(PyInt_Check(elt2))
+ {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
+ int nbOfCompo=PyInt_AS_LONG(elt2);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ double *tmp=new double[nbOfTuples*nbOfCompo];
+ try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples*nbOfCompo,0.,true); }
+ catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
+ ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayDouble.New([1.,3.,4.],3)
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ double *tmp=new double[nbOfTuples];
+ try { fillArrayWithPyListDbl(elt0,tmp,nbOfTuples,0.,true); }
+ catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
+ ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {// DataArrayDouble.New([1.,3.,4.])
+ int szz=-1;
+ if(PyList_Check(elt0))
+ szz=PyList_Size(elt0);
+ else
+ szz=PyTuple_Size(elt0);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ double *tmp=new double[szz];
+ try { fillArrayWithPyListDbl(elt0,tmp,szz,0.,true); }
+ catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
+ ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else if(PyInt_Check(elt0))
+ {
+ int nbOfTuples=PyInt_AS_LONG(elt0);
+ if(nbOfTuples<0)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
+ if(elt1)
+ {
+ if(!elt2)
+ {
+ if(PyInt_Check(elt1))
+ {//DataArrayDouble.New(5,2)
+ int nbOfCompo=PyInt_AS_LONG(elt1);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ ret->alloc(nbOfTuples,nbOfCompo);
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayDouble.New(5)
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+ ret->alloc(nbOfTuples,1);
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+
std::string __str__() const
{
return self->repr();
double *tmp=new double[nbOfTuples*nbOfElsPerTuple];
try
{
- fillArrayWithPyListDbl(li,tmp,nbOfTuples*nbOfElsPerTuple,0.);
+ fillArrayWithPyListDbl(li,tmp,nbOfTuples*nbOfElsPerTuple,0.,false);
}
catch(INTERP_KERNEL::Exception& e)
{
return ret;
}
+ PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
+ {
+ int nbOfCompo=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
+ self->getMinMaxPerComponent(tmp);
+ PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
+ return ret;
+ }
+
PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
{
int sz=self->getNumberOfComponents();
- double *tmp=new double[sz];
- try
- {
- self->accumulate(tmp);
- }
- catch(INTERP_KERNEL::Exception& e)
- {
- delete [] tmp;
- throw e;
- }
- PyObject *ret=convertDblArrToPyList(tmp,sz);
- delete [] tmp;
- return ret;
+ INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
+ self->accumulate(tmp);
+ return convertDblArrToPyList(tmp,sz);
}
DataArrayDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
return self->selectByTupleRanges(ranges);
}
- DataArrayDouble *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- const char msg[]="Unexpected situation in __getitem__ !";
+ const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
self->checkAllocated();
int nbOfTuples=self->getNumberOfTuples();
int nbOfComponents=self->getNumberOfComponents();
switch(sw)
{
case 1:
- return self->selectByTupleIdSafe(&it1,&it1+1);
+ if(nbOfComponents==1)
+ return PyFloat_FromDouble(self->getIJSafe(it1,0));
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
case 2:
- return self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
case 3:
- return self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
case 4:
- return self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
case 5:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- std::vector<int> v2(1,ic1);
- return ret->keepSelectedComponents(v2);
- }
+ return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
case 6:
{
ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
std::vector<int> v2(1,ic1);
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 7:
{
ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
std::vector<int> v2(1,ic1);
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 8:
{
ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
std::vector<int> v2(1,ic1);
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 9:
{
ret=self->selectByTupleIdSafe(&it1,&it1+1);
- return ret->keepSelectedComponents(vc1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 10:
{
ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- return ret->keepSelectedComponents(vc1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 11:
{
ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
- return ret->keepSelectedComponents(vc1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 12:
{
ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- return ret->keepSelectedComponents(vc1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 13:
{
std::vector<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 14:
{
std::vector<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 15:
{
std::vector<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
case 16:
{
std::vector<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
}
default:
throw INTERP_KERNEL::Exception(msg);
return self;
}
+ DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->negate();
+ }
+
DataArrayDouble *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
const char msg[]="Unexpected situation in __add__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
{
return DataArrayDouble::Add(self,a);
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ return DataArrayDouble::Add(self,aaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __radd__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
ret->incrRef();
return ret;
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ return DataArrayDouble::Add(self,aaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __iadd__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
self->addEqual(a);
return self;
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ self->addEqual(aaa);
+ return self;
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ self->addEqual(aaa);
+ return self;
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __sub__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
{
return DataArrayDouble::Substract(self,a);
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ return DataArrayDouble::Substract(self,aaa);
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ return DataArrayDouble::Substract(self,aaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __rsub__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
ret->incrRef();
return ret;
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ return DataArrayDouble::Substract(aaa,self);
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ return DataArrayDouble::Substract(aaa,self);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __isub__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
self->substractEqual(a);
return self;
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ self->substractEqual(aaa);
+ return self;
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ self->substractEqual(aaa);
+ return self;
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __mul__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
{
return DataArrayDouble::Multiply(self,a);
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ return DataArrayDouble::Multiply(self,aaa);
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ return DataArrayDouble::Multiply(self,aaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __rmul__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
ret->incrRef();
return ret;
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ return DataArrayDouble::Multiply(self,aaa);
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ return DataArrayDouble::Multiply(self,aaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __imul__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
self->multiplyEqual(a);
return self;
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ self->multiplyEqual(aaa);
+ return self;
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ self->multiplyEqual(aaa);
+ return self;
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __div__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
{
return DataArrayDouble::Divide(self,a);
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ return DataArrayDouble::Divide(self,aaa);
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ return DataArrayDouble::Divide(self,aaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __rdiv__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
ret->incrRef();
return ret;
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ return DataArrayDouble::Divide(aaa,self);
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ return DataArrayDouble::Divide(aaa,self);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
const char msg[]="Unexpected situation in __imul__ !";
double val;
DataArrayDouble *a;
+ DataArrayDoubleTuple *aa;
+ std::vector<double> bb;
int sw;
- convertObjToPossibleCpp5(obj,sw,val,a);
+ convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
switch(sw)
{
case 1:
self->divideEqual(a);
return self;
}
+ case 3:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
+ self->divideEqual(aaa);
+ return self;
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
+ self->divideEqual(aaa);
+ return self;
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
{
return self->intValue();
}
+
+ DataArrayInt *buildDAInt()
+ {
+ return self->buildDAInt(1,self->getNumberOfCompo());
+ }
PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
%extend ParaMEDMEM::DataArrayInt
{
+ static DataArrayInt *New(PyObject *elt0, PyObject *elt1=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
+ {
+ const char *msg="ParaMEDMEM::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n--DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2) !";
+ if(PyList_Check(elt0) || PyTuple_Check(elt0))
+ {
+ if(elt1)
+ {
+ if(PyInt_Check(elt1))
+ {
+ int nbOfTuples=PyInt_AS_LONG(elt1);
+ if(nbOfTuples<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
+ if(elt2)
+ {
+ if(PyInt_Check(elt2))
+ {//DataArrayInt.New([1,3,4,5],2,2)
+ int nbOfCompo=PyInt_AS_LONG(elt2);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ int *tmp=new int[nbOfTuples*nbOfCompo];
+ try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples*nbOfCompo,0,true); }
+ catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
+ ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,nbOfCompo);
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayInt.New([1,3,4],3)
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ int *tmp=new int[nbOfTuples];
+ try { fillArrayWithPyListInt(elt0,tmp,nbOfTuples,0,true); }
+ catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
+ ret->useArray(tmp,true,CPP_DEALLOC,nbOfTuples,1);
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {// DataArrayInt.New([1,3,4])
+ int szz=-1;
+ if(PyList_Check(elt0))
+ szz=PyList_Size(elt0);
+ else
+ szz=PyTuple_Size(elt0);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ int *tmp=new int[szz];
+ try { fillArrayWithPyListInt(elt0,tmp,szz,0,true); }
+ catch(INTERP_KERNEL::Exception& e) { delete [] tmp; throw e; }
+ ret->useArray(tmp,true,CPP_DEALLOC,szz,1);
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else if(PyInt_Check(elt0))
+ {
+ int nbOfTuples=PyInt_AS_LONG(elt0);
+ if(nbOfTuples<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
+ if(elt1)
+ {
+ if(!elt2)
+ {
+ if(PyInt_Check(elt1))
+ {//DataArrayInt.New(5,2)
+ int nbOfCompo=PyInt_AS_LONG(elt1);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ ret->alloc(nbOfTuples,nbOfCompo);
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayInt.New(5)
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ ret->alloc(nbOfTuples,1);
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+
std::string __str__() const
{
return self->repr();
int *tmp=new int[nbOfTuples*nbOfElsPerTuple];
try
{
- fillArrayWithPyListInt(li,tmp,nbOfTuples*nbOfElsPerTuple,0);
+ fillArrayWithPyListInt(li,tmp,nbOfTuples*nbOfElsPerTuple,0,false);
}
catch(INTERP_KERNEL::Exception& e)
{
return ret;
}
- DataArrayInt *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- const char msg[]="Unexpected situation in __getitem__ !";
+ const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
self->checkAllocated();
int nbOfTuples=self->getNumberOfTuples();
int nbOfComponents=self->getNumberOfComponents();
switch(sw)
{
case 1:
- return self->selectByTupleIdSafe(&it1,&it1+1);
+ {
+ if(nbOfComponents==1)
+ return PyInt_FromLong(self->getIJSafe(it1,0));
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ }
case 2:
- return self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
case 3:
- return self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
case 4:
- return self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
case 5:
- {
- ret=self->selectByTupleIdSafe(&it1,&it1+1);
- std::vector<int> v2(1,ic1);
- return ret->keepSelectedComponents(v2);
- }
+ return PyInt_FromLong(self->getIJSafe(it1,ic1));
case 6:
{
ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
std::vector<int> v2(1,ic1);
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 7:
{
ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
std::vector<int> v2(1,ic1);
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 8:
{
ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
std::vector<int> v2(1,ic1);
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 9:
{
ret=self->selectByTupleIdSafe(&it1,&it1+1);
- return ret->keepSelectedComponents(vc1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 10:
{
ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
- return ret->keepSelectedComponents(vc1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 11:
{
ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
- return ret->keepSelectedComponents(vc1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 12:
{
ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
- return ret->keepSelectedComponents(vc1);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 13:
{
std::vector<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 14:
{
std::vector<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 15:
{
std::vector<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
case 16:
{
std::vector<int> v2(nbOfComp);
for(int i=0;i<nbOfComp;i++)
v2[i]=pc1.first+i*pc1.second.second;
- return ret->keepSelectedComponents(v2);
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
default:
throw INTERP_KERNEL::Exception(msg);
int i1;
std::vector<int> v1;
DataArrayInt *d1=0;
- convertObjToPossibleCpp1(value,sw1,i1,v1,d1);
+ DataArrayIntTuple *dd1=0;
+ convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
int it1,ic1;
std::vector<int> vt1,vc1;
std::pair<int, std::pair<int,int> > pt1,pc1;
case 3:
self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
case 3:
self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
return self;
+ case 4:
+ tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
+ self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
+ return self;
default:
throw INTERP_KERNEL::Exception(msg);
}
return self;
}
+ DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->negate();
+ }
+
DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
const char msg[]="Unexpected situation in __add__ !";
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
{
return DataArrayInt::Add(self,a);
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Add(self,aaaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
ret->incrRef();
return ret;
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Add(self,aaaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
self->applyLin(1,val);
return self;
}
+ case 2:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ self->addEqual(bb);
+ return self;
+ }
case 3:
{
self->addEqual(a);
return self;
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->addEqual(aaaa);
+ return self;
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
{
return DataArrayInt::Substract(self,a);
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Substract(self,aaaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
ret->incrRef();
return ret;
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Substract(aaaa,self);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
self->applyLin(1,-val);
return self;
}
+ case 2:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ self->substractEqual(bb);
+ return self;
+ }
case 3:
{
self->substractEqual(a);
return self;
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->substractEqual(aaaa);
+ return self;
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
{
return DataArrayInt::Multiply(self,a);
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Multiply(self,aaaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
ret->incrRef();
return ret;
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Multiply(self,aaaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
self->applyLin(val,0);
return self;
}
+ case 2:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ self->multiplyEqual(bb);
+ return self;
+ }
case 3:
{
self->multiplyEqual(a);
return self;
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->multiplyEqual(aaaa);
+ return self;
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
{
return DataArrayInt::Divide(self,a);
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Divide(self,aaaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
ret->incrRef();
return ret;
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Divide(aaaa,self);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
self->applyDivideBy(val);
return self;
}
+ case 2:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
+ self->divideEqual(bb);
+ return self;
+ }
case 3:
{
self->divideEqual(a);
return self;
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->divideEqual(aaaa);
+ return self;
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
{
return DataArrayInt::Modulus(self,a);
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Modulus(self,aaaa);
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
}
case 3:
{
- return DataArrayInt::Modulus(self,a);
+ return DataArrayInt::Modulus(a,self);
+ }
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ return DataArrayInt::Modulus(aaaa,self);
}
default:
throw INTERP_KERNEL::Exception(msg);
int val;
DataArrayInt *a;
std::vector<int> aa;
+ DataArrayIntTuple *aaa;
int sw;
- convertObjToPossibleCpp1(obj,sw,val,aa,a);
+ convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
switch(sw)
{
case 1:
self->modulusEqual(a);
return self;
}
+ case 4:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
+ self->modulusEqual(aaaa);
+ return self;
+ }
default:
throw INTERP_KERNEL::Exception(msg);
}
void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble &operator=(double value) 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, 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);
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
expected1=[0,1]
self.assertEqual(2,arr1.getNumberOfTuples());
self.assertEqual(1,arr1.getNumberOfComponents());
- self.assertTrue(expected1,arr1.getValues());
+ self.assertEqual(expected1,arr1.getValues());
expected2=[0,3,4,1,2]
arr1=m2_1.rearrange2ConsecutiveCellTypes();
self.assertEqual(5,arr1.getNumberOfTuples());
targetMesh=MEDCouplingUMesh.New();
targetMesh.setMeshDimension(2);
targetMesh.allocateCells(1);
- targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
+ targetMesh.insertNextCell(NORM_QUAD4,targetConn[0:4])
targetMesh.finishInsertingCells();
myCoords=DataArrayDouble.New();
myCoords.setValues(targetCoords,4,3);
self.assertEqual(5,len(types));
expected1=[NORM_POLYGON, NORM_TRI3, NORM_QUAD4, NORM_TRI6, NORM_QUAD8]
expected1.sort()
- self.assertTrue(expected1==types);
+ self.assertEqual(expected1,types);
self.assertTrue(mesh.isPresenceOfQuadratic());
self.assertEqual(62,mesh.getMeshLength());
f1=mesh.getMeasureField(False);
self.assertEqual(3,len(types2));
expected2=[NORM_POLYGON, NORM_TRI3, NORM_QUAD4]
expected2.sort()
- self.assertTrue(expected2==types2);
+ self.assertEqual(expected2,types2);
pass
def testCheckGeoEquivalWith(self):
m2=MEDCouplingUMesh.New();
m2.setMeshDimension(2);
m2.allocateCells(1);
- m2.insertNextCell(NORM_QUAD4,4,targetConn[0:4])
+ m2.insertNextCell(NORM_QUAD4,targetConn[0:4])
m2.finishInsertingCells();
myCoords=DataArrayDouble.New();
myCoords.setValues(targetCoords,4,2);
#
tmpConn=[0,1,2,3,4,5,6,7]
mesh.allocateCells(3);
- mesh.insertNextCell(NORM_HEXA8,8,tmpConn[0:8])
+ self.assertRaises(InterpKernelException,mesh.insertNextCell,NORM_HEXA8,9,tmpConn[0:8])
+ mesh.insertNextCell(NORM_HEXA8,tmpConn[0:8])
mesh.insertNextCell(NORM_PENTA6,6,[i+8 for i in tmpConn])
mesh.insertNextCell(NORM_PYRA5,5,[i+14 for i in tmpConn])
mesh.finishInsertingCells();
da.setValues(discX,4,1);
m.setCoordsAt(0,da);
m.checkCoherency();
- self.assertEqual(0,m.getCellContainingPoint([2.4],12));
- self.assertEqual(1,m.getCellContainingPoint([3.7],12));
- self.assertEqual(2,m.getCellContainingPoint([5.9],12));
- self.assertEqual(-1,m.getCellContainingPoint([10.3],12));
- self.assertEqual(-1,m.getCellContainingPoint([1.3],12));
+ self.assertEqual(0,m.getCellContainingPoint([2.4],1e-12));
+ self.assertEqual(1,m.getCellContainingPoint([3.7],1e-12));
+ self.assertEqual(2,m.getCellContainingPoint([5.9],1e-12));
+ self.assertEqual(-1,m.getCellContainingPoint([10.3],1e-12));
+ self.assertEqual(-1,m.getCellContainingPoint([1.3],1e-12));
#
m2=m.buildUnstructured();
m2.checkCoherency();
self.assertTrue(tmp2);
self.assertEqual(37,tmp3);
i.convertDegeneratedCells();
- vec1=[10.,0.,0.]
+ vec1=[10.,0]
i.translate(vec1);
g2=h.applyFunc(3,"13.5/3.5*x*IVec+0*JVec+13.5/3.5*y*KVec");
f.setCoords(g2);
#
ms=[m1,m2_2,m3_2];
#
+ self.assertRaises(InterpKernelException,MEDCouplingUMesh.MergeUMeshes,ms+[None]);
+ self.assertRaises(InterpKernelException,MEDCouplingUMesh.MergeUMeshes,ms+[3.4])
m4=MEDCouplingUMesh.MergeUMeshes(ms);
m4.checkCoherency();
self.assertEqual(10,m4.getNumberOfCells());
self.assertEqual(20,m4.getNumberOfNodes());
self.assertEqual(45,m4.getMeshLength());
+ m4bis=MEDCouplingMesh.MergeMeshes(ms);
+ self.assertTrue(m4.isEqual(m4bis,1e-12))
+ del m4bis
#
vec3=[0,1,2,3,4]
m4_1=m4.buildPartOfMySelf(vec3,False);
self.assertEqual(10,ret.getNbOfElems());
self.assertEqual(7,newNbTuple);
self.assertEqual(1,ret.getNumberOfComponents());
- self.assertTrue(expected,ret.getValues());
+ self.assertEqual(expected,ret.getValues());
pass
def testDADIReverse1(self):
for i in xrange(6):
self.assertEqual(arr[5-i],a.getIJ(i,0));
pass
- a.setValues(arr,5,1);
+ a.setValues(arr[:-1],5,1);
a.reverse();
for i in xrange(5):
self.assertEqual(arr[4-i],a.getIJ(i,0));
pass
self.assertEqual(60,m12.getNodalConnectivity().getNumberOfTuples());
self.assertEqual(9,m12.getNodalConnectivityIndex().getNumberOfTuples());
- self.assertTrue(expected3,m12.getNodalConnectivity().getValues());
- self.assertTrue(expected4,m12.getNodalConnectivityIndex().getValues());
+ self.assertEqual(expected3,m12.getNodalConnectivity().getValues());
+ self.assertEqual(expected4,m12.getNodalConnectivityIndex().getValues());
pass
def testIntersect2DMeshesTmp4(self):
self.assertAlmostEqual(expected1[i],arr1.getIJ(0,i),14);
pass
pass
+
+ def testGetNodeIdsOfCell2(self):
+ m1c=MEDCouplingCMesh.New();
+ coordsX=DataArrayDouble.New();
+ arrX=[ -1., 1., 2., 4., 4.5 ]
+ coordsX.setValues(arrX,5,1);
+ coordsY=DataArrayDouble.New();
+ arrY=[ -2., 2., 4., 8.]
+ coordsY.setValues(arrY,4,1);
+ coordsZ=DataArrayDouble.New();
+ arrZ=[ -2., 2., 4.]
+ coordsZ.setValues(arrZ,3,1);
+ # test in 1D
+ m1c.setCoordsAt(0,coordsX);
+ expected1=[[0,1],[1,2],[2,3],[3,4]]
+ self.assertEqual(4,m1c.getNumberOfCells())
+ for i in xrange(m1c.getNumberOfCells()):
+ self.assertEqual(expected1[i],m1c.getNodeIdsOfCell(i))
+ pass
+ # test in 2D
+ m1c.setCoordsAt(1,coordsY);
+ self.assertEqual(12,m1c.getNumberOfCells())
+ expected2=[[0,1,6,5],[1,2,7,6],[2,3,8,7],[3,4,9,8],[4,5,11,10],[5,6,12,11],[6,7,13,12],[7,8,14,13],[8,9,16,15],[9,10,17,16],[10,11,18,17],[11,12,19,18]]
+ for i in xrange(m1c.getNumberOfCells()):
+ self.assertEqual(expected2[i],m1c.getNodeIdsOfCell(i))
+ pass
+ # test in 3D
+ m1c.setCoordsAt(2,coordsZ);
+ expected3=[[0,1,6,5,20,21,26,25],[1,2,7,6,21,22,27,26],[2,3,8,7,22,23,28,27],[3,4,9,8,23,24,29,28],[4,5,11,10,24,25,31,30],[5,6,12,11,25,26,32,31],[6,7,13,12,26,27,33,32],[7,8,14,13,27,28,34,33],[8,9,16,15,28,29,36,35],[9,10,17,16,29,30,37,36],[10,11,18,17,30,31,38,37],[11,12,19,18,31,32,39,38],[20,21,26,25,40,41,46,45],[21,22,27,26,41,42,47,46],[22,23,28,27,42,43,48,47],[23,24,29,28,43,44,49,48],[24,25,31,30,44,45,51,50],[25,26,32,31,45,46,52,51],[26,27,33,32,46,47,53,52],[27,28,34,33,47,48,54,53],[28,29,36,35,48,49,56,55],[29,30,37,36,49,50,57,56],[30,31,38,37,50,51,58,57],[31,32,39,38,51,52,59,58]]
+ self.assertEqual(24,m1c.getNumberOfCells())
+ for i in xrange(m1c.getNumberOfCells()):
+ self.assertEqual(expected3[i],m1c.getNodeIdsOfCell(i))
+ pass
+ pass
+
+ def testSwigDADOp4(self):
+ da=DataArrayDouble.New(range(6,30),12,2)
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),float(i+6),13)
+ pass
+ # operator transpose
+ da.transpose()
+ self.assertEqual(2,da.getNumberOfTuples());
+ self.assertEqual(12,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),float(i+6),13)
+ pass
+ da.transpose()
+ # operator __neg__
+ da2=DataArrayDouble.New(12,1)
+ da2.iota(0.)
+ dabis=-da
+ for i in xrange(24):
+ self.assertAlmostEqual(dabis.getIJ(0,i),-float(i+6),13)
+ pass
+ # operator+=
+ da+=da2
+ expected1=[6.,7.,9.,10.,12.,13.,15.,16.,18.,19.,21.,22.,24.,25.,27.,28.,30.,31.,33.,34.,36.,37.,39.,40.]
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected1[i],13)
+ pass
+ da=-dabis
+ da+=[100.,101.]
+ expected2=[106.,108.,108.,110.,110.,112.,112.,114.,114.,116.,116.,118.,118.,120.,120.,122.,122.,124.,124.,126.,126.,128.,128.,130.]
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected2[i],13)
+ pass
+ for pos,elt in enumerate(dabis):
+ da[pos]+=elt
+ pass
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for elt in da:
+ li=elt[:]
+ self.assertAlmostEqual(li[0],100.,13) ; self.assertAlmostEqual(li[1],101.,13)
+ pass
+ # operator-=
+ da=DataArrayDouble.New(range(6,30),12,2)
+ da2=DataArrayDouble.New(range(12),12,1)
+ dabis=-da
+ da-=da2
+ expected1=[6.,7.,7.,8.,8.,9.,9.,10.,10.,11.,11.,12.,12.,13.,13.,14.,14.,15.,15.,16.,16.,17.,17.,18.]
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected1[i],13)
+ pass
+ da=-dabis
+ da-=[100.,101.]
+ expected2=[-94.,-94.,-92.,-92.,-90.,-90.,-88.,-88.,-86.,-86.,-84.,-84.,-82.,-82.,-80.,-80.,-78.,-78.,-76.,-76.,-74.,-74.,-72.,-72.]
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected2[i],13)
+ pass
+ for pos,elt in enumerate(dabis):
+ da[pos]-=elt
+ pass
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ expected3=[-88.,-87.,-84.,-83.,-80.,-79.,-76.,-75.,-72.,-71.,-68.,-67.,-64.,-63.,-60.,-59.,-56.,-55.,-52.,-51.,-48.,-47.,-44.,-43.]
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected3[i],13)
+ pass
+ # operator*=
+ da=DataArrayDouble.New(range(6,30),12,2)
+ da2=DataArrayDouble.New(range(12),12,1)
+ dabis=-da
+ da*=da2
+ expected1=[0.,0.,8.,9.,20.,22.,36.,39.,56.,60.,80.,85.,108.,114.,140.,147.,176.,184.,216.,225.,260.,270.,308.,319.]
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected1[i],13)
+ pass
+ da=-dabis
+ da*=[100.,101.]
+ expected2=[600.,707.,800.,909.,1000.,1111.,1200.,1313.,1400.,1515.,1600.,1717.,1800.,1919.,2000.,2121.,2200.,2323.,2400.,2525.,2600.,2727.,2800.,2929.]
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected2[i],13)
+ pass
+ for pos,elt in enumerate(dabis):
+ da[pos]*=elt
+ pass
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ expected3=[-3600.,-4949.,-6400.,-8181.,-10000.,-12221.,-14400.,-17069.,-19600.,-22725.,-25600.,-29189.,-32400.,-36461.,-40000.,-44541.,-48400.,-53429.,-57600.,-63125.,-67600.,-73629.,-78400.,-84941.0]
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected3[i],13)
+ pass
+ # operator/=
+ da=DataArrayDouble.New(range(6,30),12,2)
+ da2=DataArrayDouble.New(range(1,13),12,1)
+ dabis=-da
+ da/=da2
+ expected1=[6.0,7.0,4.0,4.5,3.3333333333333335,3.6666666666666665,3.0,3.25,2.8,3.0,2.6666666666666665,2.8333333333333335,2.5714285714285716,2.7142857142857144,2.5,2.625,2.4444444444444446,2.5555555555555554,2.4,2.5,2.3636363636363638,2.4545454545454546,2.3333333333333335,2.4166666666666665]
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected1[i],13)
+ pass
+ da=-dabis
+ da/=[100.,101.]
+ expected2=[0.06,0.06930693069306931,0.08,0.0891089108910891,0.1,0.10891089108910891,0.12,0.12871287128712872,0.14,0.1485148514851485,0.16,0.16831683168316833,0.18,0.18811881188118812,0.2,0.2079207920792079,0.22,0.22772277227722773,0.24,0.24752475247524752,0.26,0.26732673267326734,0.28,0.2871287128712871]
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected2[i],13)
+ pass
+ for pos,elt in enumerate(dabis):
+ da[pos]/=elt
+ pass
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ expected3=[-0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.009900990099009901, -0.01, -0.0099009900990099]
+ for i in xrange(24):
+ self.assertAlmostEqual(da.getIJ(0,i),expected3[i],13)
+ pass
+ pass
+
+ def testSwigDAIOp4(self):
+ da=DataArrayInt.New(range(6,30),12,2)
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),i+6)
+ pass
+ # operator transpose
+ da.transpose()
+ self.assertEqual(2,da.getNumberOfTuples());
+ self.assertEqual(12,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),i+6)
+ pass
+ da.transpose()
+ # operator __neg__
+ da2=DataArrayInt.New(12,1)
+ da2.iota(0)
+ dabis=-da
+ for i in xrange(24):
+ self.assertEqual(dabis.getIJ(0,i),-(i+6))
+ pass
+ # operator+=
+ da+=da2
+ expected1=[6,7,9,10,12,13,15,16,18,19,21,22,24,25,27,28,30,31,33,34,36,37,39,40]
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected1[i])
+ pass
+ da=-dabis
+ da+=[100,101]
+ expected2=[106,108,108,110,110,112,112,114,114,116,116,118,118,120,120,122,122,124,124,126,126,128,128,130]
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected2[i])
+ pass
+ for pos,elt in enumerate(dabis):
+ da[pos]+=elt
+ pass
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for elt in da:
+ li=elt[:]
+ self.assertEqual(li[0],100) ; self.assertEqual(li[1],101)
+ pass
+ # operator-=
+ da=DataArrayInt.New(range(6,30),12,2)
+ da2=DataArrayInt.New(range(12),12,1)
+ dabis=-da
+ da-=da2
+ expected1=[6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18]
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected1[i])
+ pass
+ da=-dabis
+ da-=[100,101]
+ expected2=[-94,-94,-92,-92,-90,-90,-88,-88,-86,-86,-84,-84,-82,-82,-80,-80,-78,-78,-76,-76,-74,-74,-72,-72]
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected2[i])
+ pass
+ for pos,elt in enumerate(dabis):
+ da[pos]-=elt
+ pass
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ expected3=[-88,-87,-84,-83,-80,-79,-76,-75,-72,-71,-68,-67,-64,-63,-60,-59,-56,-55,-52,-51,-48,-47,-44,-43]
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected3[i])
+ pass
+ # operator*=
+ da=DataArrayInt.New(range(6,30),12,2)
+ da2=DataArrayInt.New(range(12),12,1)
+ dabis=-da
+ da*=da2
+ expected1=[0,0,8,9,20,22,36,39,56,60,80,85,108,114,140,147,176,184,216,225,260,270,308,319]
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected1[i])
+ pass
+ da=-dabis
+ da*=[100,101]
+ expected2=[600,707,800,909,1000,1111,1200,1313,1400,1515,1600,1717,1800,1919,2000,2121,2200,2323,2400,2525,2600,2727,2800,2929]
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected2[i])
+ pass
+ for pos,elt in enumerate(dabis):
+ da[pos]*=elt
+ pass
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ expected3=[-3600,-4949,-6400,-8181,-10000,-12221,-14400,-17069,-19600,-22725,-25600,-29189,-32400,-36461,-40000,-44541,-48400,-53429,-57600,-63125,-67600,-73629,-78400,-84941.0]
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected3[i])
+ pass
+ # operator/=
+ da=DataArrayInt.New(range(6,30),12,2)
+ da2=DataArrayInt.New(range(1,13),12,1)
+ dabis=-da
+ da/=da2
+ expected1=[6,7,4,4,3,3,3,3,2,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected1[i])
+ pass
+ da=-dabis
+ da/=DataArrayInt.New([2,3],1,2)
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ expected2=[3,2,4,3,5,3,6,4,7,5,8,5,9,6,10,7,11,7,12,8,13,9,14,9]
+ for i in xrange(24):
+ self.assertEqual(da.getIJ(0,i),expected2[i])
+ pass
+ pass
+
+ def testSwigDADOp5(self):
+ da=DataArrayDouble.New([5,6,7,8,9,6,7,-2,3,9,8,10])
+ da.rearrange(3)
+ da2=DataArrayDouble.New([5.,8.,10.,12])
+ self.assertEqual(4,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ da3=da+da2
+ self.assertEqual(4,da3.getNumberOfTuples());
+ self.assertEqual(3,da3.getNumberOfComponents());
+ expected1=[10.,11.,12.,16.,17.,14.,17.,8.,13.,21.,20.,22.]
+ for i in xrange(12):
+ self.assertAlmostEqual(da3.getIJ(0,i),expected1[i],13)
+ pass
+ da3=da2+da
+ self.assertEqual(4,da3.getNumberOfTuples());
+ self.assertEqual(3,da3.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertAlmostEqual(da3.getIJ(0,i),expected1[i],13)
+ pass
+ # Test new API of classmethod DataArrayDouble.New
+ vals=[5,6,7,8,9,6,7,-2,3,9,8,10]
+ da=DataArrayDouble.New(vals)
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(1,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
+ pass
+ da=DataArrayDouble.New(vals,12)
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(1,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
+ pass
+ da=DataArrayDouble.New(vals,1,12)
+ self.assertEqual(1,da.getNumberOfTuples());
+ self.assertEqual(12,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
+ pass
+ da=DataArrayDouble.New(vals,6,2)
+ self.assertEqual(6,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
+ pass
+ da=DataArrayDouble.New(vals,4,3)
+ self.assertEqual(4,da.getNumberOfTuples());
+ self.assertEqual(3,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertAlmostEqual(da.getIJ(0,i),vals[i],13)
+ pass
+ self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,11);
+ self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,13);
+ self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,5,2);
+ self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,7,2);
+ pass
+
+ def testSwigDADOp6(self):
+ da=DataArrayInt.New([5,6,7,8,9,6,7,-2,3,9,8,10])
+ da.rearrange(3)
+ da2=DataArrayInt.New([5,8,10,12])
+ self.assertEqual(4,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ da3=da+da2
+ self.assertEqual(4,da3.getNumberOfTuples());
+ self.assertEqual(3,da3.getNumberOfComponents());
+ expected1=[10,11,12,16,17,14,17,8,13,21,20,22]
+ for i in xrange(12):
+ self.assertEqual(da3.getIJ(0,i),expected1[i])
+ pass
+ da3=da2+da
+ self.assertEqual(4,da3.getNumberOfTuples());
+ self.assertEqual(3,da3.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(da3.getIJ(0,i),expected1[i])
+ pass
+ da3=da+DataArrayInt.New(da2.getValues())
+ # Test new API of classmethod DataArrayInt.New
+ vals=[5,6,7,8,9,6,7,-2,3,9,8,10]
+ da=DataArrayDouble.New(vals)
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(1,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(da.getIJ(0,i),vals[i])
+ pass
+ da=DataArrayDouble.New(vals,12)
+ self.assertEqual(12,da.getNumberOfTuples());
+ self.assertEqual(1,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(da.getIJ(0,i),vals[i])
+ pass
+ da=DataArrayDouble.New(vals,1,12)
+ self.assertEqual(1,da.getNumberOfTuples());
+ self.assertEqual(12,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(da.getIJ(0,i),vals[i])
+ pass
+ da=DataArrayDouble.New(vals,6,2)
+ self.assertEqual(6,da.getNumberOfTuples());
+ self.assertEqual(2,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(da.getIJ(0,i),vals[i])
+ pass
+ da=DataArrayDouble.New(vals,4,3)
+ self.assertEqual(4,da.getNumberOfTuples());
+ self.assertEqual(3,da.getNumberOfComponents());
+ for i in xrange(12):
+ self.assertEqual(da.getIJ(0,i),vals[i])
+ pass
+ self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,11);
+ self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,13);
+ self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,5,2);
+ self.assertRaises(InterpKernelException,DataArrayDouble.New,vals,7,2);
+ pass
+
+ def testRenumberNodesInConn1(self):
+ mesh2DCoords=[-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. ]
+ mesh2DConn=[1,4,2, 4,5,2, 0,3,4,1, 6,7,4,3, 7,8,5,4]
+ mesh2D=MEDCouplingUMesh.New("mesh",2);
+ mesh2D.allocateCells(5);
+ mesh2D.insertNextCell(NORM_TRI3,3,mesh2DConn[0:3])
+ mesh2D.insertNextCell(NORM_TRI3,3,mesh2DConn[3:6])
+ mesh2D.insertNextCell(NORM_QUAD4,4,mesh2DConn[6:10])
+ mesh2D.insertNextCell(NORM_QUAD4,4,mesh2DConn[10:14])
+ mesh2D.insertNextCell(NORM_QUAD4,4,mesh2DConn[14:18])
+ mesh2D.finishInsertingCells();
+ myCoords=DataArrayDouble.New(mesh2DCoords,9,3);
+ mesh2D.setCoords(myCoords);
+ mesh2D.checkCoherency();
+ #
+ mesh3DCoords=[-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1. ]
+ mesh3DConn=[0,1,2,3,4,5,6,7]
+ mesh3D=MEDCouplingUMesh.New("mesh",3);
+ mesh3D.allocateCells(1);
+ mesh3D.insertNextCell(NORM_HEXA8,8,mesh3DConn[:])
+ mesh3D.finishInsertingCells();
+ myCoords3D=DataArrayDouble.New(mesh3DCoords,8,3);
+ mesh3D.setCoords(myCoords3D);
+ mesh3D.checkCoherency();
+ #
+ mesh3D_2=mesh3D.deepCpy();
+ mesh2D_2=mesh2D.deepCpy();
+ mesh3D_4=mesh3D.deepCpy();
+ mesh2D_4=mesh2D.deepCpy();
+ oldNbOf3DNodes=mesh3D.getNumberOfNodes();
+ renumNodes=DataArrayInt.New();
+ renumNodes.alloc(mesh2D.getNumberOfNodes(),1);
+ renumNodes.iota(oldNbOf3DNodes);
+ coo=DataArrayDouble.Aggregate(mesh3D.getCoords(),mesh2D.getCoords());
+ mesh3D.setCoords(coo);
+ mesh2D.setCoords(coo);
+ mesh2DCpy=mesh2D.deepCpy()
+ mesh2D_3=mesh2D.deepCpy();
+ mesh2D_3.shiftNodeNumbersInConn(oldNbOf3DNodes);
+ mesh2D.renumberNodesInConn(renumNodes);
+ mesh2DCpy.renumberNodesInConn(renumNodes.getValues());
+ self.assertTrue(mesh2D.isEqual(mesh2DCpy,1e-12))
+ self.assertTrue(mesh2D.isEqual(mesh2D_3,1e-12))
+ #
+ da1,da2=mesh3D.checkGeoEquivalWith(mesh3D_2,10,1e-12);
+ self.assertTrue(da1==None);
+ self.assertEqual(8,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ expected1=[8,11,12,9,4,5,6,7]
+ for i in xrange(8):
+ self.assertEqual(expected1[i],da2.getIJ(i,0));
+ pass
+ #
+ da1,da2=mesh2D.checkGeoEquivalWith(mesh2D_2,10,1e-12);
+ self.assertTrue(da1==None);
+ self.assertEqual(9,da2.getNumberOfTuples());
+ self.assertEqual(1,da2.getNumberOfComponents());
+ for i in xrange(9):
+ self.assertEqual(8+i,da2.getIJ(i,0));
+ pass
+ #
+ mesh2D_5=mesh2D_4.deepCpy();
+ mesh2D_5.translate([1.,0.,0.]);
+ meshes=[mesh3D_4,mesh2D_4,mesh2D_5];
+ MEDCouplingUMesh.PutUMeshesOnSameAggregatedCoords(meshes);
+ self.assertTrue(mesh3D_4.getCoords().getHiddenCppPointer()==mesh2D_4.getCoords().getHiddenCppPointer());
+ self.assertTrue(mesh2D_4.getCoords().getHiddenCppPointer()==mesh2D_5.getCoords().getHiddenCppPointer());
+ mesh3D_4.checkCoherency(); mesh2D_4.checkCoherency(); mesh2D_5.checkCoherency();
+ self.assertEqual(26,mesh3D_4.getNumberOfNodes());
+ self.assertEqual(3,mesh3D_4.getSpaceDimension());
+ self.assertEqual(9,mesh3D_4.getNodalConnectivity().getNumberOfTuples());
+ self.assertEqual(23,mesh2D_4.getNodalConnectivity().getNumberOfTuples());
+ self.assertEqual(23,mesh2D_5.getNodalConnectivity().getNumberOfTuples());
+ expected2=[18,0,1,2,3,4,5,6,7]
+ expected3=[3,9,12,10, 3,12,13,10, 4,8,11,12,9, 4,14,15,12,11, 4,15,16,13,12]
+ expected4=[3,18,21,19, 3,21,22,19, 4,17,20,21,18, 4,23,24,21,20, 4,24,25,22,21]
+ expected5=[-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1., -0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0., 0.7, -0.3, 0.0, 1.2, -0.3, 0.0, 1.7, -0.3, 0.0, 0.7, 0.2, 0.0, 1.2, 0.2, 0.0, 1.7, 0.2, 0.0, 0.7, 0.7, 0.0, 1.2, 0.7, 0.0, 1.7, 0.7, 0.0]
+ self.assertEqual(expected2,mesh3D_4.getNodalConnectivity().getValues());
+ self.assertEqual(expected3,mesh2D_4.getNodalConnectivity().getValues());
+ self.assertEqual(expected4,mesh2D_5.getNodalConnectivity().getValues());
+ for i in xrange(78):
+ self.assertAlmostEqual(expected5[i],mesh3D_4.getCoords().getIJ(0,i),12);
+ pass
+ #
+ MEDCouplingUMesh.MergeNodesOnUMeshesSharingSameCoords(meshes,1e-12);
+ mesh3D_4.checkCoherency(); mesh2D_4.checkCoherency(); mesh2D_5.checkCoherency();
+ self.assertTrue(mesh3D_4.getCoords().getHiddenCppPointer()==mesh2D_4.getCoords().getHiddenCppPointer());
+ self.assertTrue(mesh2D_4.getCoords().getHiddenCppPointer()==mesh2D_5.getCoords().getHiddenCppPointer());
+ self.assertEqual(19,mesh3D_4.getNumberOfNodes());
+ self.assertEqual(3,mesh3D_4.getSpaceDimension());
+ self.assertEqual(9,mesh3D_4.getNodalConnectivity().getNumberOfTuples());
+ self.assertEqual(23,mesh2D_4.getNodalConnectivity().getNumberOfTuples());
+ self.assertEqual(23,mesh2D_5.getNodalConnectivity().getNumberOfTuples());
+ expected6=[18,0,1,2,3,4,5,6,7]
+ expected7=[3,3,2,8, 3,2,9,8, 4,0,1,2,3, 4,10,11,2,1, 4,11,12,9,2]
+ expected8=[3,13,15,14, 3,15,16,14, 4,8,9,15,13, 4,12,17,15,9, 4,17,18,16,15]
+ expected9=[-0.3, -0.3, 0., -0.3, 0.2, 0., 0.2, 0.2, 0., 0.2, -0.3, 0., -0.3, -0.3, 1., -0.3, 0.2, 1.,
+ 0.2, 0.2, 1., 0.2, -0.3, 1., 0.7, -0.3, 0., 0.7, 0.2, 0., -0.3, 0.7, 0., 0.2, 0.7, 0.,
+ 0.7, 0.7, 0., 1.2, -0.3, 0., 1.7, -0.3, 0., 1.2, 0.2, 0., 1.7, 0.2, 0., 1.2, 0.7, 0., 1.7, 0.7, 0.]
+ self.assertEqual(expected6,mesh3D_4.getNodalConnectivity().getValues());
+ self.assertEqual(expected7,mesh2D_4.getNodalConnectivity().getValues());
+ self.assertEqual(expected8,mesh2D_5.getNodalConnectivity().getValues());
+ for i in xrange(57):
+ self.assertAlmostEqual(expected9[i],mesh3D_4.getCoords().getIJ(0,i),1e-12);
+ pass
+ #
+ pass
+
+ def testComputeNeighborsOfCells1(self):
+ m=MEDCouplingDataForTest.build2DTargetMesh_1();
+ d1,d2=m.computeNeighborsOfCells();
+ self.assertEqual(6,d2.getNumberOfTuples());
+ self.assertEqual(10,d1.getNumberOfTuples());
+ expected1=[0,2,4,6,8,10]
+ expected2=[3,1,0,2,4,1,4,0,2,3]
+ self.assertEqual(expected1,d2.getValues());
+ self.assertEqual(expected2,d1.getValues());
+ pass
+
+ def testCheckButterflyCellsBug1(self):
+ mesh2DCoords=[323.85,120.983748908684,317.5,131.982271536747,336.55,120.983748908686,330.2,131.982271536751,323.85,142.98079416481]
+ mesh2DConn=[4,1,0,2,3]
+ mesh2D=MEDCouplingUMesh.New("mesh",2);
+ mesh2D.allocateCells(1);
+ mesh2D.insertNextCell(NORM_POLYGON,5,mesh2DConn[0:5])
+ mesh2D.finishInsertingCells();
+ myCoords=DataArrayDouble.New(mesh2DCoords,5,2);
+ mesh2D.setCoords(myCoords);
+ mesh2D.checkCoherency();
+ #
+ v=mesh2D.checkButterflyCells();
+ self.assertTrue(v.empty());
+ pass
+
+ def testDataArrayIntRange1(self):
+ d=DataArrayInt.Range(2,17,7);
+ expected1=[2,9,16]
+ self.assertEqual(3,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ self.assertEqual(expected1,d.getValues());
+ #
+ d=DataArrayInt.Range(2,23,7);
+ self.assertEqual(3,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ self.assertEqual(expected1,d.getValues());
+ #
+ d=DataArrayInt.Range(2,24,7);
+ expected2=[2,9,16,23]
+ self.assertEqual(4,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ self.assertEqual(expected2,d.getValues());
+ #
+ d=DataArrayInt.Range(24,2,-7);
+ expected3=[24,17,10,3]
+ self.assertEqual(4,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ self.assertEqual(expected3,d.getValues());
+ #
+ d=DataArrayInt.Range(23,2,-7);
+ expected4=[23,16,9]
+ self.assertEqual(3,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ self.assertEqual(expected4,d.getValues());
+ #
+ d=DataArrayInt.Range(23,22,-7);
+ self.assertEqual(1,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ self.assertEqual(23,d.getIJ(0,0));
+ #
+ d=DataArrayInt.Range(22,23,7);
+ self.assertEqual(1,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ self.assertEqual(22,d.getIJ(0,0));
+ #
+ d=DataArrayInt.Range(22,22,7);
+ self.assertEqual(0,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ #
+ d=DataArrayInt.Range(22,22,-7);
+ self.assertEqual(0,d.getNumberOfTuples());
+ self.assertEqual(1,d.getNumberOfComponents());
+ #
+ self.assertRaises(InterpKernelException,DataArrayInt.Range,22,23,-7);
+ self.assertRaises(InterpKernelException,DataArrayInt.Range,23,22,7);
+ self.assertRaises(InterpKernelException,DataArrayInt.Range,23,22,0);
+ self.assertRaises(InterpKernelException,DataArrayInt.Range,22,23,0);
+ pass
+
+ def testSwigUMeshGetItem1(self):
+ m=MEDCouplingDataForTest.build2DTargetMesh_1();
+ subMesh=m.buildPartOfMySelf([1,3],True);
+ self.assertTrue(isinstance(subMesh,MEDCouplingUMesh))
+ m1=m[[1,3]]
+ self.assertTrue(isinstance(m1,MEDCouplingUMesh))
+ m2=m[(1,3)]
+ self.assertTrue(isinstance(m2,MEDCouplingUMesh))
+ m3=m[1::2]
+ self.assertTrue(isinstance(m3,MEDCouplingUMesh))
+ m4=m[DataArrayInt.New([1,3])]
+ m5_1=m[1]
+ self.assertTrue(isinstance(m5_1,MEDCouplingUMesh))
+ m5_2=m[3]
+ self.assertTrue(isinstance(m5_2,MEDCouplingUMesh))
+ m5=MEDCouplingUMesh.MergeUMeshesOnSameCoords([m5_1,m5_2]);
+ m5.setName(subMesh.getName())
+ self.assertTrue(isinstance(m4,MEDCouplingUMesh))
+ self.assertTrue(subMesh.isEqual(m1,1e-12))
+ self.assertTrue(subMesh.isEqual(m2,1e-12))
+ self.assertTrue(subMesh.isEqual(m3,1e-12))
+ self.assertTrue(subMesh.isEqual(m4,1e-12))
+ self.assertTrue(subMesh.isEqual(m5,1e-12))
+ self.assertRaises(InterpKernelException,m.buildPartOfMySelf,[1,5],True);
+ pass
+ def testSwigGetItem3(self):
+ da=DataArrayInt.New([4,5,6])
+ self.assertEqual(5,da[1])
+ self.assertRaises(InterpKernelException,da.__getitem__,-1)
+ self.assertRaises(InterpKernelException,da.__getitem__,3)
+ da=DataArrayInt.New([4,5,6,7,8,9],2,3)
+ self.assertEqual(9,da[1,2])
+ da=DataArrayDouble.New([4.1,5.2,6.3])
+ self.assertAlmostEqual(5.2,da[1],12)
+ self.assertRaises(InterpKernelException,da.__getitem__,-1)
+ self.assertRaises(InterpKernelException,da.__getitem__,3)
+ da=DataArrayDouble.New([4.12,5.12,6.12,7.12,8.12,9.12],2,3)
+ self.assertAlmostEqual(9.12,da[1,2],12)
+ pass
+
+ def testSwigDADISub1(self):
+ mesh3D,mesh2D=MEDCouplingDataForTest.build3DExtrudedUMesh_1();
+ bary=mesh3D.getBarycenterAndOwner()
+ bary=bary[:,:2]
+ pts=bary.getDifferentValues(1e-12)
+ expected=[[0,6,12],[1,7,13],[2,8,14],[3,9,15],[4,10,16],[5,11,17]]
+ for pos,pt in enumerate(pts):
+ bary2=bary[:,:2]
+ bary2[:]-=pt
+ norm=bary2.magnitude()
+ self.assertEqual(expected[pos],norm.getIdsInRange(-1.,1e-5).getValues())
+ pass
+ expected2=[[3.,54.],[-141.,180.],[21.,54.],[39.,72.],[-15.,90.],[21.,90.]]
+ for pos,pt in enumerate(pts):
+ bary2=bary[:,:2]
+ bary2[:]+=pt
+ self.assertAlmostEqual(expected2[pos][0],bary2.accumulate()[0],12);
+ self.assertAlmostEqual(expected2[pos][1],bary2.accumulate()[1],12);
+ pass
+ expected3=[[-3.,22.5],[45.,337.5],[-9., 22.5],[-15.,67.5],[3.,112.5],[-9.,112.5]]
+ for pos,pt in enumerate(pts):
+ bary2=bary[:,:2]
+ bary2[:]*=pt
+ self.assertAlmostEqual(expected3[pos][0],bary2.accumulate()[0],12);
+ self.assertAlmostEqual(expected3[pos][1],bary2.accumulate()[1],12);
+ pass
+ expected4=[[-12.,90.],[0.8,6.],[-4,90.],[-2.4,30.],[12.,18],[-4,18.]]
+ for pos,pt in enumerate(pts):
+ bary2=bary[:,:2]
+ bary2[:]/=pt
+ self.assertAlmostEqual(expected4[pos][0],bary2.accumulate()[0],12);
+ self.assertAlmostEqual(expected4[pos][1],bary2.accumulate()[1],12);
+ pass
+ #
+ d=DataArrayInt.New([1,2,0,1,0,2],3,2)
+ e=DataArrayInt.New([1,11,101,2,12,102,3,13,103,4,14,104],4,3)
+ expected5=[[1,11,101,77,77,77,77,77,77,4,14,104],[77,77,77,77,77,77,3,13,103,4,14,104],[77,77,77,2,12,102,77,77,77,4,14,104]]
+ expected6=[[1,77,77,2,77,77,3,77,77,4,77,77],[77,77,101,77,77,102,77,77,103,77,77,104],[77,11,77,77,12,77,77,13,77,77,14,77]]
+ for pos,tup in enumerate(d):
+ f=e[:]
+ self.assertTrue(isinstance(f,DataArrayInt))
+ f[tup]=77
+ self.assertEqual(expected5[pos],f.getValues())
+ self.assertEqual(6*[77],f[tup].getValues())
+ f=e[:]
+ f[:,tup]=77
+ self.assertEqual(expected6[pos],f.getValues())
+ self.assertEqual(8*[77],f[:,tup].getValues())
+ pass
+ #
+ e=e.convertToDblArr()
+ for pos,tup in enumerate(d):
+ f=e[:]
+ self.assertTrue(isinstance(f,DataArrayDouble))
+ f[tup]=77.
+ self.assertEqual(expected5[pos],f.convertToIntArr().getValues())
+ self.assertEqual(6*[77],f[tup].convertToIntArr().getValues())
+ f=e[:]
+ f[:,tup]=77.
+ self.assertEqual(expected6[pos],f.convertToIntArr().getValues())
+ self.assertEqual(8*[77],f[:,tup].convertToIntArr().getValues())
+ pass
+ pass
+
+ def testDataArrayDoubleGetMinMaxPerComponent1(self):
+ values1=[1.,2.,3.,-0.9,2.1,3.,1.3,1.7,3.,1.,1.8,3.]
+ d1=DataArrayDouble.New();
+ self.assertRaises(InterpKernelException,d1.getMinMaxPerComponent)
+ d1=DataArrayDouble.New(values1,4,3);
+ res=d1.getMinMaxPerComponent();
+ self.assertTrue(isinstance(res,list))
+ self.assertEqual(3,len(res))
+ for i in xrange(3):
+ self.assertTrue(isinstance(res[i],tuple))
+ self.assertEqual(2,len(res[i]))
+ pass
+ expected1=[-0.9,1.3,1.7,2.1,3.,3.]
+ for i in xrange(6):
+ self.assertAlmostEqual(expected1[i],res[i/2][i%2],14)
+ pass
+ #
+ d1.rearrange(2);
+ res=d1.getMinMaxPerComponent();
+ self.assertTrue(isinstance(res,list))
+ self.assertEqual(2,len(res))
+ for i in xrange(2):
+ self.assertTrue(isinstance(res[i],tuple))
+ self.assertEqual(2,len(res[i]))
+ pass
+ expected2=[1.,3.,-0.9,3.]
+ for i in xrange(4):
+ self.assertAlmostEqual(expected2[i],res[i/2][i%2],14)
+ pass
+ #
+ d1.rearrange(1);
+ res=d1.getMinMaxPerComponent();
+ self.assertTrue(isinstance(res,list))
+ self.assertEqual(1,len(res))
+ for i in xrange(1):
+ self.assertTrue(isinstance(res[i],tuple))
+ self.assertEqual(2,len(res[i]))
+ pass
+ expected3=[-0.9,3.]
+ for i in xrange(2):
+ self.assertAlmostEqual(expected3[i],res[i/2][i%2],14)
+ pass
+ pass
+
+ def testDataArrayIntGetHashCode1(self):
+ d1=DataArrayInt.New(range(3545))
+ d2=DataArrayInt.New(range(3545))
+ self.assertEqual(d2.getHashCode(),d1.getHashCode())
+ self.assertEqual(232341068,d1.getHashCode())
+ d1[886]=6
+ self.assertEqual(232340188,d1.getHashCode())
+ pass
+
+ def testZipConnectivityPol1(self):
+ m1=MEDCouplingDataForTest.build2DTargetMesh_1();
+ cells1=[2,3,4]
+ m2_1=m1.buildPartOfMySelf(cells1,True);
+ m2=m2_1
+ self.assertTrue(isinstance(m2,MEDCouplingUMesh))
+ # no permutation policy 0
+ isOk,arr=m1.areCellsIncludedIn(m2,0)
+ self.assertTrue(isOk);
+ self.assertEqual(3,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells1,arr.getValues())
+ # no permutation policy 1
+ isOk,arr=m1.areCellsIncludedIn(m2,1)
+ self.assertTrue(isOk);
+ self.assertEqual(3,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells1,arr.getValues())
+ # no permutation policy 2
+ isOk,arr=m1.areCellsIncludedIn(m2,2)
+ self.assertTrue(isOk);
+ self.assertEqual(3,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells1,arr.getValues())
+ # some modification into m2
+ modif1=[2,4,5]
+ m2.getNodalConnectivity()[1:4]=modif1
+ #policy 0 fails because cell0 in m2 has same orientation be not same connectivity
+ expected1=[5,3,4]
+ isOk,arr=m1.areCellsIncludedIn(m2,0)
+ self.assertTrue(not isOk);
+ self.assertEqual(3,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(expected1,arr.getValues())
+ #policy 1 succeeds because cell0 in m2 has not exactly the same conn
+ isOk,arr=m1.areCellsIncludedIn(m2,1)
+ self.assertTrue(isOk);
+ self.assertEqual(3,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells1,arr.getValues())
+ #policy 2 succeeds because cell0 in m2 has same nodes in connectivity
+ isOk,arr=m1.areCellsIncludedIn(m2,2)
+ self.assertTrue(isOk);
+ self.assertEqual(3,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells1,arr.getValues())
+ #some new modification into m2
+ modif2=[2,5,4]
+ m2.getNodalConnectivity()[1:4]=modif2
+ #policy 0 fails because cell0 in m2 has not exactly the same conn
+ isOk,arr=m1.areCellsIncludedIn(m2,0)
+ self.assertTrue(not isOk);
+ self.assertEqual(3,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(expected1,arr.getValues())
+ #policy 1 fails too because cell0 in m2 has not same orientation
+ isOk,arr=m1.areCellsIncludedIn(m2,1)
+ self.assertTrue(not isOk);
+ self.assertEqual(3,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(expected1,arr.getValues())
+ #policy 2 succeeds because cell0 in m2 has same nodes in connectivity
+ isOk,arr=m1.areCellsIncludedIn(m2,2)
+ self.assertTrue(isOk);
+ self.assertEqual(3,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells1,arr.getValues())
+ # Now 1D
+ cells2=[3,2]
+ m1=MEDCouplingDataForTest.build1DSourceMesh_2();
+ m2_1=m1.buildPartOfMySelf(cells2,True);
+ m2=m2_1
+ self.assertTrue(isinstance(m2,MEDCouplingUMesh))
+ # no permutation policy 0
+ isOk,arr=m1.areCellsIncludedIn(m2,0)
+ self.assertTrue(isOk);
+ self.assertEqual(2,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells2,arr.getValues())
+ # no permutation policy 1
+ isOk,arr=m1.areCellsIncludedIn(m2,1)
+ self.assertTrue(isOk);
+ self.assertEqual(2,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells2,arr.getValues())
+ # no permutation policy 2
+ isOk,arr=m1.areCellsIncludedIn(m2,2)
+ self.assertTrue(isOk);
+ self.assertEqual(2,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells2,arr.getValues())
+ # some modification into m2
+ modif3=[4,3]
+ m2.getNodalConnectivity()[1:3]=modif3
+ #policy 0 fails because cell0 in m2 has not exactly the same conn
+ expected2=[4,2]
+ isOk,arr=m1.areCellsIncludedIn(m2,0)
+ self.assertTrue(not isOk);
+ self.assertEqual(2,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(expected2,arr.getValues())
+ #policy 1 fails too because cell0 in m2 has not same orientation
+ isOk,arr=m1.areCellsIncludedIn(m2,1)
+ self.assertTrue(not isOk);
+ self.assertEqual(2,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(expected2,arr.getValues())
+ #policy 2 succeeds because cell0 in m2 has same nodes in connectivity
+ isOk,arr=m1.areCellsIncludedIn(m2,2)
+ self.assertTrue(isOk);
+ self.assertEqual(2,arr.getNumberOfTuples());
+ self.assertEqual(1,arr.getNumberOfComponents());
+ self.assertEqual(cells2,arr.getValues())
+ pass
+
def setUp(self):
pass
pass
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
myCoords.setValues(targetCoords,9,2);
targetMesh.setCoords(myCoords);
return targetMesh;
+
+ def build1DSourceMesh_2(cls):
+ ret=MEDCouplingUMesh.New("1DSourceMesh",1);
+ ret.allocateCells(4);
+ conn=[0,1,2,3,1,2,3,4]
+ for i in xrange(4):
+ ret.insertNextCell(NORM_SEG2,2,conn[2*i:2*i+2]);
+ pass
+ ret.finishInsertingCells();
+ myCoords=DataArrayDouble.New([0.3,0.7,0.9,1.0,1.12],5,1);
+ ret.setCoords(myCoords);
+ return ret
def build1DTargetMesh_3(cls):
ret=MEDCouplingUMesh.New("1DMesh_3",1);
build3DTargetMeshMergeNode_1=classmethod(build3DTargetMeshMergeNode_1)
build2DTargetMeshMerged_1=classmethod(build2DTargetMeshMerged_1)
build2DTargetMesh_2=classmethod(build2DTargetMesh_2)
+ build1DSourceMesh_2=classmethod(build1DSourceMesh_2)
build1DTargetMesh_3=classmethod(build1DTargetMesh_3)
build2DCurveTargetMesh_3=classmethod(build2DCurveTargetMesh_3)
build2DTargetMesh_3=classmethod(build2DTargetMesh_3)
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception);
int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception);
void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
+ void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField) throw(INTERP_KERNEL::Exception);
void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue) throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
self.assertAlmostEqual(valuesExpected[i0],values[i0],12);
pass
pass
+
+ def testPartialTransfer1(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=MEDCouplingFieldDouble.New(ON_CELLS);
+ trgfield.setNature(ConservativeVolumic);
+ trgfield.setMesh(targetMesh);
+ array=DataArrayDouble.New();
+ ptr=targetMesh.getNumberOfCells()*[None]
+ for i in xrange(targetMesh.getNumberOfCells()):
+ ptr[i]=4.220173;
+ pass
+ array.setValues(ptr,targetMesh.getNumberOfCells(),1);
+ trgfield.setArray(array);
+ remapper.partialTransfer(srcField,trgfield);
+ 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]
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
}
}
-static void fillArrayWithPyListInt(PyObject *pyLi, int *arrToFill, int sizeOfArray, int dftVal) throw(INTERP_KERNEL::Exception)
+static void fillArrayWithPyListInt(PyObject *pyLi, int *arrToFill, int sizeOfArray, int dftVal, bool chckSize) throw(INTERP_KERNEL::Exception)
{
if(PyList_Check(pyLi))
{
int size=PyList_Size(pyLi);
+ if(chckSize)
+ if(size!=sizeOfArray)
+ {
+ std::ostringstream oss; oss << "fillArrayWithPyListInt : List expected to be of size " << sizeOfArray << " but the size is " << size << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
for(int i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
arrToFill[i]=val;
}
else
- {
- const char msg[]="list must contain integers only";
- PyErr_SetString(PyExc_TypeError,msg);
- throw INTERP_KERNEL::Exception(msg);
- }
+ throw INTERP_KERNEL::Exception("fillArrayWithPyListInt : List must contain integers only !");
}
for(int i=size;i<sizeOfArray;i++)
arrToFill[i]=dftVal;
else if(PyTuple_Check(pyLi))
{
int size=PyTuple_Size(pyLi);
+ if(chckSize)
+ if(size!=sizeOfArray)
+ {
+ std::ostringstream oss; oss << "fillArrayWithPyListInt : Tuple expected to be of size " << sizeOfArray << " but the size is " << size << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
for(int i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
}
}
-static void fillArrayWithPyListDbl(PyObject *pyLi, double *arrToFill, int sizeOfArray, double dftVal) throw(INTERP_KERNEL::Exception)
+static void fillArrayWithPyListDbl(PyObject *pyLi, double *arrToFill, int sizeOfArray, double dftVal, bool chckSize) throw(INTERP_KERNEL::Exception)
{
if(PyList_Check(pyLi))
{
int size=PyList_Size(pyLi);
+ if(chckSize)
+ if(size!=sizeOfArray)
+ {
+ std::ostringstream oss; oss << "fillArrayWithPyListDbl : List expected to be of size " << sizeOfArray << " but the size is " << size << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
for(int i=0;i<size;i++)
{
PyObject *o=PyList_GetItem(pyLi,i);
else if(PyTuple_Check(pyLi))
{
int size=PyTuple_Size(pyLi);
+ if(chckSize)
+ if(size!=sizeOfArray)
+ {
+ std::ostringstream oss; oss << "fillArrayWithPyListDbl : Tuple expected to be of size " << sizeOfArray << " but the size is " << size << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
for(int i=0;i<size;i++)
{
PyObject *o=PyTuple_GetItem(pyLi,i);
int status=SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,0|0);
if(!SWIG_IsOK(status))
{
- const char msg[]="list must contain only MEDCouplingUMesh";
+ const char msg[]="list must contain only instance of MEDCouplingUMesh";
PyErr_SetString(PyExc_TypeError,msg);
throw INTERP_KERNEL::Exception(msg);
}
}
}
+void convertPyObjToVecUMeshes(PyObject *ms, std::vector<ParaMEDMEM::MEDCouplingUMesh *>& v) throw(INTERP_KERNEL::Exception)
+{
+ if(PyList_Check(ms))
+ {
+ int size=PyList_Size(ms);
+ v.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *obj=PyList_GetItem(ms,i);
+ void *argp;
+ int status=SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,0|0);
+ if(!SWIG_IsOK(status))
+ {
+ const char msg[]="list must contain only instance of MEDCouplingUMesh";
+ PyErr_SetString(PyExc_TypeError,msg);
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ ParaMEDMEM::MEDCouplingUMesh *arg=reinterpret_cast< ParaMEDMEM::MEDCouplingUMesh * >(argp);
+ v[i]=arg;
+ }
+ }
+ else
+ {
+ const char msg[]="convertPyObjToVecUMeshes : not a list";
+ PyErr_SetString(PyExc_TypeError,msg);
+ throw INTERP_KERNEL::Exception(msg);
+ }
+}
+
+void convertPyObjToVecMeshesCst(PyObject *ms, std::vector<const ParaMEDMEM::MEDCouplingMesh *>& v) throw(INTERP_KERNEL::Exception)
+{
+ if(PyList_Check(ms))
+ {
+ int size=PyList_Size(ms);
+ v.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *obj=PyList_GetItem(ms,i);
+ void *argp;
+ int status=SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,0|0);
+ if(!SWIG_IsOK(status))
+ {
+ const char msg[]="list must contain only instance of MEDCouplingMesh";
+ PyErr_SetString(PyExc_TypeError,msg);
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ const ParaMEDMEM::MEDCouplingMesh *arg=reinterpret_cast< const ParaMEDMEM::MEDCouplingMesh * >(argp);
+ v[i]=arg;
+ }
+ }
+ else
+ {
+ const char msg[]="convertPyObjToVecUMeshesCst : not a list";
+ PyErr_SetString(PyExc_TypeError,msg);
+ throw INTERP_KERNEL::Exception(msg);
+ }
+}
+
void convertPyObjToVecDataArrayDblCst(PyObject *ms, std::vector<const ParaMEDMEM::DataArrayDouble *>& v) throw(INTERP_KERNEL::Exception)
{
if(PyList_Check(ms))
int status=SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0);
if(!SWIG_IsOK(status))
{
- const char msg[]="list must contain only MEDCouplingFieldDouble";
+ const char msg[]="list must contain only instance of MEDCouplingFieldDouble";
PyErr_SetString(PyExc_TypeError,msg);
throw INTERP_KERNEL::Exception(msg);
}
int status=SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,0|0);
if(!SWIG_IsOK(status))
{
- const char msg[]="list must contain only DataArrayInt";
+ const char msg[]="list must contain only instance of DataArrayInt";
PyErr_SetString(PyExc_TypeError,msg);
throw INTERP_KERNEL::Exception(msg);
}
* 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
+ * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
*
* 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)
+static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, ParaMEDMEM::DataArrayInt *& daIntTyypp, ParaMEDMEM::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception)
{
sw=-1;
if(PyInt_Check(value))
}
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(SWIG_IsOK(status))
+ {
+ daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
+ sw=3;
+ return;
+ }
+ status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,0|0);
+ if(SWIG_IsOK(status))
+ {
+ daIntTuple=reinterpret_cast< ParaMEDMEM::DataArrayIntTuple * >(argp);
+ sw=4;
+ return ;
+ }
+ throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
}
/*!
*/
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)
{
+ const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple";
sw=-1;
if(PyInt_Check(value))
{
}
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(SWIG_IsOK(status))
+ {
+ daIntTyypp=reinterpret_cast< ParaMEDMEM::DataArrayInt * >(argp);
+ if(!daIntTyypp)
+ {
+ std::ostringstream oss; oss << msg << " Instance in null !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ sw=4;
+ return ;
+ }
+ status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,0|0);;
+ if(SWIG_IsOK(status))
+ {
+ ParaMEDMEM::DataArrayIntTuple *tmp=reinterpret_cast< ParaMEDMEM::DataArrayIntTuple * >(argp);
+ if(!tmp)
+ {
+ std::ostringstream oss; oss << msg << " Instance in null !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ stdvecTyypp.resize(tmp->getNumberOfCompo());
+ std::copy(tmp->getConstPointer(),tmp->getConstPointer()+tmp->getNumberOfCompo(),stdvecTyypp.begin());
+ sw=2;
+ return ;
+ }
+ throw INTERP_KERNEL::Exception(msg);
}
static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, ParaMEDMEM::DataArrayIntTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
* if value int -> cpp val sw=1
* if value double -> cpp val sw=1
* if value DataArrayDouble -> cpp DataArrayDouble sw=2
+ * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
+ * if value list[int,double] -> cpp std::vector<double> sw=4
+ * if value tuple[int,double] -> cpp std::vector<double> sw=4
*/
-static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, ParaMEDMEM::DataArrayDouble *&d)
+static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, ParaMEDMEM::DataArrayDouble *&d, ParaMEDMEM::DataArrayDoubleTuple *&e, std::vector<double>& f)
{
sw=-1;
if(PyFloat_Check(value))
sw=1;
return;
}
+ if(PyTuple_Check(value))
+ {
+ int size=PyTuple_Size(value);
+ f.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyTuple_GetItem(value,i);
+ if(PyFloat_Check(o))
+ f[i]=PyFloat_AS_DOUBLE(o);
+ else if(PyInt_Check(o))
+ f[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=4;
+ return;
+ }
+ if(PyList_Check(value))
+ {
+ int size=PyList_Size(value);
+ f.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyList_GetItem(value,i);
+ if(PyFloat_Check(o))
+ f[i]=PyFloat_AS_DOUBLE(o);
+ else if(PyInt_Check(o))
+ f[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=4;
+ 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;
+ if(SWIG_IsOK(status))
+ {
+ d=reinterpret_cast< ParaMEDMEM::DataArrayDouble * >(argp);
+ sw=2;
+ return ;
+ }
+ status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,0|0);
+ if(SWIG_IsOK(status))
+ {
+ e=reinterpret_cast< ParaMEDMEM::DataArrayDoubleTuple * >(argp);
+ sw=3;
+ return ;
+ }
+ throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
}
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
INCLUDE_DIRECTORIES(
${OMNIORB_INCLUDES_DIR}
${CAS_INCLUDES_DIR}
+ ${BOOST_INCLUDES_DIR}
${KERNEL_ROOT_DIR}/include/salome
${GUI_ROOT_DIR}/include/salome
${CMAKE_CURRENT_BINARY_DIR}
)
ADD_LIBRARY(MEDGUI SHARED ${MEDGUI_SOURCES} ${MEDGUI_HEADERS_MOC} ${MEDGUI_FORMS_HEADERS})
-SET_TARGET_PROPERTIES(MEDGUI PROPERTIES COMPILE_FLAGS "${HDF5_FLAGS} ${MED3_FLAGS} ${XDR_FLAGS} ${CAS_FLAGS}")
+SET_TARGET_PROPERTIES(MEDGUI PROPERTIES COMPILE_FLAGS "${HDF5_FLAGS} ${MED3_FLAGS} ${XDR_FLAGS} ${CAS_FLAGS} ${BOOST_FLAGS}")
TARGET_LINK_LIBRARIES(MEDGUI medcalculator ${QT_MT_LIBS} ${CAS_KERNEL} ${BOOST_LIBS} ${GUI_LDFLAGS} ${SalomeApp} ${CAM} ${LightApp} ${qtx} ${suit} ${SalomeObject})
INSTALL(TARGETS MEDGUI DESTINATION ${MED_salomelib_LIBS})
QT4_INSTALL_TS_RESOURCES("${MEDGUITS_SOURCES}" "${MED_salomeres_DATA}")
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
ADD_LIBRARY(medloader SHARED ${medloader_SOURCES})
SET_TARGET_PROPERTIES(medloader PROPERTIES COMPILE_FLAGS "${HDF5_FLAGS} ${MED3_FLAGS}")
-TARGET_LINK_LIBRARIES(medloader medcoupling ${MED3_LIBS_C_ONLY})
+TARGET_LINK_LIBRARIES(medloader medcoupling ${MED3_LIBS_C_ONLY} ${HDF5_LIBS})
INSTALL(TARGETS medloader DESTINATION ${MED_salomelib_LIBS})
FILE(GLOB medloader_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
oss << "GaussPtsCoords="; std::copy(_gs_coo.begin(),_gs_coo.end(),std::ostream_iterator<double>(oss," ")); oss << std::endl;
}
+void MEDFileFieldLoc::setName(const char *name)
+{
+ _name=name;
+}
+
bool MEDFileFieldLoc::isEqual(const MEDFileFieldLoc& other, double eps) const
{
if(_name!=other._name)
return _profile;
}
+void MEDFileFieldPerMeshPerTypePerDisc::setProfile(const char *newPflName)
+{
+ _profile=newPflName;
+}
+
std::string MEDFileFieldPerMeshPerTypePerDisc::getLocalization() const
{
return _localization;
}
+void MEDFileFieldPerMeshPerTypePerDisc::setLocalization(const char *newLocName)
+{
+ _localization=newLocName;
+}
+
+void MEDFileFieldPerMeshPerTypePerDisc::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< std::pair<std::vector<std::string>, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++)
+ {
+ if(std::find((*it2).first.begin(),(*it2).first.end(),_profile)!=(*it2).first.end())
+ {
+ _profile=(*it2).second;
+ return;
+ }
+ }
+}
+
+void MEDFileFieldPerMeshPerTypePerDisc::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< std::pair<std::vector<std::string>, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++)
+ {
+ if(std::find((*it2).first.begin(),(*it2).first.end(),_localization)!=(*it2).first.end())
+ {
+ _localization=(*it2).second;
+ return;
+ }
+ }
+}
+
void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
{
if(type!=_type)
std::vector<std::string> MEDFileFieldPerMeshPerType::getPflsReallyUsed() const
{
std::vector<std::string> ret;
+ std::set<std::string> ret2;
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);
+ if(ret2.find(tmp)==ret2.end())
+ {
+ ret.push_back(tmp);
+ ret2.insert(tmp);
+ }
}
return ret;
}
std::vector<std::string> MEDFileFieldPerMeshPerType::getLocsReallyUsed() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ 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)
+ if(ret2.find(tmp)==ret2.end())
+ {
+ ret.push_back(tmp);
+ ret2.insert(tmp);
+ }
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileFieldPerMeshPerType::getPflsReallyUsedMulti() const
+{
+ std::vector<std::string> ret;
+ std::set<std::string> ret2;
+ 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::getLocsReallyUsedMulti() 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++)
return ret;
}
+void MEDFileFieldPerMeshPerType::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ (*it1)->changePflsRefsNamesGen(mapOfModif);
+}
+
+void MEDFileFieldPerMeshPerType::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it1=_field_pm_pt_pd.begin();it1!=_field_pm_pt_pd.end();it1++)
+ (*it1)->changeLocsRefsNamesGen(mapOfModif);
+}
+
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerType::getLeafGivenLocId(int locId) throw(INTERP_KERNEL::Exception)
+{
+ if(_field_pm_pt_pd.empty())
+ {
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ std::ostringstream oss; oss << "MEDFileFieldPerMeshPerType::getLeafGivenLocId : no localizations for geotype \"" << cm.getRepr() << "\" !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(locId>=0 && locId<(int)_field_pm_pt_pd.size())
+ return _field_pm_pt_pd[locId];
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerType::getLeafGivenLocId : no such locId available (" << locId;
+ oss2 << ") for geometric type \"" << cm.getRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !";
+ throw INTERP_KERNEL::Exception(oss2.str().c_str());
+ return static_cast<MEDFileFieldPerMeshPerTypePerDisc*>(0);
+}
+
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerType::getLeafGivenLocId(int locId) const throw(INTERP_KERNEL::Exception)
+{
+ if(_field_pm_pt_pd.empty())
+ {
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ std::ostringstream oss; oss << "MEDFileFieldPerMeshPerType::getLeafGivenLocId : no localizations for geotype \"" << cm.getRepr() << "\" !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(locId>=0 && locId<(int)_field_pm_pt_pd.size())
+ return _field_pm_pt_pd[locId];
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
+ std::ostringstream oss2; oss2 << "MEDFileFieldPerMeshPerType::getLeafGivenLocId : no such locId available (" << locId;
+ oss2 << ") for geometric type \"" << cm.getRepr() << "\" It should be in [0," << _field_pm_pt_pd.size() << ") !";
+ throw INTERP_KERNEL::Exception(oss2.str().c_str());
+ return static_cast<const MEDFileFieldPerMeshPerTypePerDisc*>(0);
+}
+
void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const
{
if(_geo_type!=INTERP_KERNEL::NORM_ERROR)
return ret;
}
+std::vector<std::string> MEDFileFieldPerMesh::getPflsReallyUsedMulti() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
std::vector<std::string> MEDFileFieldPerMesh::getLocsReallyUsed() const
{
std::vector<std::string> ret;
return ret;
}
+std::vector<std::string> MEDFileFieldPerMesh::getLocsReallyUsedMulti() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+void MEDFileFieldPerMesh::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->changePflsRefsNamesGen(mapOfModif);
+}
+
+void MEDFileFieldPerMesh::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ (*it)->changeLocsRefsNamesGen(mapOfModif);
+}
+
MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField type, const MEDFieldFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception)
{
if(_field_pm_pt.empty())
return _father->getUndergroundDataArray();
}
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ {
+ if((*it)->getGeoType()==typ)
+ return (*it)->getLeafGivenLocId(locId);
+ }
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
+ std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl;
+ oss << "Possiblities are : ";
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ {
+ const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType());
+ oss << "\"" << cm2.getRepr() << "\", ";
+ }
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ {
+ if((*it)->getGeoType()==typ)
+ return (*it)->getLeafGivenLocId(locId);
+ }
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
+ std::ostringstream oss; oss << "MEDFileFieldPerMesh::getLeafGivenTypeAndLocId : no such geometric type \"" << cm.getRepr() << "\" in this !" << std::endl;
+ oss << "Possiblities are : ";
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ {
+ const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType());
+ oss << "\"" << cm2.getRepr() << "\", ";
+ }
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type)
{
int i=0;
if(nbOfTuples==ComputeNbOfElems(glob,ON_NODES,geoTypes2,dads,locs))//No problem for NORM_ERROR because it is in context of node
return finishField(ON_NODES,glob,dads,locs,mesh,isPfl);
}
+ // Treatment of particular case where nodal field on pfl is requested with a meshDimRelToMax=1.
+ const MEDCouplingUMesh *meshu=dynamic_cast<const MEDCouplingUMesh *>(mesh);
+ if(meshu)
+ {
+ if(meshu->getNodalConnectivity()==0)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl);
+ int nb=da->getNbOfElems();
+ const int *ptr=da->getConstPointer();
+ MEDCouplingUMesh *meshuc=const_cast<MEDCouplingUMesh *>(meshu);
+ meshuc->allocateCells(nb);
+ for(int i=0;i<nb;i++)
+ meshuc->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,ptr+i);
+ meshuc->finishInsertingCells();
+ ret->setMesh(meshuc);
+ ret->checkCoherency();
+ ret->incrRef();
+ return ret;
+ }
+ }
+ //
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl);
isPfl=true;
DataArrayInt *arr2=0;
{
std::ostringstream oss; oss << "MEDFileFieldPerMesh::finishField3 : The field on nodes lies on a node profile so that it is impossible to find a submesh having exactly the same nodes of that profile !!!";
oss << "So it is impossible to return a well definied MEDCouplingFieldDouble instance on specified mesh on a specified meshDim !" << std::endl;
- oss << "To retrieve correctly such a field you have 2 possibilities :" << std::endl;
+ oss << "To retrieve correctly such a field you have 3 possibilities :" << std::endl;
oss << " - use an another meshDim compatible with the field on nodes (MED file does not have such information)" << std::endl;
+ oss << " - use an another a meshDimRelToMax equal to 1 -> it will return a mesh with artificial cell POINT1 containing the profile !" << std::endl;
oss << " - if definitely the node profile has no link with mesh connectivity use MEDFileField1TS::getFieldWithProfile or MEDFileFieldMultiTS::getFieldWithProfile methods instead !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
_file_name=fileName;
}
+void MEDFieldFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::iterator it=_pfls.begin();it!=_pfls.end();it++)
+ {
+ DataArrayInt *elt(*it);
+ if(elt)
+ {
+ std::string name(elt->getName());
+ for(std::vector< std::pair<std::vector<std::string>, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++)
+ {
+ if(std::find((*it2).first.begin(),(*it2).first.end(),name)!=(*it2).first.end())
+ {
+ elt->setName((*it2).second.c_str());
+ return;
+ }
+ }
+ }
+ }
+}
+
+void MEDFieldFieldGlobs::changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::iterator it=_locs.begin();it!=_locs.end();it++)
+ {
+ MEDFileFieldLoc *elt(*it);
+ if(elt)
+ {
+ std::string name(elt->getName());
+ for(std::vector< std::pair<std::vector<std::string>, std::string > >::const_iterator it2=mapOfModif.begin();it2!=mapOfModif.end();it2++)
+ {
+ if(std::find((*it2).first.begin(),(*it2).first.end(),name)!=(*it2).first.end())
+ {
+ elt->setName((*it2).second.c_str());
+ return;
+ }
+ }
+ }
+ }
+}
+
int MEDFieldFieldGlobs::getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception)
{
if(locId<0 || locId>=(int)_locs.size())
return _locs[locId]->getNbOfGaussPtPerCell();
}
-const MEDFileFieldLoc& MEDFieldFieldGlobs::getLocalization(const char *pflName) const throw(INTERP_KERNEL::Exception)
+const MEDFileFieldLoc& MEDFieldFieldGlobs::getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
{
- return getLocalizationFromId(getLocalizationId(pflName));
+ return getLocalizationFromId(getLocalizationId(locName));
}
const MEDFileFieldLoc& MEDFieldFieldGlobs::getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
return std::distance(_locs.begin(),it);
}
-const DataArrayInt *MEDFieldFieldGlobs::getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception)
+const DataArrayInt *MEDFieldFieldGlobs::getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
{
- std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflName));
+ std::string pflNameCpp(pflName);
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflNameCpp));
if(it==_pfls.end())
{
- std::ostringstream oss; oss << "MEDFieldFieldGlobs::getProfile: no such profile name : \"" << pflName << "\" Possible profiles are : ";
+ std::ostringstream oss; oss << "MEDFieldFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : ";
for(it=_pfls.begin();it!=_pfls.end();it++)
oss << "\"" << (*it)->getName() << "\", ";
throw INTERP_KERNEL::Exception(oss.str().c_str());
return *it;
}
+const DataArrayInt *MEDFieldFieldGlobs::getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
+{
+ if(pflId<0 || pflId>=(int)_pfls.size())
+ throw INTERP_KERNEL::Exception("MEDFieldFieldGlobs::getProfileFromId : Invalid profile id !");
+ return _pfls[pflId];
+}
+
+MEDFileFieldLoc& MEDFieldFieldGlobs::getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception)
+{
+ if(locId<0 || locId>=(int)_locs.size())
+ throw INTERP_KERNEL::Exception("MEDFieldFieldGlobs::getLocalizationFromId : Invalid localization id !");
+ return *_locs[locId];
+}
+
+MEDFileFieldLoc& MEDFieldFieldGlobs::getLocalization(const char *locName) throw(INTERP_KERNEL::Exception)
+{
+ return getLocalizationFromId(getLocalizationId(locName));
+}
+
+DataArrayInt *MEDFieldFieldGlobs::getProfile(const char *pflName) throw(INTERP_KERNEL::Exception)
+{
+ std::string pflNameCpp(pflName);
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflNameCpp));
+ if(it==_pfls.end())
+ {
+ std::ostringstream oss; oss << "MEDFieldFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : ";
+ for(it=_pfls.begin();it!=_pfls.end();it++)
+ oss << "\"" << (*it)->getName() << "\", ";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return *it;
+}
+
+DataArrayInt *MEDFieldFieldGlobs::getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception)
+{
+ if(pflId<0 || pflId>=(int)_pfls.size())
+ throw INTERP_KERNEL::Exception("MEDFieldFieldGlobs::getProfileFromId : Invalid profile id !");
+ return _pfls[pflId];
+}
+
+void MEDFieldFieldGlobs::killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception)
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > newPfls;
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ {
+ if(std::find(pflIds.begin(),pflIds.end(),i)==pflIds.end())
+ newPfls.push_back(*it);
+ }
+ _pfls=newPfls;
+}
+
+void MEDFieldFieldGlobs::killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception)
+{
+ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> > newLocs;
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::const_iterator it=_locs.begin();it!=_locs.end();it++,i++)
+ {
+ if(std::find(locIds.begin(),locIds.end(),i)==locIds.end())
+ newLocs.push_back(*it);
+ }
+ _locs=newLocs;
+}
+
std::vector<std::string> MEDFieldFieldGlobs::getPfls() const
{
int sz=_pfls.size();
return ret;
}
+bool MEDFieldFieldGlobs::existsPfl(const char *pflName) const
+{
+ std::vector<std::string> v=getPfls();
+ std::string s(pflName);
+ return std::find(v.begin(),v.end(),s)!=v.end();
+}
+
+bool MEDFieldFieldGlobs::existsLoc(const char *locName) const
+{
+ std::vector<std::string> v=getLocs();
+ std::string s(locName);
+ return std::find(v.begin(),v.end(),s)!=v.end();
+}
+
+std::vector< std::vector<int> > MEDFieldFieldGlobs::whichAreEqualProfiles() const
+{
+ std::map<int,std::vector<int> > m;
+ int i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++)
+ {
+ const DataArrayInt *tmp=(*it);
+ if(tmp)
+ {
+ m[tmp->getHashCode()].push_back(i);
+ }
+ }
+ std::vector< std::vector<int> > ret;
+ for(std::map<int,std::vector<int> >::const_iterator it2=m.begin();it2!=m.end();it2++)
+ {
+ if((*it2).second.size()>1)
+ {
+ std::vector<int> ret0;
+ bool equalityOrNot=false;
+ for(std::vector<int>::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++)
+ {
+ std::vector<int>::const_iterator it4=it3; it4++;
+ for(;it4!=(*it2).second.end();it4++)
+ {
+ if(_pfls[*it3]->isEqualWithoutConsideringStr(*_pfls[*it4]))
+ {
+ if(!equalityOrNot)
+ ret0.push_back(*it3);
+ ret0.push_back(*it4);
+ equalityOrNot=true;
+ }
+ }
+ }
+ if(!ret0.empty())
+ ret.push_back(ret0);
+ }
+ }
+ return ret;
+}
+
+std::vector< std::vector<int> > MEDFieldFieldGlobs::whichAreEqualLocs(double eps) const
+{
+ throw INTERP_KERNEL::Exception("MEDFieldFieldGlobs::whichAreEqualLocs : no implemented yet ! Sorry !");
+}
+
void MEDFieldFieldGlobs::appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception)
{
std::string name(pfl->getName());
return _globals->getLocs();
}
+bool MEDFieldFieldGlobsReal::existsPfl(const char *pflName) const
+{
+ return _globals->existsPfl(pflName);
+}
+
+bool MEDFieldFieldGlobsReal::existsLoc(const char *locName) const
+{
+ return _globals->existsLoc(locName);
+}
+
void MEDFieldFieldGlobsReal::setFileName(const char *fileName)
{
_globals->setFileName(fileName);
}
+std::vector< std::vector<int> > MEDFieldFieldGlobsReal::whichAreEqualProfiles() const
+{
+ return _globals->whichAreEqualProfiles();
+}
+
+std::vector< std::vector<int> > MEDFieldFieldGlobsReal::whichAreEqualLocs(double eps) const
+{
+ return _globals->whichAreEqualLocs(eps);
+}
+
+void MEDFieldFieldGlobsReal::changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ _globals->changePflsNamesInStruct(mapOfModif);
+}
+
+void MEDFieldFieldGlobsReal::changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ _globals->changeLocsNamesInStruct(mapOfModif);
+}
+
+/*!
+ * This method is a generalization of MEDFieldFieldGlobsReal::changePflName.
+ * This method contrary to abstract method MEDFieldFieldGlobsReal::changePflsRefsNamesGen updates in addition of MEDFieldFieldGlobsReal::changePflsRefsNamesGen,
+ * the profiles themselves and not only leaves of field.
+ */
+void MEDFieldFieldGlobsReal::changePflsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ changePflsRefsNamesGen(mapOfModif);
+ changePflsNamesInStruct(mapOfModif);
+}
+
+/*!
+ * This method is a generalization of MEDFieldFieldGlobsReal::changePflName.
+ * This method contrary to abstract method MEDFieldFieldGlobsReal::changeLocsRefsNamesGen updates in addition of MEDFieldFieldGlobsReal::changeLocsRefsNamesGen,
+ * the localizations themselves and not only leaves of field.
+ */
+void MEDFieldFieldGlobsReal::changeLocsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ changeLocsRefsNamesGen(mapOfModif);
+ changeLocsNamesInStruct(mapOfModif);
+}
+
+/*!
+ * This method is a more friendly API but less general method than MEDFieldFieldGlobsReal::changePflsNames.
+ */
+void MEDFieldFieldGlobsReal::changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception)
+{
+ std::vector< std::pair<std::vector<std::string>, std::string > > mapOfModif(1);
+ std::pair<std::vector<std::string>, std::string > p(std::vector<std::string>(1,std::string(oldName)),std::string(newName));
+ mapOfModif[0]=p;
+ changePflsNames(mapOfModif);
+}
+
+/*!
+ * This method is a more friendly API but less general method than MEDFieldFieldGlobsReal::changeLocsNames.
+ */
+void MEDFieldFieldGlobsReal::changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception)
+{
+ std::vector< std::pair<std::vector<std::string>, std::string > > mapOfModif(1);
+ std::pair<std::vector<std::string>, std::string > p(std::vector<std::string>(1,std::string(oldName)),std::string(newName));
+ mapOfModif[0]=p;
+ changeLocsNames(mapOfModif);
+}
+
+std::vector< std::pair<std::vector<std::string>, std::string > > MEDFieldFieldGlobsReal::zipPflsNames() throw(INTERP_KERNEL::Exception)
+{
+ std::vector< std::vector<int> > pseudoRet=whichAreEqualProfiles();
+ std::vector< std::pair<std::vector<std::string>, std::string > > ret(pseudoRet.size());
+ int i=0;
+ for(std::vector< std::vector<int> >::const_iterator it=pseudoRet.begin();it!=pseudoRet.end();it++,i++)
+ {
+ std::vector< std::string > tmp((*it).size());
+ int j=0;
+ for(std::vector<int>::const_iterator it2=(*it).begin();it2!=(*it).end();it2++,j++)
+ tmp[j]=std::string(getProfileFromId(*it2)->getName());
+ std::pair<std::vector<std::string>, std::string > p(tmp,tmp.front());
+ ret[i]=p;
+ std::vector<int> tmp2((*it).begin()+1,(*it).end());
+ killProfileIds(tmp2);
+ }
+ changePflsRefsNamesGen(ret);
+ return ret;
+}
+
+std::vector< std::pair<std::vector<std::string>, std::string > > MEDFieldFieldGlobsReal::zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
+{
+ std::vector< std::vector<int> > pseudoRet=whichAreEqualLocs(eps);
+ std::vector< std::pair<std::vector<std::string>, std::string > > ret(pseudoRet.size());
+ int i=0;
+ for(std::vector< std::vector<int> >::const_iterator it=pseudoRet.begin();it!=pseudoRet.end();it++,i++)
+ {
+ std::vector< std::string > tmp((*it).size());
+ int j=0;
+ for(std::vector<int>::const_iterator it2=(*it).begin();it2!=(*it).end();it2++,j++)
+ tmp[j]=std::string(getLocalizationFromId(*it2).getName());
+ std::pair<std::vector<std::string>, std::string > p(tmp,tmp.front());
+ ret[i]=p;
+ std::vector<int> tmp2((*it).begin()+1,(*it).end());
+ killLocalizationIds(tmp2);
+ }
+ changeLocsRefsNamesGen(ret);
+ return ret;
+}
+
int MEDFieldFieldGlobsReal::getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception)
{
return _globals->getNbOfGaussPtPerCell(locId);
return _globals->getFileName2();
}
-const MEDFileFieldLoc& MEDFieldFieldGlobsReal::getLocalization(const char *pflName) const throw(INTERP_KERNEL::Exception)
+const MEDFileFieldLoc& MEDFieldFieldGlobsReal::getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
{
- return _globals->getLocalization(pflName);
+ return _globals->getLocalization(locName);
}
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)
+const DataArrayInt *MEDFieldFieldGlobsReal::getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
{
return _globals->getProfile(pflName);
}
+const DataArrayInt *MEDFieldFieldGlobsReal::getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
+{
+ return _globals->getProfileFromId(pflId);
+}
+
+MEDFileFieldLoc& MEDFieldFieldGlobsReal::getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception)
+{
+ return _globals->getLocalizationFromId(locId);
+}
+
+MEDFileFieldLoc& MEDFieldFieldGlobsReal::getLocalization(const char *locName) throw(INTERP_KERNEL::Exception)
+{
+ return _globals->getLocalization(locName);
+}
+
+DataArrayInt *MEDFieldFieldGlobsReal::getProfile(const char *pflName) throw(INTERP_KERNEL::Exception)
+{
+ return _globals->getProfile(pflName);
+}
+
+DataArrayInt *MEDFieldFieldGlobsReal::getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception)
+{
+ return _globals->getProfileFromId(pflId);
+}
+
+void MEDFieldFieldGlobsReal::killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception)
+{
+ _globals->killProfileIds(pflIds);
+}
+
+void MEDFieldFieldGlobsReal::killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception)
+{
+ _globals->killLocalizationIds(locIds);
+}
+
void MEDFieldFieldGlobsReal::appendProfile(DataArrayInt *pfl) throw(INTERP_KERNEL::Exception)
{
_globals->appendProfile(pfl);
return ret;
}
+std::vector<std::string> MEDFileField1TSWithoutDAS::getPflsReallyUsedMulti2() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileField1TSWithoutDAS::getLocsReallyUsedMulti2() 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)->getLocsReallyUsedMulti();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+void MEDFileField1TSWithoutDAS::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->changePflsRefsNamesGen(mapOfModif);
+}
+
+void MEDFileField1TSWithoutDAS::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->changeLocsRefsNamesGen(mapOfModif);
+}
+
void MEDFileField1TSWithoutDAS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
{
if(_field_per_mesh.empty())
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);
+ if(meshDimRelToMax==1)
+ (static_cast<MEDCouplingUMesh *>((MEDCouplingMesh *)m))->setMeshDimension(0);
return MEDFileField1TSWithoutDAS::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e);
}
return sz;
}
+/*!
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ */
int MEDFileField1TSWithoutDAS::getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception)
{
if(_field_per_mesh.empty())
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
+/*!
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutDAS::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ */
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileField1TSWithoutDAS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception)
+{
+ int mid=getMeshIdFromMeshName(mName);
+ return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId);
+}
+
+/*!
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutDAS::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ */
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileField1TSWithoutDAS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception)
+{
+ int mid=getMeshIdFromMeshName(mName);
+ return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId);
+}
+
DataArrayDouble *MEDFileField1TSWithoutDAS::getOrCreateAndGetArray()
{
DataArrayDouble *ret=_arr;
{
}
+/*!
+ * This method returns all profiles whose name is non empty used.
+ * \b WARNING If profile is used several times it will be reported \b only \b once.
+ * To get non empty name profiles as time as they appear in \b this call MEDFileField1TS::getPflsReallyUsedMulti instead.
+ */
std::vector<std::string> MEDFileField1TS::getPflsReallyUsed() const
{
return getPflsReallyUsed2();
}
+/*!
+ * This method returns all localizations whose name is non empty used.
+ * \b WARNING If localization is used several times it will be reported \b only \b once.
+ */
std::vector<std::string> MEDFileField1TS::getLocsReallyUsed() const
{
return getLocsReallyUsed2();
}
+/*!
+ * This method returns all profiles whose name is non empty used.
+ * \b WARNING contrary to MEDFileField1TS::getPflsReallyUsed, if profile is used several times it will be reported as time as it appears.
+ */
+std::vector<std::string> MEDFileField1TS::getPflsReallyUsedMulti() const
+{
+ return getPflsReallyUsedMulti2();
+}
+
+/*!
+ * This method returns all localizations whose name is non empty used.
+ * \b WARNING contrary to MEDFileField1TS::getLocsReallyUsed if localization is used several times it will be reported as time as it appears.
+ */
+std::vector<std::string> MEDFileField1TS::getLocsReallyUsedMulti() const
+{
+ return getLocsReallyUsedMulti2();
+}
+
+void MEDFileField1TS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ changePflsRefsNamesGen2(mapOfModif);
+}
+
+void MEDFileField1TS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ changeLocsRefsNamesGen2(mapOfModif);
+}
+
/*!
* 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.
MEDFileField1TSWithoutDAS::setFieldProfile(field,mesh,meshDimRelToMax,profile,*this);
}
+/*!
+ * This method as MEDFileField1TSW::setLocNameOnLeaf, is dedicated for advanced user that a want a very fine control on their data structure
+ * without overhead. This method can be called only regarding information returned by MEDFileField1TSWithoutDAS::getFieldSplitedByType or MEDFileField1TSWithoutDAS::getFieldSplitedByType2.
+ * This method changes the attribute (here it's profile name) of the leaf datastructure (MEDFileFieldPerMeshPerTypePerDisc instance).
+ * It is the responsability of the caller to invoke MEDFieldFieldGlobs::appendProfile or MEDFieldFieldGlobs::getProfile
+ * to keep a valid instance.
+ * If \b this do not have any leaf that correspond to the request of the input parameter (\b mName, \b typ, \b locId) an INTERP_KERNEL::Exception will be thrown.
+ * If \b newPflName profile name does not already exist the profile with old name will be renamed with name \b newPflName.
+ * If \b newPflName already exists and that \b forceRenameOnGlob is false (the default) an INTERP_KERNEL::Exception will be thrown to avoid big confusion. In this case the called should rename before the profile name with name \b newPflName.
+ *
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutDAS::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ * \param [in] newLocName is the new localization name.
+ * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newPflName already exists. If true, the renaming is done without check. It can lead to major bug.
+ * If false, an exception will be thrown to force user to change previously the name of the profile with name \b newPflName
+ */
+void MEDFileField1TS::setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob) throw(INTERP_KERNEL::Exception)
+{
+ MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+ std::string oldPflName=disc->getProfile();
+ std::vector<std::string> vv=getPflsReallyUsedMulti();
+ int nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName);
+ if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1))
+ {
+ disc->setProfile(newPflName);
+ DataArrayInt *pfl=getProfile(oldPflName.c_str());
+ pfl->setName(newPflName);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileField1TS::setProfileNameOnLeaf : Profile \"" << newPflName << "\" already exists or referenced more than one !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+/*!
+ * This method as MEDFileField1TSW::setProfileNameOnLeaf, is dedicated for advanced user that a want a very fine control on their data structure
+ * without overhead. This method can be called only regarding information returned by MEDFileField1TSWithoutDAS::getFieldSplitedByType or MEDFileField1TSWithoutDAS::getFieldSplitedByType2.
+ * This method changes the attribute (here it's localization name) of the leaf datastructure (MEDFileFieldPerMeshPerTypePerDisc instance).
+ * It is the responsability of the caller to invoke MEDFieldFieldGlobs::appendProfile or MEDFieldFieldGlobs::getProfile
+ * to keep a valid instance.
+ * If \b this do not have any leaf that correspond to the request of the input parameter (\b mName, \b typ, \b locId) an INTERP_KERNEL::Exception will be thrown.
+ * This method is an extension of MEDFileField1TSWithoutDAS::setProfileNameOnLeafExt method because it performs a modification of global info.
+ * If \b newLocName profile name does not already exist the localization with old name will be renamed with name \b newLocName.
+ * If \b newLocName already exists an INTERP_KERNEL::Exception will be thrown to avoid big confusion. In this case the called should rename before the profile name with name \b newLocName.
+ *
+ * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
+ * \param [in] typ is for the geometric cell type (or INTERP_KERNEL::NORM_ERROR for node field) entry to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set.
+ * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of
+ * \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutDAS::getFieldSplitedByType. For non gausspoints field users, the value is 0.
+ * \param [in] newLocName is the new localization name.
+ * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newLocName already exists. If true, the renaming is done without check. It can lead to major bug.
+ * If false, an exception will be thrown to force user to change previously the name of the profile with name \b newLocName
+ */
+void MEDFileField1TS::setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob) throw(INTERP_KERNEL::Exception)
+{
+ MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
+ std::string oldLocName=disc->getLocalization();
+ std::vector<std::string> vv=getLocsReallyUsedMulti();
+ int nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName);
+ if(forceRenameOnGlob || (!existsLoc(newLocName) && nbOfOcc==1))
+ {
+ disc->setLocalization(newLocName);
+ MEDFileFieldLoc& loc=getLocalization(oldLocName.c_str());
+ loc.setName(newLocName);
+ }
+ else
+ {
+ std::ostringstream oss; oss << "MEDFileField1TS::setLocNameOnLeaf : Localization \"" << newLocName << "\" already exists or referenced more than one !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
MEDFileFieldMultiTSWithoutDAS *MEDFileFieldMultiTSWithoutDAS::New(med_idt fid, const char *fieldName, int id, int ft, const std::vector<std::string>& infos, int nbOfStep) throw(INTERP_KERNEL::Exception)
{
return new MEDFileFieldMultiTSWithoutDAS(fid,fieldName,id,ft,infos,nbOfStep);
return ret;
}
+std::vector<std::string> MEDFileFieldMultiTSWithoutDAS::getPflsReallyUsedMulti2() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutDAS > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileFieldMultiTSWithoutDAS::getLocsReallyUsedMulti2() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutDAS > >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsedMulti2();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+void MEDFileFieldMultiTSWithoutDAS::changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutDAS > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ (*it)->changePflsRefsNamesGen2(mapOfModif);
+}
+
+void MEDFileFieldMultiTSWithoutDAS::changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileField1TSWithoutDAS > >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ (*it)->changeLocsRefsNamesGen2(mapOfModif);
+}
+
MEDFileFieldMultiTS *MEDFileFieldMultiTS::New()
{
return new MEDFileFieldMultiTS;
return getLocsReallyUsed2();
}
+std::vector<std::string> MEDFileFieldMultiTS::getPflsReallyUsedMulti() const
+{
+ return getPflsReallyUsedMulti2();
+}
+
+std::vector<std::string> MEDFileFieldMultiTS::getLocsReallyUsedMulti() const
+{
+ return getLocsReallyUsedMulti2();
+}
+
+void MEDFileFieldMultiTS::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ changePflsRefsNamesGen2(mapOfModif);
+}
+
+void MEDFileFieldMultiTS::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ changeLocsRefsNamesGen2(mapOfModif);
+}
+
MEDFileFields *MEDFileFields::New()
{
return new MEDFileFields;
return ret;
}
+std::vector<std::string> MEDFileFields::getPflsReallyUsedMulti() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutDAS > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getPflsReallyUsedMulti2();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+std::vector<std::string> MEDFileFields::getLocsReallyUsedMulti() const
+{
+ std::vector<std::string> ret;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutDAS > >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ {
+ std::vector<std::string> tmp=(*it)->getLocsReallyUsed2();
+ ret.insert(ret.end(),tmp.begin(),tmp.end());
+ }
+ return ret;
+}
+
+void MEDFileFields::changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutDAS > >::iterator it=_fields.begin();it!=_fields.end();it++)
+ (*it)->changePflsRefsNamesGen2(mapOfModif);
+}
+
+void MEDFileFields::changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldMultiTSWithoutDAS > >::iterator it=_fields.begin();it!=_fields.end();it++)
+ (*it)->changeLocsRefsNamesGen2(mapOfModif);
+}
+
void MEDFileFields::resize(int newSize) throw(INTERP_KERNEL::Exception)
{
_fields.resize(newSize);
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <vector>
#include <string>
-extern "C"
-{
#include "med.h"
-}
namespace ParaMEDMEM
{
public:
void MEDLOADER_EXPORT simpleRepr(std::ostream& oss) const;
const MEDLOADER_EXPORT std::string& getName() const { return _name; }
+ void MEDLOADER_EXPORT setName(const char *name);
static MEDFileFieldLoc *New(med_idt fid, const char *locName);
static MEDFileFieldLoc *New(med_idt fid, int id);
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);
const DataArrayDouble *getArray() const;
const std::vector<std::string>& getInfo() const;
std::string getProfile() const;
+ void setProfile(const char *newPflName);
std::string getLocalization() const;
+ void setLocalization(const char *newLocName);
int getLocId() const { return _loc_id; }
+ void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
void getFieldAtLevel(TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs,
std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
void fillValues(int discId, int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
MEDFileFieldPerMeshPerType *_father;
int _start;
int _end;
- //MEDCouplingAutoRefCountObjectPtr< DataArrayDouble > _arr;
- //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(end-start)/nbi)
+ //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi)
int _nval;
int _profile_it;
std::string _profile;
const std::vector<std::string>& getInfo() const;
std::vector<std::string> getPflsReallyUsed() const;
std::vector<std::string> getLocsReallyUsed() const;
+ std::vector<std::string> getPflsReallyUsedMulti() const;
+ std::vector<std::string> getLocsReallyUsedMulti() const;
+ void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) throw(INTERP_KERNEL::Exception);
+ const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const throw(INTERP_KERNEL::Exception);
void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector< std::pair<int,int> >& dads, std::vector<const DataArrayInt *>& pfls, std::vector<int>& locs, std::vector<INTERP_KERNEL::NormalizedCellType>& geoTypes) const;
void fillValues(int& startEntryId, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType);
const std::vector<std::string>& getInfo() const;
std::vector<std::string> getPflsReallyUsed() const;
std::vector<std::string> getLocsReallyUsed() const;
+ std::vector<std::string> getPflsReallyUsedMulti() const;
+ std::vector<std::string> getLocsReallyUsedMulti() const;
+ void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
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);
DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const throw(INTERP_KERNEL::Exception);
+ MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
+ const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
private:
int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type);
MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFieldFieldGlobsReal *glob,
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;
+ bool existsPfl(const char *pflName) const;
+ bool existsLoc(const char *locName) const;
+ std::vector< std::vector<int> > whichAreEqualProfiles() const;
+ std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
void setFileName(const char *fileName);
+ void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
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 MEDFileFieldLoc& getLocalization(const char *pflName) const throw(INTERP_KERNEL::Exception);
- const DataArrayInt *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception);
+ const MEDFileFieldLoc& getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception);
+ const DataArrayInt *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception);
+ const DataArrayInt *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception);
+ MEDFileFieldLoc& getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception);
+ MEDFileFieldLoc& getLocalization(const char *locName) throw(INTERP_KERNEL::Exception);
+ DataArrayInt *getProfile(const char *pflName) throw(INTERP_KERNEL::Exception);
+ DataArrayInt *getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception);
+ void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
+ void killLocalizationIds(const std::vector<int>& locIds) 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);
void appendGlobs(const MEDFieldFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
virtual std::vector<std::string> getPflsReallyUsed() const = 0;
virtual std::vector<std::string> getLocsReallyUsed() const = 0;
+ virtual std::vector<std::string> getPflsReallyUsedMulti() const = 0;
+ virtual std::vector<std::string> getLocsReallyUsedMulti() const = 0;
+ virtual void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) = 0;
+ virtual void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception) = 0;
virtual ~MEDFieldFieldGlobsReal();
//
void loadProfileInFile(med_idt fid, int id, const char *pflName) 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;
+ bool existsPfl(const char *pflName) const;
+ bool existsLoc(const char *locName) const;
+ std::vector< std::vector<int> > whichAreEqualProfiles() const;
+ std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
void setFileName(const char *fileName);
+ void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changePflsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
+ void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
+ std::vector< std::pair<std::vector<std::string>, std::string > > zipPflsNames() throw(INTERP_KERNEL::Exception);
+ std::vector< std::pair<std::vector<std::string>, std::string > > zipLocsNames(double eps) throw(INTERP_KERNEL::Exception);
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 MEDFileFieldLoc& getLocalization(const char *pflName) const throw(INTERP_KERNEL::Exception);
- const DataArrayInt *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception);
+ const MEDFileFieldLoc& getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception);
+ MEDFileFieldLoc& getLocalizationFromId(int locId) throw(INTERP_KERNEL::Exception);
+ MEDFileFieldLoc& getLocalization(const char *locName) throw(INTERP_KERNEL::Exception);
+ const DataArrayInt *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception);
+ const DataArrayInt *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *getProfile(const char *pflName) throw(INTERP_KERNEL::Exception);
+ DataArrayInt *getProfileFromId(int pflId) throw(INTERP_KERNEL::Exception);
+ void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
+ void killLocalizationIds(const std::vector<int>& locIds) 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);
MEDCouplingAutoRefCountObjectPtr< MEDFieldFieldGlobs > _globals;
};
+ /*!
+ * DAS is for Shared Data Arrays such as profiles.
+ */
class MEDLOADER_EXPORT MEDFileField1TSWithoutDAS : public RefCountObject, public MEDFileWritable
{
public:
virtual void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getPflsReallyUsed2() const;
std::vector<std::string> getLocsReallyUsed2() const;
+ std::vector<std::string> getPflsReallyUsedMulti2() const;
+ std::vector<std::string> getLocsReallyUsedMulti2() const;
+ void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
static void CheckMeshDimRel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
//
protected:
int addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
int getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception);
+ MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) throw(INTERP_KERNEL::Exception);
+ const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const throw(INTERP_KERNEL::Exception);
MEDFileField1TSWithoutDAS(const char *fieldName, int csit, int fieldtype, int iteration, int order, const std::vector<std::string>& infos);
public:
MEDFileField1TSWithoutDAS();
//
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);
+ public:
+ //! underground method see MEDFileField1TSWithoutDAS::setProfileNameOnLeaf
+ void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
+ //! underground method see MEDFileField1TSWithoutDAS::setLocNameOnLeaf
+ void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
private:
void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getPflsReallyUsed() const;
std::vector<std::string> getLocsReallyUsed() const;
+ std::vector<std::string> getPflsReallyUsedMulti() const;
+ std::vector<std::string> getLocsReallyUsedMulti() const;
+ void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
MEDFileField1TS();
};
public:
std::vector<std::string> getPflsReallyUsed2() const;
std::vector<std::string> getLocsReallyUsed2() const;
+ std::vector<std::string> getPflsReallyUsedMulti2() const;
+ std::vector<std::string> getLocsReallyUsedMulti2() const;
+ void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
protected:
const MEDFileField1TSWithoutDAS& getTimeStepEntry(int iteration, int order) const throw(INTERP_KERNEL::Exception);
MEDFileField1TSWithoutDAS& getTimeStepEntry(int iteration, int order) throw(INTERP_KERNEL::Exception);
private:
std::vector<std::string> getPflsReallyUsed() const;
std::vector<std::string> getLocsReallyUsed() const;
+ std::vector<std::string> getPflsReallyUsedMulti() const;
+ std::vector<std::string> getLocsReallyUsedMulti() const;
+ void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
private:
MEDFileFieldMultiTS();
MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutDAS& other);
int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getPflsReallyUsed() const;
std::vector<std::string> getLocsReallyUsed() const;
+ std::vector<std::string> getPflsReallyUsedMulti() const;
+ std::vector<std::string> getLocsReallyUsedMulti() const;
+ void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
+ void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) throw(INTERP_KERNEL::Exception);
private:
MEDFileFields();
MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception);
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> cc=_coords->deepCpy();
umesh->setCoords(cc);
MEDFileUMeshSplitL1::ClearNonDiscrAttributes(umesh);
+ umesh->setName(getName());
return umesh;
}
}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "NormalizedUnstructuredMesh.hxx"
-extern "C"
-{
#include "med.h"
-}
namespace ParaMEDMEM
{
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "MEDCouplingCMesh.hxx"
#include "MEDCouplingAutoRefCountObjectPtr.hxx"
-extern "C"
-{
#include "med.h"
-}
#include <map>
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "InterpKernelException.hxx"
#include "MEDLoaderDefines.hxx"
-extern "C"
-{
#include "med.h"
-}
namespace MEDFileUtilities
{
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "InterpKernelAutoPtr.hxx"
-extern "C"
-{
#include "med.h"
-}
#include <string>
#include <limits>
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
if ( !pfl2sm->second )
{
SubMesh* sm = pfl2sm->second = addSubMesh( "", dimRelExt ); // no names for profiles
- const DataArrayInt * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl] );
+ const DataArrayInt * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() );
makeProfileIDs( sm, types[iType], pfl );
}
}
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
std::vector<std::string> getLocs() const;
virtual std::vector<std::string> getPflsReallyUsed() const = 0;
virtual std::vector<std::string> getLocsReallyUsed() const = 0;
+ virtual std::vector<std::string> getPflsReallyUsedMulti() const = 0;
+ virtual std::vector<std::string> getLocsReallyUsedMulti() const = 0;
+ void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
+ void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
+ void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
+ void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
%extend
{
- PyObject *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception)
+ PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
{
const DataArrayInt *ret=self->getProfile(pflName);
if(ret)
return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
+ PyObject *getProfileFromId(int pflId) const throw(INTERP_KERNEL::Exception)
+ {
+ const DataArrayInt *ret=self->getProfileFromId(pflId);
+ if(ret)
+ ret->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
+ }
+
PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
{
const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
}
- PyObject *getLocalization(const char *pflName) const throw(INTERP_KERNEL::Exception)
+ PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
{
- const MEDFileFieldLoc *loc=&self->getLocalization(pflName);
+ const MEDFileFieldLoc *loc=&self->getLocalization(locName);
loc->incrRef();
return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
}
+
+ PyObject *zipPflsNames() throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipPflsNames();
+ return convertVecPairVecStToPy(ret);
+ }
+
+ PyObject *zipLocsNames(double eps) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > ret=self->zipLocsNames(eps);
+ return convertVecPairVecStToPy(ret);
+ }
+
+ void changePflsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changePflsNames(v);
+ }
+
+ void changePflsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changePflsRefsNamesGen(v);
+ }
+
+ void changePflsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changePflsNamesInStruct(v);
+ }
+
+ void changeLocsNames(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changeLocsNames(v);
+ }
+
+ void changeLocsRefsNamesGen(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changeLocsRefsNamesGen(v);
+ }
+
+ void changeLocsNamesInStruct(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
+ self->changeLocsNamesInStruct(v);
+ }
}
};
//
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);
+ void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
+ void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
%extend
{
std::string __str__() const
PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
+
+ void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
+ {
+ self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
+ }
+
+ void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
+ {
+ self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
+ }
}
};
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
da=DataArrayInt.New(); da.alloc(9,1) ; da.iota(0) ; da.setName("sup1")
#
ff1.setFieldProfile(f1,mm1,0,da)
+ ff1.changePflsNames([(["sup1_NORM_QUAD4"],"ForV650")])
ff1.write(fname,0)
#
vals,pfl=ff1.getFieldWithProfile(ON_CELLS,0,mm1) ; vals.setName("")
self.assertEqual([7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18],sbt[0][1][0][1].getValues())# values for TRI3
self.assertEqual(4,sbt[1][0])#QUAD4
self.assertEqual(0,sbt[1][1][0][0])#CELL For QUAD4
- self.assertEqual("sup1_NORM_QUAD4",sbt[1][1][0][2])# profile For QUAD4
+ self.assertEqual("ForV650",sbt[1][1][0][2])# profile For QUAD4
self.assertEqual([19, 20, 21, 22, 23, 24],sbt[1][1][0][1].getValues())# values for QUAD4
self.assertEqual([0],ff2.getTypesOfFieldAvailable())
vals,pfl=ff2.getFieldWithProfile(ON_CELLS,0,mm1) ; vals.setName("")
self.assertEqual(ff2.getNonEmptyLevels(),(1, [0,-1]))
self.assertEqual(ff2.getFieldSplitedByType(),[(0, [(0, (0, 4), '', '')]), (1, [(0, (4, 84), '', '')])])
pass
+
+ def testFieldOnPflRetrieveOnMdimRelMax1(self):
+ fname="Pyfile43.med"
+ m2,m1,m0,f2,f1,f0,p,n2,n1,n0,fns,fids,grpns,famIdsPerGrp=MEDLoaderDataForTest.buildMultiLevelMesh_1()
+ m=MEDFileUMesh.New()
+ m.setMeshAtLevel(0,m2)
+ m.setMeshAtLevel(-1,m1)
+ m.setMeshAtLevel(-2,m0)
+ f=MEDFileField1TS.New()
+ ff=MEDCouplingFieldDouble.New(ON_NODES,ONE_TIME)
+ ff.setName("NodeFieldPfl")
+ arr=DataArrayDouble.New() ; arr.setValues([1.,10.,100.,2.,20.,200.],2,3)
+ ff.setArray(arr)
+ pfl=DataArrayInt.New() ; pfl.setValues([2,3],2,1) ; pfl.setName("PflNode")
+ f.setFieldProfile(ff,m,-2,pfl)
+ tes0=f.getFieldOnMeshAtLevel(ON_NODES,-1,m)
+ self.assertEqual(ON_NODES,tes0.getTypeOfField())
+ self.assertEqual(1,tes0.getMesh().getMeshDimension())
+ self.assertEqual(1,tes0.getMesh().getNumberOfCells())
+ self.assertEqual(2,tes0.getMesh().getNumberOfNodes())
+ self.assertEqual([1,0,1],tes0.getMesh().getNodalConnectivity().getValues())
+ self.assertEqual([0,3],tes0.getMesh().getNodalConnectivityIndex().getValues())
+ self.assertEqual(2,tes0.getArray().getNumberOfTuples())
+ self.assertEqual(3,tes0.getArray().getNumberOfComponents())
+ expected1=[1.,10.,100.,2.,20.,200.]
+ nodeCoordsWithValue1=[10.,2.5,0.]
+ nodeCoordsWithValue2=[10.,3.75,0.]
+ for i in xrange(3):
+ self.assertAlmostEqual(nodeCoordsWithValue1[i],tes0.getMesh().getCoordinatesOfNode(0)[i],13);
+ self.assertAlmostEqual(nodeCoordsWithValue2[i],tes0.getMesh().getCoordinatesOfNode(1)[i],13);
+ pass
+ for i in xrange(6):
+ self.assertAlmostEqual(expected1[i],tes0.getArray().getIJ(0,i),13);
+ pass
+ del tes0
+ #
+ tes1=f.getFieldOnMeshAtLevel(ON_NODES,1,m)
+ self.assertEqual(ON_CELLS,tes1.getTypeOfField())# it is not a bug even if ON_NODES has been sepecified
+ self.assertEqual(0,tes1.getMesh().getMeshDimension())
+ self.assertEqual(2,tes1.getMesh().getNumberOfCells())
+ self.assertEqual(135,tes1.getMesh().getNumberOfNodes())
+ self.assertEqual([0,2,0,3],tes1.getMesh().getNodalConnectivity().getValues())
+ self.assertEqual([0,2,4],tes1.getMesh().getNodalConnectivityIndex().getValues())
+ self.assertEqual(2,tes1.getArray().getNumberOfTuples())
+ self.assertEqual(3,tes1.getArray().getNumberOfComponents())
+ for i in xrange(6):
+ self.assertAlmostEqual(expected1[i],tes1.getArray().getIJ(0,i),13);
+ pass
+ m.write(fname,2)
+ f.write(fname,0)
+ #
+ pfl=DataArrayInt.New() ; pfl.setValues([3,2],2,1) ; pfl.setName("PflNode")
+ f=MEDFileField1TS.New()
+ f.setFieldProfile(ff,m,-2,pfl)
+ tes2=f.getFieldOnMeshAtLevel(ON_NODES,-1,m)
+ self.assertEqual(ON_NODES,tes2.getTypeOfField())
+ self.assertEqual(1,tes2.getMesh().getMeshDimension())
+ self.assertEqual(1,tes2.getMesh().getNumberOfCells())
+ self.assertEqual(2,tes2.getMesh().getNumberOfNodes())
+ self.assertEqual([1,0,1],tes2.getMesh().getNodalConnectivity().getValues())
+ self.assertEqual([0,3],tes2.getMesh().getNodalConnectivityIndex().getValues())
+ self.assertEqual(2,tes2.getArray().getNumberOfTuples())
+ self.assertEqual(3,tes2.getArray().getNumberOfComponents())
+ expected2=[2.,20.,200.,1.,10.,100.]
+ for i in xrange(3):
+ self.assertAlmostEqual(nodeCoordsWithValue1[i],tes2.getMesh().getCoordinatesOfNode(0)[i],13);
+ self.assertAlmostEqual(nodeCoordsWithValue2[i],tes2.getMesh().getCoordinatesOfNode(1)[i],13);
+ pass
+ for i in xrange(6):
+ self.assertAlmostEqual(expected2[i],tes2.getArray().getIJ(0,i),13);#compare tes2 and tes3
+ pass
+ #
+ tes3=f.getFieldOnMeshAtLevel(ON_NODES,1,m)
+ self.assertEqual(ON_CELLS,tes3.getTypeOfField())# it is not a bug even if ON_NODES has been sepecified
+ self.assertEqual(0,tes3.getMesh().getMeshDimension())
+ self.assertEqual(2,tes3.getMesh().getNumberOfCells())
+ self.assertEqual(135,tes3.getMesh().getNumberOfNodes())
+ self.assertEqual([0,3,0,2],tes3.getMesh().getNodalConnectivity().getValues())
+ self.assertEqual([0,2,4],tes3.getMesh().getNodalConnectivityIndex().getValues())
+ self.assertEqual(2,tes3.getArray().getNumberOfTuples())
+ self.assertEqual(3,tes3.getArray().getNumberOfComponents())
+ for i in xrange(6):
+ self.assertAlmostEqual(expected1[i],tes3.getArray().getIJ(0,i),13);
+ pass
+ pass
pass
unittest.main()
-
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
}
return ret;
}
+
+PyObject *convertVecPairVecStToPy(const std::vector< std::pair<std::vector<std::string>, std::string > >& vec)
+{
+ int sz=(int)vec.size();
+ PyObject *ret=PyList_New(sz);
+ for(int i=0;i<sz;i++)
+ {
+ PyObject *t=PyTuple_New(2);
+ int sz2=(int)vec[i].first.size();
+ PyObject *ll=PyList_New(sz2);
+ for(int j=0;j<sz2;j++)
+ PyList_SetItem(ll,j,PyString_FromString(vec[i].first[j].c_str()));
+ PyTuple_SetItem(t,0,ll);
+ PyTuple_SetItem(t,1,PyString_FromString(vec[i].second.c_str()));
+ PyList_SetItem(ret,i,t);
+ }
+ return ret;
+}
+
+std::vector< std::pair<std::vector<std::string>, std::string > > convertVecPairVecStFromPy(PyObject *pyLi)
+{
+ std::vector< std::pair<std::vector<std::string>, std::string > > ret;
+ const char *msg="convertVecPairVecStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tupe is a list of strings and the 2nd one a string !";
+ if(PyList_Check(pyLi))
+ {
+ int size=PyList_Size(pyLi);
+ ret.resize(size);
+ for(int i=0;i<size;i++)
+ {
+ PyObject *o=PyList_GetItem(pyLi,i);
+ if(PyTuple_Check(o))
+ {
+ std::pair<std::vector<std::string>, std::string> p;
+ int size2=PyTuple_Size(o);
+ if(size2!=2)
+ throw INTERP_KERNEL::Exception(msg);
+ PyObject *o0=PyTuple_GetItem(o,0);
+ if(PyList_Check(o0))
+ {
+ int size2=PyList_Size(o0);
+ p.first.resize(size2);
+ for(int j=0;j<size2;j++)
+ {
+ PyObject *o0j=PyList_GetItem(o0,j);
+ if(PyString_Check(o0j))
+ {
+ p.first[j]=std::string(PyString_AsString(o0j));
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ PyObject *o1=PyTuple_GetItem(o,1);
+ if(PyString_Check(o1))
+ p.second=std::string(PyString_AsString(o1));
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ ret[i]=p;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ return ret;
+ }
+ throw INTERP_KERNEL::Exception(msg);
+}
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
SET(medpartitionercpp_HEADERS_HXX ${medpartitionercpp_HEADERS_HXX} MEDPARTITIONER_JointFinder.hxx MEDPARTITIONER_MetisGraph.hxx)
SET(medpartitionercpp_FLAGS "${medpartitionercpp_FLAGS} ${MPI_FLAGS} ${PARMETIS_FLAGS}")
SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${PARMETIS_LIBS} ${MPI_LIBS})
+ ELSE(MED_ENABLE_PARMETIS)
+ SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES}
+ MEDPARTITIONER_UtilsPara.cxx
+ MEDPARTITIONER_JointFinder.cxx
+ )
+ SET(medpartitionercpp_FLAGS "${medpartitionercpp_FLAGS} ${MPI_FLAGS}")
+ SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${MPI_LIBS})
ENDIF(MED_ENABLE_PARMETIS)
ELSE(MPI_IS_OK)
IF(MED_ENABLE_METIS)
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
-extern "C"
-{
#include "med.h"
-}
using namespace MEDPARTITIONER;
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <fstream>
#include <sstream>
#include <iostream>
+#ifdef WIN32
+#include <time.h>
+#include <windows.h>
+#endif
+
#include <libxml/tree.h>
#include <libxml/parser.h>
xmlNewProp(node, BAD_CAST "ver", BAD_CAST "1");
//Description tag
- time_t present;
+ time_t present;
+ char date[6];
+#ifndef WIN32
time( &present);
struct tm *time_asc = localtime(&present);
- char date[6];
sprintf(date,"%02d%02d%02d",time_asc->tm_year
,time_asc->tm_mon+1
,time_asc->tm_mday);
+#else
+ SYSTEMTIME st;
+ GetLocalTime ( &st );
+ sprintf(date,"%02d%02d%02d",
+ st.wYear
+ ,st.wMonth
+ ,st.wDay);
+#endif
node = xmlNewChild(root_node,0, BAD_CAST "description",0);
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
setSize(200,300,500); //nb of hexa9
}
+std::string MEDPARTITIONERTest::getPartitionerExe() const
+{
+ std::string execName;
+ if ( getenv("top_builddir")) // make distcheck
+ {
+ execName = getenv("top_builddir");
+ execName += "/src/MEDPartitioner/medpartitioner";
+ }
+ else if ( getenv("MED_ROOT_DIR") )
+ {
+ execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED
+ execName+="/bin/salome/medpartitioner";
+ }
+ else
+ {
+ CPPUNIT_FAIL("Can't find medpartitioner, neither MED_ROOT_DIR nor top_builddir is set");
+ }
+ return execName;
+}
// ============================================================================
/*!
int res;
string cmd,execName,sourceName,targetName;
- execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED
- execName+="/bin/salome/medpartitioner";
+ execName=getPartitionerExe();
cmd="which "+execName+" 2>/dev/null 1>/dev/null"; //no trace
res=system(cmd.c_str());
- CPPUNIT_ASSERT_EQUAL(0, res);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(execName + " - INVALID PATH TO medpartitioner", 0, res);
cmd=execName+" --ndomains=2 --split-method="+MetisOrScotch; //on same proc
sourceName=_file_name;
{
int res;
string fileName,cmd,execName,sourceName,targetName,input;
- execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED
- execName+="/bin/salome/medpartitioner";
+ execName=getPartitionerExe();
fileName=_file_name_with_faces;
ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
{
int res;
string fileName,cmd,execName,sourceName,targetName,input;
- execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED
- execName+="/bin/salome/medpartitioner";
+ execName=getPartitionerExe();
fileName=_file_name;
fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnCells.med");
{
int res;
string fileName,cmd,execName,sourceName,targetName,input;
- execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED
- execName+="/bin/salome/medpartitioner";
+ execName=getPartitionerExe();
fileName=_file_name;
fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnGaussNe.med");
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#ifndef __MEDPARTITIONERTEST_HXX__
#define __MEDPARTITIONERTEST_HXX__
+#ifdef WIN32
+# if defined MEDPARTITIONERTEST_EXPORTS || defined MEDPARTITIONERTest_EXPORTS
+# define MEDPARTITIONERTEST_EXPORT __declspec( dllexport )
+# else
+# define MEDPARTITIONERTEST_EXPORT __declspec( dllimport )
+# endif
+#else
+# define MEDPARTITIONERTEST_EXPORT
+#endif
+
+
#include <cppunit/extensions/HelperMacros.h>
#include <set>
#include "MEDCouplingExtrudedMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
-class MEDPARTITIONERTest : public CppUnit::TestFixture
+class MEDPARTITIONERTEST_EXPORT MEDPARTITIONERTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( MEDPARTITIONERTest );
CPPUNIT_TEST( testMeshCollectionSingle );
void setSmallSize();
void setMedianSize();
void setbigSize();
+ std::string getPartitionerExe() const;
ParaMEDMEM::MEDCouplingUMesh * buildCUBE3DMesh();
ParaMEDMEM::MEDCouplingUMesh * buildFACE3DMesh();
ParaMEDMEM::MEDCouplingUMesh * buildCARRE3DMesh();
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
${PYTHON_INCLUDES_DIR}
${MED3_INCLUDES_DIR}
${HDF5_INCLUDES_DIR}
+ ${BOOST_INCLUDES_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../MEDSPLITTER
${CMAKE_CURRENT_SOURCE_DIR}/../MEDMEM
SWIG_ADD_MODULE(libMEDSPLITTER_Swig python libMEDSPLITTER_Swig.i)
SWIG_LINK_LIBRARIES(libMEDSPLITTER_Swig ${PYTHON_LIBRARIES} medsplittercpp)
+SET_TARGET_PROPERTIES(_libMEDSPLITTER_Swig PROPERTIES COMPILE_FLAGS "${BOOST_FLAGS}")
INSTALL(TARGETS _libMEDSPLITTER_Swig DESTINATION ${MED_salomepythondir})
INSTALL(FILES libMEDSPLITTER_Swig.i DESTINATION ${MED_salomeinclude_HEADERS})
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
renumbering.cxx
)
+SET(renumbercpp_LDFLAGS medmem)
SET(renumber_FLAGS "${HDF5_FLAGS} ${MED3_FLAGS} ${BOOST_FLAGS}")
IF(MED_ENABLE_METIS)
SET(renumbercpp_SOURCES ${renumbercpp_SOURCES} RENUMBER_METISRenumbering.cxx)
SET(renumbercpp_HEADERS_HXX ${renumbercpp_HEADERS_HXX} RENUMBER_METISRenumbering.hxx)
+ SET(renumbercpp_LDFLAGS ${renumbercpp_LDFLAGS} ${METIS_LIBS})
SET(renumber_FLAGS "${renumber_FLAGS} ${METIS_FLAGS}")
ENDIF(MED_ENABLE_METIS)
IF(BOOST_STATUS)
SET(renumbercpp_SOURCES ${renumbercpp_SOURCES} RENUMBER_BOOSTRenumbering.cxx)
SET(renumbercpp_HEADERS_HXX ${renumbercpp_HEADERS_HXX} RENUMBER_BOOSTRenumbering.hxx)
+ SET(renumbercpp_LDFLAGS ${renumbercpp_LDFLAGS} ${BOOST_LIBS})
SET(renumber_FLAGS "${renumber_FLAGS} ${BOOST_FLAGS} -DENABLE_BOOST")
ENDIF(BOOST_STATUS)
ADD_LIBRARY(renumbercpp SHARED ${renumbercpp_SOURCES})
SET_TARGET_PROPERTIES(renumbercpp PROPERTIES COMPILE_FLAGS "${renumber_FLAGS}")
-TARGET_LINK_LIBRARIES(renumbercpp medmem)
+TARGET_LINK_LIBRARIES(renumbercpp ${renumbercpp_LDFLAGS})
INSTALL(TARGETS renumbercpp DESTINATION ${MED_salomelib_LIBS})
INSTALL(FILES ${renumbercpp_HEADERS_HXX} DESTINATION ${MED_salomeinclude_HEADERS})
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
-// Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2011 CEA/DEN, EDF R&D
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public