Commit b387127c authored by Matouš Fencl's avatar Matouš Fencl Committed by Tomáš Oberhuber
Browse files

MPI ready in tnlDirectEikonal*

parent dd11f6e9
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@
#include <solvers/pde/tnlLinearSystemAssembler.h>
#include <functions/tnlMeshFunction.h>

#include <TNL/Meshes/DistributedMeshes/DistributedGridIO.h>

template< typename Mesh,
		    typename DifferentialOperator,
		    typename BoundaryCondition,
+4 −16
Original line number Diff line number Diff line
@@ -123,23 +123,11 @@ setInitialCondition( const Config::ParameterContainer& parameters,
{
  this->bindDofs( mesh, dofs );
  const String& initialConditionFile = parameters.getParameter< String >( "initial-condition" );
  if(CommunicatorType::isDistributed())
  {
    std::cout<<"Nodes Distribution: " << uPointer->getMesh().getDistributedMesh()->printProcessDistr() << std::endl;
    if(distributedIOType==Meshes::DistributedMeshes::MpiIO)
      Meshes::DistributedMeshes::DistributedGridIO<MeshFunctionType,Meshes::DistributedMeshes::MpiIO> ::load(initialConditionFile, *uPointer );
    if(distributedIOType==Meshes::DistributedMeshes::LocalCopy)
      Meshes::DistributedMeshes::DistributedGridIO<MeshFunctionType,Meshes::DistributedMeshes::LocalCopy> ::load(initialConditionFile, *uPointer );
    uPointer->template synchronize<CommunicatorType>();
  }
  else
  {
  if( ! this->solution.boundLoad( initialConditionFile ) )
  {
    std::cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." <<std::endl;
    return false;
  }
  }
  return true;
}

+3 −3
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ tnlDirectEikonalMethodsBase< Meshes::Grid< 2, Real, Device, Index > >::
updateBlocks( InterfaceMapType interfaceMap,
        MeshFunctionType aux,
        MeshFunctionType helpFunc,
        ArrayContainer BlockIterHost, IndexType numThreadsPerBlock/*, Real **sArray*/ )
        ArrayContainer BlockIterHost, int numThreadsPerBlock/*, Real **sArray*/ )
{
#pragma omp parallel for schedule( dynamic )
  for( IndexType i = 0; i < BlockIterHost.getSize(); i++ )
@@ -267,13 +267,13 @@ updateBlocks( InterfaceMapType interfaceMap,
template< typename Real,
        typename Device,
        typename Index >
template< IndexType sizeSArray >
template< int sizeSArray >
void
tnlDirectEikonalMethodsBase< Meshes::Grid< 3, Real, Device, Index > >::
updateBlocks( const InterfaceMapType interfaceMap,
        const MeshFunctionType aux,
        MeshFunctionType& helpFunc,
        ArrayContainer BlockIterHost, IndexType numThreadsPerBlock/*, Real **sArray*/ )
        ArrayContainer BlockIterHost, int numThreadsPerBlock/*, Real **sArray*/ )
{  
//#pragma omp parallel for schedule( dynamic )
  for( IndexType i = 0; i < BlockIterHost.getSize(); i++ )
+7 −1
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#include <TNL/Pointers/SharedPointer.h>
#include "tnlFastSweepingMethod.h"

#include <TNL/Meshes/DistributedMeshes/DistributedGridIO.h>

template< typename Mesh,
          typename Communicator,
          typename Anisotropy,
@@ -46,6 +48,8 @@ class tnlDirectEikonalProblem
      using MeshPointer = Pointers::SharedPointer< MeshType >;
      using DofVectorPointer = Pointers::SharedPointer< DofVectorType >;
      
      typedef Communicator CommunicatorType;
      
      static constexpr bool isTimeDependent() { return false; };

      static String getType();
@@ -79,6 +83,8 @@ class tnlDirectEikonalProblem
         
         AnisotropyPointer anisotropy;

         Meshes::DistributedMeshes::DistrGridIOTypes distributedIOType;
         
   };

#include "tnlDirectEikonalProblem_impl.h"
+20 −5
Original line number Diff line number Diff line
@@ -113,10 +113,25 @@ tnlDirectEikonalProblem< Mesh, Communicator, Anisotropy, Real, Index >::
setInitialCondition( const Config::ParameterContainer& parameters,
                     DofVectorPointer& dofs )
{
  this->bindDofs( dofs );
  String inputFile = parameters.getParameter< String >( "input-file" );
  this->initialData->setMesh( this->getMesh() );
  std::cout<<"setInitialCondition" <<std::endl; 
  if(CommunicatorType::isDistributed())
  {
    std::cout<<"Nodes Distribution: " << u->getMesh().getDistributedMesh()->printProcessDistr() << std::endl;
    if(distributedIOType==Meshes::DistributedMeshes::MpiIO)
      Meshes::DistributedMeshes::DistributedGridIO<MeshFunctionType,Meshes::DistributedMeshes::MpiIO> ::load(inputFile, *u );
    if(distributedIOType==Meshes::DistributedMeshes::LocalCopy)
      Meshes::DistributedMeshes::DistributedGridIO<MeshFunctionType,Meshes::DistributedMeshes::LocalCopy> ::load(inputFile, *u );
    u->template synchronize<CommunicatorType>();
  }
  else
  {
    if( !this->initialData->boundLoad( inputFile ) )
      std::cerr << "I am not able to load the initial condition from the file " << inputFile << "." << std::endl;
    return false;
  }
  return true;
}

Loading