Skip to content

Commit

Permalink
wip: add load partitioned dataset for one partition
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Untereiner committed Sep 10, 2024
1 parent 8d73ee0 commit 0cc7fcb
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/coreComponents/mesh/generators/VTKMeshGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,16 @@ void VTKMeshGenerator::postInputInitialization()
GEOS_ERROR_IF ( m_repositoryName.empty() && !m_meshPath.empty(),
getName() << ": using a path in the repository for the mesh, you must supply a repository mode." );

ExternalDataRepositoryManager & externalDataManager = this->getGroupByPath< ExternalDataRepositoryManager >( "/Problem/ExternalDataRepository" );
// objectRepository.
m_repository = externalDataManager.getGroupPointer< VTKHierarchicalDataRepository >( m_repositoryName );

GEOS_THROW_IF( m_repository == nullptr,
getName() << ": VTK Data Object Repository not found: " << m_repositoryName,
InputError );
if( !m_repositoryName.empty())
{
ExternalDataRepositoryManager & externalDataManager = this->getGroupByPath< ExternalDataRepositoryManager >( "/Problem/ExternalDataRepository" );

Check warning on line 108 in src/coreComponents/mesh/generators/VTKMeshGenerator.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKMeshGenerator.cpp#L108

Added line #L108 was not covered by tests
// objectRepository.
m_repository = externalDataManager.getGroupPointer< VTKHierarchicalDataRepository >( m_repositoryName );

Check warning on line 110 in src/coreComponents/mesh/generators/VTKMeshGenerator.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKMeshGenerator.cpp#L110

Added line #L110 was not covered by tests

GEOS_THROW_IF( m_repository == nullptr,

Check warning on line 112 in src/coreComponents/mesh/generators/VTKMeshGenerator.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKMeshGenerator.cpp#L112

Added line #L112 was not covered by tests
getName() << ": VTK Data Object Repository not found: " << m_repositoryName,
InputError );
}

}

Expand All @@ -136,7 +138,7 @@ void VTKMeshGenerator::fillCellBlockManager( CellBlockManager & cellBlockManager
else if( !m_repositoryName.empty())

Check warning on line 138 in src/coreComponents/mesh/generators/VTKMeshGenerator.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKMeshGenerator.cpp#L138

Added line #L138 was not covered by tests
{
vtkSmartPointer< vtkPartitionedDataSet > partitions = m_repository->search( m_meshPath );
// allMeshes = vtk::loadPartitions(partitions);
allMeshes = vtk::loadPartitions( partitions );

Check warning on line 141 in src/coreComponents/mesh/generators/VTKMeshGenerator.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKMeshGenerator.cpp#L140-L141

Added lines #L140 - L141 were not covered by tests
}


Expand Down
19 changes: 19 additions & 0 deletions src/coreComponents/mesh/generators/VTKUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,25 @@ AllMeshes loadAllMeshes( Path const & filePath,
return AllMeshes( main, faces );
}

//TODO handle more general cases: multiple partitions
AllMeshes loadPartitions( vtkSmartPointer< vtkPartitionedDataSet > & partitions )

Check warning on line 583 in src/coreComponents/mesh/generators/VTKUtilities.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKUtilities.cpp#L583

Added line #L583 was not covered by tests
{

if( MpiWrapper::commRank() == 0 )

Check warning on line 586 in src/coreComponents/mesh/generators/VTKUtilities.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKUtilities.cpp#L586

Added line #L586 was not covered by tests
{
std::map< string, vtkSmartPointer< vtkDataSet > > faces;

Check warning on line 588 in src/coreComponents/mesh/generators/VTKUtilities.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKUtilities.cpp#L588

Added line #L588 was not covered by tests

vtkDataObject * block = partitions->GetPartition( 0 );
if( block->IsA( "vtkDataSet" ) )

Check warning on line 591 in src/coreComponents/mesh/generators/VTKUtilities.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKUtilities.cpp#L590-L591

Added lines #L590 - L591 were not covered by tests
{
vtkSmartPointer< vtkDataSet > mesh = vtkDataSet::SafeDownCast( block );
return AllMeshes( mesh, faces );

Check warning on line 594 in src/coreComponents/mesh/generators/VTKUtilities.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKUtilities.cpp#L593-L594

Added lines #L593 - L594 were not covered by tests
}
}

return AllMeshes();

Check warning on line 598 in src/coreComponents/mesh/generators/VTKUtilities.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/generators/VTKUtilities.cpp#L598

Added line #L598 was not covered by tests
}


/**
* @brief Redistributes the mesh using cell graphds methods (ParMETIS or PTScotch)
Expand Down
9 changes: 9 additions & 0 deletions src/coreComponents/mesh/generators/VTKUtilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "common/MpiWrapper.hpp"
#include "mesh/generators/CellBlockManager.hpp"

#include <vtkPartitionedDataSet.h>
#include <vtkDataSet.h>
#include <vtkMultiProcessController.h>
#include <vtkSmartPointer.h>
Expand Down Expand Up @@ -136,6 +137,14 @@ AllMeshes loadAllMeshes( Path const & filePath,
string const & mainBlockName,
array1d< string > const & faceBlockNames );

/**
* @brief Load VTK partitions into the VTK data structure
*
* @param[in] partitions The partitioned dataset to be loaded
* @return The compound of the main mesh and the face block meshes.
*/
AllMeshes loadPartitions( vtkSmartPointer< vtkPartitionedDataSet > & partitions );

/**
* @brief Compute the rank neighbor candidate list.
* @param[in] boundingBoxes the bounding boxes used by the VTK partitioner for all ranks
Expand Down

0 comments on commit 0cc7fcb

Please sign in to comment.