Commit 6b9cd967 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Tomáš Oberhuber
Browse files

Fixed ambiguous specialization of DistributedGridIO.

parent e322f20e
Loading
Loading
Loading
Loading
+36 −28
Original line number Diff line number Diff line
@@ -21,19 +21,21 @@ namespace DistributedMeshes {
 * This variant cerate copy of MeshFunction but smaller, reduced to local entities, without overlap. 
 * It is slow and has high RAM consumption
 */
template< typename MeshFunction,
          int Dimension,
          typename Real,
template< int Dimension,
          int MeshEntityDimension,
          typename MeshReal,
          typename Device,
          typename Index > 
class DistributedGridIO< MeshFunction,
                         LocalCopy,
                         Meshes::Grid< Dimension, Real, Device, Index >,
                         Device >
          typename Index,
          typename Real >
class DistributedGridIO<
   Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Device, Index >,
      MeshEntityDimension,
      Real >,
   LocalCopy >
{
   public:
      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 PointType = typename MeshFunctionType::MeshType::PointType;
      using VectorType = typename MeshFunctionType::VectorType;
@@ -430,17 +432,20 @@ class DistributedGridIO_MPIIOBase
};
#endif

template< typename MeshFunction,
          int Dimension,
          typename Real,
          typename Index > 
class DistributedGridIO< MeshFunction,
                         MpiIO,
                         Meshes::Grid< Dimension, Real, Devices::Cuda, Index >,
                         Devices::Cuda >
template< int Dimension,
          int MeshEntityDimension,
          typename MeshReal,
          typename Index,
          typename Real >
class DistributedGridIO<
   Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Cuda, Index >,
      MeshEntityDimension,
      Real >,
   MpiIO >
{
   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)
      {
@@ -477,17 +482,20 @@ class DistributedGridIO< MeshFunction,
    };
};

template< typename MeshFunction,
          int Dimension,
          typename Real,
          typename Index > 
class DistributedGridIO< MeshFunction,
                         MpiIO,
                         Meshes::Grid< Dimension, Real, Devices::Host, Index >,
                         Devices::Host >
template< int Dimension,
          int MeshEntityDimension,
          typename MeshReal,
          typename Index,
          typename Real >
class DistributedGridIO<
   Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Devices::Host, Index >,
      MeshEntityDimension,
      Real >,
   MpiIO >
{
   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)
      {
+33 −21
Original line number Diff line number Diff line
@@ -17,19 +17,31 @@ namespace TNL {
namespace Meshes {
namespace DistributedMeshes {

template< int Size,
      typename MeshFunction,
template<
   int Size,
   int Dimension,
      typename Real,
   int MeshEntityDimension,
   typename MeshReal,
   typename Device,
      typename Index > 
class DistributedGridIO< Functions::VectorField< Size, MeshFunction >,
      MpiIO,
      Meshes::Grid< Dimension, Real, Device, Index >,
      Device >
   typename Index,
   typename Real >
class DistributedGridIO<
   Functions::VectorField<
      Size,
      Functions::MeshFunction< Meshes::Grid< Dimension, MeshReal, Device, Index >,
         MeshEntityDimension,
         Real > >,
   MpiIO >
{
   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
        if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed
@@ -58,8 +70,8 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >,
           
           for( int i = 0; i < vectorField.getVectorDimension(); i++ )
           {
               typename MeshFunction::RealType * data=vectorField[i]->getData().getData();  //here manage data transfer Device...
               int size = DistributedGridIO_MPIIOBase<MeshFunction>::save(file,*(vectorField[i]),data,offset);
               typename MeshFunctionType::RealType * data=vectorField[i]->getData().getData();  //here manage data transfer Device...
               int size = DistributedGridIO_MPIIOBase<MeshFunctionType>::save(file,*(vectorField[i]),data,offset);
               offset+=size;
               if( size==0  )
                  return false;
@@ -76,7 +88,7 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >,

#ifdef HAVE_MPI
	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;
		    int count;
@@ -100,7 +112,7 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >,
		    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;
            char buffer[255];
@@ -119,7 +131,7 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >,
#endif

    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
        if(Communicators::MpiCommunicator::IsInitialized())//i.e. - isUsed
@@ -148,8 +160,8 @@ class DistributedGridIO< Functions::VectorField< Size, MeshFunction >,
           
           for( int i = 0; i < vectorField.getVectorDimension(); i++ )
           {
               typename MeshFunction::RealType * data=vectorField[i]->getData().getData();  //here manage data transfer Device...
               int size = DistributedGridIO_MPIIOBase<MeshFunction>::load(file,*(vectorField[i]),data,offset);
               typename MeshFunctionType::RealType * data=vectorField[i]->getData().getData();  //here manage data transfer Device...
               int size = DistributedGridIO_MPIIOBase<MeshFunctionType>::load(file,*(vectorField[i]),data,offset);
               offset+=size;
               if( size==0  )
                  return false;