Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ExternalDataRepository #2957

Merged
merged 35 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3f91020
add ExternalDataRepository
Jan 26, 2024
6e9a4c3
feat: Add Region keyword to load parts of VTK HierarchicalData
Sep 20, 2024
dc2b148
wip: working example
Sep 23, 2024
4b2dc13
wip: add example of vtk composite data
Sep 25, 2024
08e4d2e
fix: add user visibility to MeshComponentBase hierarchy
Sep 30, 2024
de8f546
chore: add more doc
Oct 1, 2024
8ce3644
chore(doc): again
Oct 1, 2024
83dcaac
chore(doc): again
Oct 1, 2024
c51863a
wip: only read on one rank
Oct 7, 2024
bbe6954
Update src/coreComponents/mesh/generators/VTKMeshGenerator.cpp
paveltomin Nov 14, 2024
13b68a8
Merge branch 'develop' into feature/untereiner/meshbase
paveltomin Nov 14, 2024
c9d7f3f
rename
Nov 14, 2024
8e39f24
Merge branch 'feature/untereiner/meshbase' of https://github.com/GEOS…
Nov 14, 2024
aade072
finish rename
Nov 14, 2024
28dd7bd
Update FieldCaseTutorial3_composite_smoke.xml
paveltomin Nov 14, 2024
c1916d3
Update CMakeLists.txt
paveltomin Nov 14, 2024
ee3780f
Update CMakeLists.txt
paveltomin Nov 14, 2024
38cd065
Update schema.xsd
paveltomin Nov 14, 2024
83eef3e
Update schema.xsd.other
paveltomin Nov 14, 2024
726417d
Merge branch 'develop' into feature/untereiner/meshbase
MelReyCG Nov 20, 2024
2be6e57
Merge branch 'develop' into feature/untereiner/meshbase
paveltomin Nov 21, 2024
8b6b325
Merge remote-tracking branch 'origin/develop' into feature/untereiner…
MelReyCG Nov 22, 2024
ce78f90
missing const
MelReyCG Nov 22, 2024
493bed2
build fix
Nov 22, 2024
4dcdba1
Merge branch 'develop' into feature/untereiner/meshbase
paveltomin Nov 26, 2024
00a5616
Update VTKPolyDataWriterInterface.cpp
paveltomin Nov 26, 2024
e116f1b
Update VTKMeshGenerator.cpp
paveltomin Nov 27, 2024
75dae46
revert cosmetic
Nov 27, 2024
f1e8e29
remove unused
Nov 27, 2024
ff99ac0
bug fix
Nov 27, 2024
a4ec2d4
Update .integrated_tests.yaml
paveltomin Nov 27, 2024
f4cb9c0
Update BASELINE_NOTES.md
paveltomin Nov 27, 2024
71a6e51
Update Region.cpp
paveltomin Nov 27, 2024
9b5a132
revert
Nov 27, 2024
ebc60b9
Merge branch 'feature/untereiner/meshbase' of https://github.com/GEOS…
Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" ?>

<Problem>
<Included>
<File name="./FieldCaseTutorial3_base.xml" />
</Included>

<!-- SPHINX_FIELD_CASE_COMPOSITE_MESH -->
<ExternalDataSource>
<VTKHierarchicalDataSource
name="synthetic"
file="synthetic.vtpc"/>
</ExternalDataSource>

<Mesh>
<VTKMesh
name="SyntheticMesh"
repositoryName="synthetic">
<Region
name="Region1"
id="1"
pathInRepository="/Root/Mesh/Region1"/>
<Region
name="Region2"
id="2"
pathInRepository="/Root/Mesh/Region2"/>
<Region
name="Region3"
id="3"
pathInRepository="/Root/Mesh/Region3"/>
</VTKMesh>
</Mesh>
<!-- SPHINX_FIELD_CASE_COMPOSITE_MESH -->

<!-- SPHINX_FIELD_CASE_EVENTS -->
<Events maxTime="100.0e6">
<PeriodicEvent name="solverApplications"
forceDt="10.0e6"
target="/Solvers/SinglePhaseFlow" />

<PeriodicEvent name="outputs"
timeFrequency="10.0e6"
target="/Outputs/reservoir_with_properties" />
</Events>
<!-- SPHINX_FIELD_CASE_EVENTS_END -->

</Problem>
17 changes: 17 additions & 0 deletions inputFiles/singlePhaseFlow/synthetic.vtpc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<VTKFile type="vtkPartitionedDataSetCollection" version="1.0" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<vtkPartitionedDataSetCollection>
<Partitions index="0" name="Region1">
<DataSet index="0" file="synthetic/synthetic_0_0.vtu"/>
</Partitions>
<Partitions index="1" name="Region2">
<DataSet index="0" file="synthetic/synthetic_1_0.vtu"/>
</Partitions>
<Partitions index="2" name="Region3">
<DataSet index="0" file="synthetic/synthetic_2_0.vtu"/>
</Partitions>
<DataAssembly encoding="base64">
PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxSb290IHR5cGU9InZ0a0RhdGFBc3NlbWJseSIgdmVyc2lvbj0iMS4wIiBpZD0iMCIgdnRrX3R5cGU9IjM4IiB2dGtfY2F0ZWdvcnk9Inhmb3JtZWRfaGllcmFyY2h5IiBsYWJlbD0iZGF0YSI+CiAgPE1lc2ggaWQ9IjEiIGxhYmVsPSJTeW50aGV0aWNNZXNoIj4KICAgIDxSZWdpb24xIGlkPSIyIiBsYWJlbD0iUmVnaW9uMSIgbnVtYmVyX29mX3BhcnRpdGlvbnM9IjEiPgogICAgICA8ZGF0YXNldCBpZD0iMCIgLz4KICAgIDwvUmVnaW9uMT4KICAgIDxSZWdpb24yIGlkPSIzIiBsYWJlbD0iUmVnaW9uMiIgbnVtYmVyX29mX3BhcnRpdGlvbnM9IjEiPgogICAgICA8ZGF0YXNldCBpZD0iMSIgLz4KICAgIDwvUmVnaW9uMj4KICAgIDxSZWdpb24zIGlkPSI0IiBsYWJlbD0iUmVnaW9uMyIgbnVtYmVyX29mX3BhcnRpdGlvbnM9IjEiPgogICAgICA8ZGF0YXNldCBpZD0iMiIgLz4KICAgIDwvUmVnaW9uMz4KICA8L01lc2g+CjwvUm9vdD4K
</DataAssembly>
</vtkPartitionedDataSetCollection>
</VTKFile>
23 changes: 23 additions & 0 deletions inputFiles/singlePhaseFlow/synthetic/synthetic_0_0.vtu

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions inputFiles/singlePhaseFlow/synthetic/synthetic_1_0.vtu

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions inputFiles/singlePhaseFlow/synthetic/synthetic_2_0.vtu

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ add_subdirectory( thirdparty )
################################
# Add components
################################
unset( externalComponentsLinkList )
# unset( externalComponentsLinkList )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rrsettgast is this ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is fine...but why is this needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

add_subdirectory( coreComponents )
add_subdirectory( externalComponents )
add_subdirectory( main )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,6 @@ void VTKPolyDataWriterInterface::writeParticleRegions( real64 const time,
writeTimestamp( ug.GetPointer(), time );
writeParticleFields( region, ug->GetCellData() );

// string const regionDir = joinPath( path, region.getName() );
writeUnstructuredGrid( path, region, ug.GetPointer() );
} );
}
Expand Down Expand Up @@ -1185,8 +1184,6 @@ void VTKPolyDataWriterInterface::writeVtmFile( integer const cycle,

string const meshPath = joinPath( getCycleSubFolder( cycle ), meshBodyName, meshLevelName );

// int const mpiSize = MpiWrapper::commSize();

auto addElementRegion = [&]( ElementRegionBase const & region )
{
std::vector< string > const blockPath{ meshBody.getName(), meshLevel.getName(), region.getCatalogName(), region.getName() };
Expand Down
20 changes: 14 additions & 6 deletions src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class VTKPolyDataWriterInterface
void clearData();


private:
protected:
rrsettgast marked this conversation as resolved.
Show resolved Hide resolved

/**
* @brief Check if plotting is enabled for this field
Expand All @@ -234,20 +234,29 @@ class VTKPolyDataWriterInterface
* @param[in] time the time-step
* @param[in] elemManager the ElementRegionManager containing the CellElementRegions to be output
* @param[in] nodeManager the NodeManager containing the nodes of the domain to be output
* @param[in] path the root path where the mesh will be written
* @param[in] path the path to the file to output
*/
void writeCellElementRegions( real64 time,
ElementRegionManager const & elemManager,
NodeManager const & nodeManager,
string const & path );
/**
* @brief Writes the files for all the ParticleRegions.
* @param[in] time the time-step
* @param[in] particleManager the ParticleManager containing the ParticleRegions to be output
* @param[in] path The path to the file to output
*/
void writeParticleRegions( real64 const time,
ParticleManager const & particleManager,
string const & path ) const;

/**
* @brief Writes the files containing the well representation
* @details There will be one file written per WellElementRegion and per rank
* @param[in] time the time-step
* @param[in] elemManager the ElementRegionManager containing the WellElementRegions to be output
* @param[in] nodeManager the NodeManager containing the nodes of the domain to be output
* @param[in] path the root path where the mesh will be written
* @param[in] path The path to the file to output
*/
void writeWellElementRegions( real64 time,
ElementRegionManager const & elemManager,
Expand Down Expand Up @@ -289,7 +298,6 @@ class VTKPolyDataWriterInterface
* @param[in] domain the DomainPartition containing all the regions to be output and referred to in the VTM file
* @param[in] vtmWriter a writer specialized for the VTM file format
*/

void writeVtmFile( integer const cycle,
DomainPartition const & domain,
VTKVTMWriter const & vtmWriter ) const;
Expand All @@ -312,7 +320,7 @@ class VTKPolyDataWriterInterface
vtkCellData * cellData ) const;

/**
* @brief Writes all the fields associated to the elements of \p er if their plotlevel is <= m_plotLevel
* @brief Writes all the fields associated to the elements of \p region if their plotlevel is <= m_plotLevel
* @param[in] region ParticleRegion being written
* @param[in] cellData a VTK object containing all the fields associated with the elements
*/
Expand All @@ -332,7 +340,7 @@ class VTKPolyDataWriterInterface
ObjectManagerBase const & region,
vtkUnstructuredGrid * ug );

private:
protected:

/// Output directory name
string m_outputDir;
Expand Down
3 changes: 3 additions & 0 deletions src/coreComponents/mainInterface/ProblemManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "fileIO/Outputs/OutputBase.hpp"
#include "fileIO/Outputs/OutputManager.hpp"
#include "functions/FunctionManager.hpp"
#include "mesh/ExternalDataSourceManager.hpp"
#include "mesh/DomainPartition.hpp"
#include "mesh/MeshBody.hpp"
#include "mesh/MeshManager.hpp"
Expand Down Expand Up @@ -73,6 +74,8 @@ ProblemManager::ProblemManager( conduit::Node & root ):

setInputFlags( InputFlags::PROBLEM_ROOT );

registerGroup< ExternalDataSourceManager >( groupKeys.externalDataSourceManager );

m_fieldSpecificationManager = &registerGroup< FieldSpecificationManager >( groupKeys.fieldSpecificationManager );

m_eventManager = &registerGroup< EventManager >( groupKeys.eventManager );
Expand Down
1 change: 1 addition & 0 deletions src/coreComponents/mainInterface/ProblemManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class ProblemManager : public dataRepository::Group
dataRepository::GroupKey constitutiveManager = { "Constitutive" }; ///< Constitutive key
dataRepository::GroupKey domain = { "domain" }; ///< Domain key
dataRepository::GroupKey eventManager = { "Events" }; ///< Events key
dataRepository::GroupKey externalDataSourceManager = { "ExternalDataSource" }; ///< External Data Source key
dataRepository::GroupKey fieldSpecificationManager = { "FieldSpecifications" }; ///< Field specification key
dataRepository::GroupKey functionManager = { "Functions" }; ///< Functions key
dataRepository::GroupKey geometricObjectManager = { "Geometry" }; ///< Geometry key
Expand Down
11 changes: 10 additions & 1 deletion src/coreComponents/mesh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ set( mesh_headers
ElementRegionManager.hpp
ElementSubRegionBase.hpp
ElementType.hpp
ExternalDataSourceBase.hpp
ExternalDataSourceManager.hpp
EmbeddedSurfaceNodeManager.hpp
EmbeddedSurfaceSubRegion.hpp
MeshFields.hpp
Expand Down Expand Up @@ -80,12 +82,13 @@ set( mesh_headers
generators/InternalMeshGenerator.hpp
generators/InternalWellGenerator.hpp
generators/InternalWellboreGenerator.hpp
generators/MeshComponentBase.hpp
generators/MeshGeneratorBase.hpp
generators/ParMETISInterface.hpp
generators/ParticleMeshGenerator.hpp
generators/PartitionDescriptor.hpp
generators/PrismUtilities.hpp
generators/WellGeneratorABC.hpp
generators/Region.hpp
generators/WellGeneratorBase.hpp
mpiCommunications/CommID.hpp
mpiCommunications/CommunicationTools.hpp
Expand Down Expand Up @@ -124,6 +127,8 @@ set( mesh_sources
ElementSubRegionBase.cpp
EmbeddedSurfaceNodeManager.cpp
EmbeddedSurfaceSubRegion.cpp
ExternalDataSourceBase.cpp
ExternalDataSourceManager.cpp
FaceElementSubRegion.cpp
FaceManager.cpp
MeshBody.cpp
Expand Down Expand Up @@ -156,9 +161,11 @@ set( mesh_sources
generators/InternalMeshGenerator.cpp
generators/InternalWellGenerator.cpp
generators/InternalWellboreGenerator.cpp
generators/MeshComponentBase.cpp
generators/MeshGeneratorBase.cpp
generators/ParMETISInterface.cpp
generators/ParticleMeshGenerator.cpp
generators/Region.cpp
generators/WellGeneratorBase.cpp
mpiCommunications/CommID.cpp
mpiCommunications/CommunicationTools.cpp
Expand All @@ -184,6 +191,7 @@ if( ENABLE_VTK )
set( mesh_headers ${mesh_headers}
generators/CollocatedNodes.hpp
generators/VTKFaceBlockUtilities.hpp
generators/VTKHierarchicalDataSource.hpp
generators/VTKMeshGenerator.hpp
generators/VTKMeshGeneratorTools.hpp
generators/VTKWellGenerator.hpp
Expand All @@ -192,6 +200,7 @@ if( ENABLE_VTK )
set( mesh_sources ${mesh_sources}
generators/CollocatedNodes.cpp
generators/VTKFaceBlockUtilities.cpp
generators/VTKHierarchicalDataSource.cpp
generators/VTKMeshGenerator.cpp
generators/VTKMeshGeneratorTools.cpp
generators/VTKWellGenerator.cpp
Expand Down
54 changes: 54 additions & 0 deletions src/coreComponents/mesh/ExternalDataSourceBase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2020 TotalEnergies
* Copyright (c) 2019- GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/

#include "ExternalDataSourceBase.hpp"

namespace geos
{
using namespace dataRepository;

ExternalDataSourceBase::ExternalDataSourceBase( string const & name, Group * const parent ):
Group( name, parent )
{
setInputFlags( InputFlags::OPTIONAL_NONUNIQUE );
}

Group * ExternalDataSourceBase::createChild( string const & childKey, string const & childName )
{
GEOS_LOG_RANK_0( "Adding External Data Source: " << childKey << ", " << childName );
std::unique_ptr< ExternalDataSourceBase > event = ExternalDataSourceBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< ExternalDataSourceBase >( childName, std::move( event ) );
}

void ExternalDataSourceBase::expandObjectCatalogs()
{
// Only add children if the parent is of type EventManager
// otherwise, this would fall into a loop
if( strcmp( this->getParent().getName().c_str(), "ExternalDataSource" ) == 0 )
{
for( auto & catalogIter: ExternalDataSourceBase::getCatalog())
{
createChild( catalogIter.first, catalogIter.first );
}
}
}

ExternalDataSourceBase::CatalogInterface::CatalogType & ExternalDataSourceBase::getCatalog()
{
static ExternalDataSourceBase::CatalogInterface::CatalogType catalog;
return catalog;
}


}
77 changes: 77 additions & 0 deletions src/coreComponents/mesh/ExternalDataSourceBase.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2020 TotalEnergies
* Copyright (c) 2019- GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/

/**
* @file ExternalDataSourceBase.hpp
*/

#ifndef GEOS_MESH_EXTERNALDATASOURCEBASE_HPP
#define GEOS_MESH_EXTERNALDATASOURCEBASE_HPP

#include "dataRepository/Group.hpp"
#include "dataRepository/WrapperBase.hpp"
#include "codingUtilities/Utilities.hpp"
#include "common/DataTypes.hpp"


namespace geos
{

/**
* @class ExternalDataSourceBase
* @brief The ExternalDataSourceBase class provides an abstract base class implementation for different mesh types.
* The ExternalDataSourceBase is the Group specialization for different type of mesh handling.
*/
class ExternalDataSourceBase : public dataRepository::Group
{
public:

/**
* @brief Main constructor for ExternalDataSourceBase base class.
* @param[in] name of the ExternalDataSourceBase object
* @param[in] parent the parent Group pointer for the ExternalDataSourceBase object
*/
explicit ExternalDataSourceBase( string const & name,
Group * const parent );

/// This function is used to expand any catalogs in the data structure
virtual void expandObjectCatalogs() override;

/// using alias for templated Catalog ExternalDataSourceBase type
using CatalogInterface = dataRepository::CatalogInterface< ExternalDataSourceBase, string const &, Group * const >;

/**
* @brief Create a new geometric object (box, plane, etc) as a child of this group.
* @param childKey the catalog key of the new geometric object to create
* @param childName the name of the new geometric object in the repository
* @return the group child
*/
virtual Group * createChild( string const & childKey, string const & childName ) override;

/**
* @brief Accessor for the singleton Catalog object
* @return a static reference to the Catalog object
*/
static CatalogInterface::CatalogType & getCatalog();

/**
* @brief This function provides the capability to open an external data repository
* from another component whatever its format.
*/
virtual void open() = 0;
};

}

#endif /* GEOS_MESH_EXTERNALDATASOURCEBASE_HPP */
Loading
Loading