Loading src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h +36 −28 Original line number Original line Diff line number Diff line Loading @@ -21,19 +21,21 @@ namespace DistributedMeshes { * This variant cerate copy of MeshFunction but smaller, reduced to local entities, without overlap. * This variant cerate copy of MeshFunction but smaller, reduced to local entities, without overlap. * It is slow and has high RAM consumption * It is slow and has high RAM consumption */ */ template< typename MeshFunction, template< int Dimension, int Dimension, int MeshEntityDimension, typename Real, typename MeshReal, typename Device, typename Device, typename Index > typename Index, class DistributedGridIO< MeshFunction, typename Real > LocalCopy, class DistributedGridIO< Meshes::Grid< Dimension, Real, Device, Index >, Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Device, Index >, Device > MeshEntityDimension, Real >, LocalCopy > { { public: public: using MeshType = Meshes::Grid< Dimension, Real, Device, Index >; using MeshType = Meshes::Grid< Dimension, Real, Device, Index >; using MeshFunctionType = MeshFunction; using MeshFunctionType = Functions::MeshFunction< MeshType, MeshEntityDimension, Real >; using CoordinatesType = typename MeshFunctionType::MeshType::CoordinatesType; using CoordinatesType = typename MeshFunctionType::MeshType::CoordinatesType; using PointType = typename MeshFunctionType::MeshType::PointType; using PointType = typename MeshFunctionType::MeshType::PointType; using VectorType = typename MeshFunctionType::VectorType; using VectorType = typename MeshFunctionType::VectorType; Loading Loading @@ -430,17 +432,20 @@ class DistributedGridIO_MPIIOBase }; }; #endif #endif template< typename MeshFunction, template< int Dimension, int Dimension, int MeshEntityDimension, typename Real, typename MeshReal, typename Index > typename Index, class DistributedGridIO< MeshFunction, typename Real > MpiIO, class DistributedGridIO< Meshes::Grid< Dimension, Real, Devices::Cuda, Index >, Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Cuda, Index >, Devices::Cuda > MeshEntityDimension, Real >, MpiIO > { { public: public: using MeshFunctionType = MeshFunction; using MeshType = Meshes::Grid< Dimension, MeshReal, Devices::Cuda, Index >; using MeshFunctionType = Functions::MeshFunction< MeshType, MeshEntityDimension, Real >; static bool save(const String& fileName, MeshFunctionType &meshFunction) static bool save(const String& fileName, MeshFunctionType &meshFunction) { { Loading Loading @@ -477,17 +482,20 @@ class DistributedGridIO< MeshFunction, }; }; }; }; template< typename MeshFunction, template< int Dimension, int Dimension, int MeshEntityDimension, typename Real, typename MeshReal, typename Index > typename Index, class DistributedGridIO< MeshFunction, typename Real > MpiIO, class DistributedGridIO< Meshes::Grid< Dimension, Real, Devices::Host, Index >, Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Host, Index >, Devices::Host > MeshEntityDimension, Real >, MpiIO > { { public: public: using MeshFunctionType = MeshFunction; using MeshType = Meshes::Grid< Dimension, MeshReal, Devices::Host, Index >; using MeshFunctionType = Functions::MeshFunction< MeshType, MeshEntityDimension, Real >; static bool save(const String& fileName, MeshFunctionType &meshFunction) static bool save(const String& fileName, MeshFunctionType &meshFunction) { { Loading src/TNL/Meshes/DistributedMeshes/DistributedGridIO_VectorField.h +33 −21 Original line number Original line Diff line number Diff line Loading @@ -17,19 +17,31 @@ namespace TNL { namespace Meshes { namespace Meshes { namespace DistributedMeshes { namespace DistributedMeshes { template< int Size, template< typename MeshFunction, int Size, int Dimension, int Dimension, typename Real, int MeshEntityDimension, typename MeshReal, typename Device, typename Device, typename Index > typename Index, class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, typename Real > MpiIO, class DistributedGridIO< Meshes::Grid< Dimension, Real, Device, Index >, Functions::VectorField< Device > Size, Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Device, Index >, MeshEntityDimension, Real > >, MpiIO > { { public: public: static bool save(const String& fileName, Functions::VectorField<Size,MeshFunction > &vectorField) using MeshType = Meshes::Grid< Dimension, Real, Device, Index >; using MeshFunctionType = Functions::MeshFunction< MeshType, MeshEntityDimension, Real >; using VectorFieldType = Functions::VectorField< Size, MeshFunctionType >; using CoordinatesType = typename MeshFunctionType::MeshType::CoordinatesType; using PointType = typename MeshFunctionType::MeshType::PointType; using VectorType = typename MeshFunctionType::VectorType; static bool save(const String& fileName, Functions::VectorField< Size, MeshFunctionType > &vectorField) { { #ifdef HAVE_MPI #ifdef HAVE_MPI if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed Loading Loading @@ -58,8 +70,8 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, for( int i = 0; i < vectorField.getVectorDimension(); i++ ) for( int i = 0; i < vectorField.getVectorDimension(); i++ ) { { typename MeshFunction::RealType * data=vectorField[i]->getData().getData(); //here manage data transfer Device... typename MeshFunctionType::RealType * data=vectorField[i]->getData().getData(); //here manage data transfer Device... int size = DistributedGridIO_MPIIOBase<MeshFunction>::save(file,*(vectorField[i]),data,offset); int size = DistributedGridIO_MPIIOBase<MeshFunctionType>::save(file,*(vectorField[i]),data,offset); offset+=size; offset+=size; if( size==0 ) if( size==0 ) return false; return false; Loading @@ -76,7 +88,7 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, #ifdef HAVE_MPI #ifdef HAVE_MPI private: private: static unsigned int writeVectorFieldHeader(MPI_File &file,Functions::VectorField<Size,MeshFunction> &vectorField) static unsigned int writeVectorFieldHeader(MPI_File &file,Functions::VectorField<Size,MeshFunctionType > &vectorField) { { unsigned int size=0; unsigned int size=0; int count; int count; Loading @@ -100,7 +112,7 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, return size; return size; } } static unsigned int readVectorFieldHeader(MPI_File &file,Functions::VectorField<Size,MeshFunction> &vectorField) static unsigned int readVectorFieldHeader(MPI_File &file,Functions::VectorField<Size,MeshFunctionType> &vectorField) { { MPI_Status rstatus; MPI_Status rstatus; char buffer[255]; char buffer[255]; Loading @@ -119,7 +131,7 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, #endif #endif public: public: static bool load(const String& fileName, Functions::VectorField<Size,MeshFunction> &vectorField) static bool load(const String& fileName, Functions::VectorField<Size,MeshFunctionType> &vectorField) { { #ifdef HAVE_MPI #ifdef HAVE_MPI if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed Loading Loading @@ -148,8 +160,8 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, for( int i = 0; i < vectorField.getVectorDimension(); i++ ) for( int i = 0; i < vectorField.getVectorDimension(); i++ ) { { typename MeshFunction::RealType * data=vectorField[i]->getData().getData(); //here manage data transfer Device... typename MeshFunctionType::RealType * data=vectorField[i]->getData().getData(); //here manage data transfer Device... int size = DistributedGridIO_MPIIOBase<MeshFunction>::load(file,*(vectorField[i]),data,offset); int size = DistributedGridIO_MPIIOBase<MeshFunctionType>::load(file,*(vectorField[i]),data,offset); offset+=size; offset+=size; if( size==0 ) if( size==0 ) return false; return false; Loading Loading
src/TNL/Meshes/DistributedMeshes/DistributedGridIO_MeshFunction.h +36 −28 Original line number Original line Diff line number Diff line Loading @@ -21,19 +21,21 @@ namespace DistributedMeshes { * This variant cerate copy of MeshFunction but smaller, reduced to local entities, without overlap. * This variant cerate copy of MeshFunction but smaller, reduced to local entities, without overlap. * It is slow and has high RAM consumption * It is slow and has high RAM consumption */ */ template< typename MeshFunction, template< int Dimension, int Dimension, int MeshEntityDimension, typename Real, typename MeshReal, typename Device, typename Device, typename Index > typename Index, class DistributedGridIO< MeshFunction, typename Real > LocalCopy, class DistributedGridIO< Meshes::Grid< Dimension, Real, Device, Index >, Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Device, Index >, Device > MeshEntityDimension, Real >, LocalCopy > { { public: public: using MeshType = Meshes::Grid< Dimension, Real, Device, Index >; using MeshType = Meshes::Grid< Dimension, Real, Device, Index >; using MeshFunctionType = MeshFunction; using MeshFunctionType = Functions::MeshFunction< MeshType, MeshEntityDimension, Real >; using CoordinatesType = typename MeshFunctionType::MeshType::CoordinatesType; using CoordinatesType = typename MeshFunctionType::MeshType::CoordinatesType; using PointType = typename MeshFunctionType::MeshType::PointType; using PointType = typename MeshFunctionType::MeshType::PointType; using VectorType = typename MeshFunctionType::VectorType; using VectorType = typename MeshFunctionType::VectorType; Loading Loading @@ -430,17 +432,20 @@ class DistributedGridIO_MPIIOBase }; }; #endif #endif template< typename MeshFunction, template< int Dimension, int Dimension, int MeshEntityDimension, typename Real, typename MeshReal, typename Index > typename Index, class DistributedGridIO< MeshFunction, typename Real > MpiIO, class DistributedGridIO< Meshes::Grid< Dimension, Real, Devices::Cuda, Index >, Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Cuda, Index >, Devices::Cuda > MeshEntityDimension, Real >, MpiIO > { { public: public: using MeshFunctionType = MeshFunction; using MeshType = Meshes::Grid< Dimension, MeshReal, Devices::Cuda, Index >; using MeshFunctionType = Functions::MeshFunction< MeshType, MeshEntityDimension, Real >; static bool save(const String& fileName, MeshFunctionType &meshFunction) static bool save(const String& fileName, MeshFunctionType &meshFunction) { { Loading Loading @@ -477,17 +482,20 @@ class DistributedGridIO< MeshFunction, }; }; }; }; template< typename MeshFunction, template< int Dimension, int Dimension, int MeshEntityDimension, typename Real, typename MeshReal, typename Index > typename Index, class DistributedGridIO< MeshFunction, typename Real > MpiIO, class DistributedGridIO< Meshes::Grid< Dimension, Real, Devices::Host, Index >, Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Host, Index >, Devices::Host > MeshEntityDimension, Real >, MpiIO > { { public: public: using MeshFunctionType = MeshFunction; using MeshType = Meshes::Grid< Dimension, MeshReal, Devices::Host, Index >; using MeshFunctionType = Functions::MeshFunction< MeshType, MeshEntityDimension, Real >; static bool save(const String& fileName, MeshFunctionType &meshFunction) static bool save(const String& fileName, MeshFunctionType &meshFunction) { { Loading
src/TNL/Meshes/DistributedMeshes/DistributedGridIO_VectorField.h +33 −21 Original line number Original line Diff line number Diff line Loading @@ -17,19 +17,31 @@ namespace TNL { namespace Meshes { namespace Meshes { namespace DistributedMeshes { namespace DistributedMeshes { template< int Size, template< typename MeshFunction, int Size, int Dimension, int Dimension, typename Real, int MeshEntityDimension, typename MeshReal, typename Device, typename Device, typename Index > typename Index, class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, typename Real > MpiIO, class DistributedGridIO< Meshes::Grid< Dimension, Real, Device, Index >, Functions::VectorField< Device > Size, Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Device, Index >, MeshEntityDimension, Real > >, MpiIO > { { public: public: static bool save(const String& fileName, Functions::VectorField<Size,MeshFunction > &vectorField) using MeshType = Meshes::Grid< Dimension, Real, Device, Index >; using MeshFunctionType = Functions::MeshFunction< MeshType, MeshEntityDimension, Real >; using VectorFieldType = Functions::VectorField< Size, MeshFunctionType >; using CoordinatesType = typename MeshFunctionType::MeshType::CoordinatesType; using PointType = typename MeshFunctionType::MeshType::PointType; using VectorType = typename MeshFunctionType::VectorType; static bool save(const String& fileName, Functions::VectorField< Size, MeshFunctionType > &vectorField) { { #ifdef HAVE_MPI #ifdef HAVE_MPI if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed Loading Loading @@ -58,8 +70,8 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, for( int i = 0; i < vectorField.getVectorDimension(); i++ ) for( int i = 0; i < vectorField.getVectorDimension(); i++ ) { { typename MeshFunction::RealType * data=vectorField[i]->getData().getData(); //here manage data transfer Device... typename MeshFunctionType::RealType * data=vectorField[i]->getData().getData(); //here manage data transfer Device... int size = DistributedGridIO_MPIIOBase<MeshFunction>::save(file,*(vectorField[i]),data,offset); int size = DistributedGridIO_MPIIOBase<MeshFunctionType>::save(file,*(vectorField[i]),data,offset); offset+=size; offset+=size; if( size==0 ) if( size==0 ) return false; return false; Loading @@ -76,7 +88,7 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, #ifdef HAVE_MPI #ifdef HAVE_MPI private: private: static unsigned int writeVectorFieldHeader(MPI_File &file,Functions::VectorField<Size,MeshFunction> &vectorField) static unsigned int writeVectorFieldHeader(MPI_File &file,Functions::VectorField<Size,MeshFunctionType > &vectorField) { { unsigned int size=0; unsigned int size=0; int count; int count; Loading @@ -100,7 +112,7 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, return size; return size; } } static unsigned int readVectorFieldHeader(MPI_File &file,Functions::VectorField<Size,MeshFunction> &vectorField) static unsigned int readVectorFieldHeader(MPI_File &file,Functions::VectorField<Size,MeshFunctionType> &vectorField) { { MPI_Status rstatus; MPI_Status rstatus; char buffer[255]; char buffer[255]; Loading @@ -119,7 +131,7 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, #endif #endif public: public: static bool load(const String& fileName, Functions::VectorField<Size,MeshFunction> &vectorField) static bool load(const String& fileName, Functions::VectorField<Size,MeshFunctionType> &vectorField) { { #ifdef HAVE_MPI #ifdef HAVE_MPI if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed Loading Loading @@ -148,8 +160,8 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >, for( int i = 0; i < vectorField.getVectorDimension(); i++ ) for( int i = 0; i < vectorField.getVectorDimension(); i++ ) { { typename MeshFunction::RealType * data=vectorField[i]->getData().getData(); //here manage data transfer Device... typename MeshFunctionType::RealType * data=vectorField[i]->getData().getData(); //here manage data transfer Device... int size = DistributedGridIO_MPIIOBase<MeshFunction>::load(file,*(vectorField[i]),data,offset); int size = DistributedGridIO_MPIIOBase<MeshFunctionType>::load(file,*(vectorField[i]),data,offset); offset+=size; offset+=size; if( size==0 ) if( size==0 ) return false; return false; Loading