Commit 625fdd4d authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Removed function decomposeMesh and methods configSetup and setup from distributed grid

Setting up a distributed grid will be solved with a mesh reader via the
function loadDistributedMesh.
parent bcfb4472
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -47,11 +47,6 @@ class DistributedMesh< Grid< Dimension, Real, Device, Index > >

      ~DistributedMesh();

      static void configSetup( Config::ConfigDescription& config );

      bool setup( const Config::ParameterContainer& parameters,
                  const String& prefix );

      void setDomainDecomposition( const CoordinatesType& domainDecomposition );

      const CoordinatesType& getDomainDecomposition() const;
+0 −25
Original line number Diff line number Diff line
@@ -30,31 +30,6 @@ DistributedMesh< Grid< Dimension, Real, Device, Index > >::
{
}


template<int Dimension, typename Real, typename Device, typename Index >
void
DistributedMesh< Grid< Dimension, Real, Device, Index > >::
configSetup( Config::ConfigDescription& config )
{
   config.addEntry< int >( "grid-domain-decomposition-x", "Number of grid subdomains along x-axis.", 0 );
   config.addEntry< int >( "grid-domain-decomposition-y", "Number of grid subdomains along y-axis.", 0 );
   config.addEntry< int >( "grid-domain-decomposition-z", "Number of grid subdomains along z-axis.", 0 );
}

template<int Dimension, typename Real, typename Device, typename Index >
bool
DistributedMesh< Grid< Dimension, Real, Device, Index > >::
setup( const Config::ParameterContainer& parameters,
       const String& prefix )
{
   this->domainDecomposition[ 0 ] = parameters.getParameter< int >( "grid-domain-decomposition-x" );
   if( Dimension > 1 )
      this->domainDecomposition[ 1 ] = parameters.getParameter< int >( "grid-domain-decomposition-y" );
   if( Dimension > 2 )
      this->domainDecomposition[ 2 ] = parameters.getParameter< int >( "grid-domain-decomposition-z" );
   return true;
}

template< int Dimension, typename Real, typename Device, typename Index >
void
DistributedMesh< Grid< Dimension, Real, Device, Index > >::
+0 −22
Original line number Diff line number Diff line
@@ -41,16 +41,6 @@ loadDistributedMesh( Mesh< MeshConfig, Device >& mesh,
                     const std::string& fileName,
                     const std::string& fileFormat = "auto" );

template< typename Problem,
          typename MeshConfig,
          typename Device >
bool
decomposeMesh( const Config::ParameterContainer& parameters,
               const std::string& prefix,
               Mesh< MeshConfig, Device >& mesh,
               DistributedMeshes::DistributedMesh< Mesh< MeshConfig, Device > >& distributedMesh,
               Problem& problem );

// overloads for grids
template< int Dimension,
          typename Real,
@@ -62,18 +52,6 @@ loadDistributedMesh( Grid< Dimension, Real, Device, Index >& mesh,
                     const std::string& fileName,
                     const std::string& fileFormat = "auto" );

template< typename Problem,
          int Dimension,
          typename Real,
          typename Device,
          typename Index >
bool
decomposeMesh( const Config::ParameterContainer& parameters,
               const std::string& prefix,
               Grid< Dimension, Real, Device, Index >& mesh,
               DistributedMeshes::DistributedMesh< Grid< Dimension, Real, Device, Index > > &distributedMesh,
               Problem& problem );

} // namespace Meshes
} // namespace TNL

+0 −61
Original line number Diff line number Diff line
@@ -128,20 +128,6 @@ loadDistributedMesh( Mesh< MeshConfig, Device >& mesh,
   }
}

template< typename Problem,
          typename MeshConfig,
          typename Device >
bool
decomposeMesh( const Config::ParameterContainer& parameters,
               const std::string& prefix,
               Mesh< MeshConfig, Device >& mesh,
               DistributedMeshes::DistributedMesh< Mesh< MeshConfig, Device > >& distributedMesh,
               Problem& problem )
{
   std::cerr << "Distributed Mesh is not supported yet, only Distributed Grid is supported.";
   return false;
}

// overloads for grids
template< int Dimension,
          typename Real,
@@ -153,57 +139,10 @@ loadDistributedMesh( Grid< Dimension, Real, Device, Index >& mesh,
                     const std::string& fileName,
                     const std::string& fileFormat )
{
/*
   std::cout << "Loading a global mesh from the file " << fileName << "...";
   Grid< Dimension, Real, Device, Index > globalGrid;
   try
   {
      globalGrid.load( fileName );
   }
   catch(...)
   {
      std::cerr << std::endl;
      std::cerr << "I am not able to load the global mesh from the file " << fileName << "." << std::endl;
      return false;
   }
   std::cout << " [ OK ] " << std::endl;

   typename Meshes::DistributedMeshes::DistributedMesh<Grid< Dimension, Real, Device, Index >>::SubdomainOverlapsType overlap;
   distributedMesh.setGlobalGrid( globalGrid );
   distributedMesh.setupGrid(mesh);
   return true;
*/
   // TODO: implement a PVTI reader
   std::cerr << "Loading a distributed mesh from a " << fileFormat << " file is not implemented yet." << std::endl;
   return false;
}

template< typename Problem,
          int Dimension,
          typename Real,
          typename Device,
          typename Index >
bool
decomposeMesh( const Config::ParameterContainer& parameters,
               const std::string& prefix,
               Grid< Dimension, Real, Device, Index >& mesh,
               DistributedMeshes::DistributedMesh< Grid< Dimension, Real, Device, Index > > &distributedMesh,
               Problem& problem )
{
   using GridType = Grid< Dimension, Real, Device, Index >;
   using DistributedGridType = DistributedMeshes::DistributedMesh< GridType >;
   using SubdomainOverlapsType = typename DistributedGridType::SubdomainOverlapsType;

   SubdomainOverlapsType lower( 0 ), upper( 0 );
   distributedMesh.setOverlaps( lower, upper );
   distributedMesh.setupGrid( mesh );

   problem.getSubdomainOverlaps( parameters, prefix, mesh, lower, upper  );
   distributedMesh.setOverlaps( lower, upper );
   distributedMesh.setupGrid( mesh );

   return true;
}

} // namespace Meshes
} // namespace TNL
+0 −3
Original line number Diff line number Diff line
@@ -61,12 +61,9 @@ setup( const Config::ParameterContainer& parameters,
   //
   const String& meshFile = parameters.getParameter< String >( "mesh" );
   const String& meshFileFormat = parameters.getParameter< String >( "mesh-format" );
   this->distributedMesh.setup( parameters, prefix );
   if( Problem::CommunicatorType::isDistributed() ) {
      if( ! Meshes::loadDistributedMesh( *this->meshPointer, distributedMesh, meshFile, meshFileFormat ) )
         return false;
      if( ! Meshes::decomposeMesh< Problem >( parameters, prefix, *this->meshPointer, distributedMesh, *problem ) )
         return false;
   }
   else {
      if( ! Meshes::loadMesh( *this->meshPointer, meshFile, meshFileFormat ) )
Loading