From: Anthony Geay Date: Wed, 29 Apr 2020 07:59:16 +0000 (+0200) Subject: WIP X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=266f22aa023b8b3c29c2b7a94dbf2d8ff3d2611a;p=tools%2Fmedcoupling.git WIP --- diff --git a/src/ParaMEDMEM/CMakeLists.txt b/src/ParaMEDMEM/CMakeLists.txt index 6871cd11c..a6f0e37e3 100644 --- a/src/ParaMEDMEM/CMakeLists.txt +++ b/src/ParaMEDMEM/CMakeLists.txt @@ -43,6 +43,7 @@ SET(paramedmem_SOURCES CommInterface.cxx ParaUMesh.cxx ParaSkyLineArray.cxx + ParaDataArray.cxx ComponentTopology.cxx MPIAccess.cxx InterpolationMatrix.cxx @@ -74,5 +75,8 @@ INSTALL(TARGETS paramedmem EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCO FILE(GLOB paramedmem_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${paramedmem_HEADERS_HXX} DESTINATION ${MEDCOUPLING_INSTALL_HEADERS}) +FILE(GLOB paramedmem_HEADERS_TXX "${CMAKE_CURRENT_SOURCE_DIR}/*.txx") +INSTALL(FILES ${paramedmem_HEADERS_TXX} DESTINATION ${MEDCOUPLING_INSTALL_HEADERS}) + # To allow usage as SWIG dependencies: SET(paramedmem_HEADERS_HXX PARENT_SCOPE) diff --git a/src/ParaMEDMEM/ParaDataArray.cxx b/src/ParaMEDMEM/ParaDataArray.cxx new file mode 100644 index 000000000..8f1c73c07 --- /dev/null +++ b/src/ParaMEDMEM/ParaDataArray.cxx @@ -0,0 +1,26 @@ +// Copyright (C) 2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +#include "ParaDataArray.txx" + +using namespace MEDCoupling; + +template class ParaDataArrayTemplate; +template class ParaDataArrayTemplate; diff --git a/src/ParaMEDMEM/ParaDataArray.hxx b/src/ParaMEDMEM/ParaDataArray.hxx new file mode 100644 index 000000000..a6052f1a6 --- /dev/null +++ b/src/ParaMEDMEM/ParaDataArray.hxx @@ -0,0 +1,77 @@ +// Copyright (C) 2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +#pragma once + +#include "MEDCouplingMemArray.hxx" + +namespace MEDCoupling +{ + /*! + * Parallel representation of a DataArray + * + * This class is very specific to the requirement of parallel code computations. + */ + class ParaDataArray : public RefCountObject + { + }; + + template + class ParaDataArrayTemplate : public ParaDataArray + { + protected: + ParaDataArrayTemplate(typename Traits::ArrayType *seqDa); + protected: + std::size_t getHeapMemorySizeWithoutChildren() const override; + std::vector getDirectChildrenWithNull() const override; + void checkOKOneComponent(const std::string& msg); + private: + MCAuto::ArrayType> _seq_da; + }; + + template + class ParaDataArrayDiscrete : public ParaDataArrayTemplate + { + public: + typename Traits::ArrayType *buildComplement() const; + protected: + ParaDataArrayDiscrete(typename Traits::ArrayType *seqDa):ParaDataArrayTemplate(seqDa) { } + }; + + class ParaDataArrayInt32 : public ParaDataArrayDiscrete + { + private: + ParaDataArrayInt32(DataArrayInt32 *seqDa):ParaDataArrayDiscrete(seqDa) { } + std::string getClassName() const override { return "ParaDataArrayInt32"; } + }; + + class ParaDataArrayInt64 : public ParaDataArrayDiscrete + { + private: + ParaDataArrayInt64(DataArrayInt64 *seqDa):ParaDataArrayDiscrete(seqDa) { } + std::string getClassName() const override { return "ParaDataArrayInt64"; } + }; + + #ifndef MEDCOUPLING_USE_64BIT_IDS + using ParaDataArrayIdType = ParaDataArrayInt32; + #else + using ParaDataArrayIdType = ParaDataArrayInt64; + #endif +} diff --git a/src/ParaMEDMEM/ParaDataArray.txx b/src/ParaMEDMEM/ParaDataArray.txx new file mode 100644 index 000000000..83598a43f --- /dev/null +++ b/src/ParaMEDMEM/ParaDataArray.txx @@ -0,0 +1,72 @@ +// Copyright (C) 2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +#pragma once + +#include "ParaDataArray.hxx" + +#include + +namespace MEDCoupling +{ + template + ParaDataArrayTemplate::ParaDataArrayTemplate(typename Traits::ArrayType *seqDa) + { + this->_seq_da.takeRef(seqDa); + } + + template + std::size_t ParaDataArrayTemplate::getHeapMemorySizeWithoutChildren() const + { + return 0; + } + + template + std::vector ParaDataArrayTemplate::getDirectChildrenWithNull() const + { + return { this->_seq_da }; + } + + template + void ParaDataArrayTemplate::checkOKOneComponent(const std::string& msg) + { + if(this->_seq_da.isNull()) + { + std::ostringstream oss; oss << msg << " : nullptr internal pointer !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + this->_seq_da->checkAllocated(); + if( this->_seq_da->getNumberOfComponents()!=1 ) + { + std::ostringstream oss; oss << msg << " : internal seq dataarray does not contain one component as expected !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + } + + /*! + Parallel version of DataArrayInt::buildComplement. + */ + template + typename Traits::ArrayType *ParaDataArrayDiscrete::buildComplement() const + { + return nullptr; + } + +}