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 9 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 -->
<ExternalDataRepository>
<VTKHierarchicalDataRepository
name="synthetic"
file="synthetic.vtpc"/>
</ExternalDataRepository>

<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
25 changes: 16 additions & 9 deletions src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,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 @@ -223,17 +223,20 @@ class VTKPolyDataWriterInterface
* @brief Writes the files for all the CellElementRegions.
* @details There will be one file written per CellElementRegion and per rank.
* @param[in] time the time-step
* @param[in] cycle the current cycle number
* @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] meshLevelName the name of the MeshLevel containing the nodes and elements to be output
* @param[in] meshBodyName the name of the MeshBody containing the nodes and elements to be output
* @param[in] path the path to the file to output
*/
void writeCellElementRegions( real64 time,
ElementRegionManager const & elemManager,
NodeManager const & nodeManager,
string const & path ) const;

/**
* @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;
Expand All @@ -242,9 +245,9 @@ class VTKPolyDataWriterInterface
* @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] cycle the current cycle number
* @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 path to the file to output
*/
void writeWellElementRegions( real64 time,
ElementRegionManager const & elemManager,
Expand Down Expand Up @@ -272,10 +275,9 @@ class VTKPolyDataWriterInterface
* @brief Writes a VTM file for the time-step \p time.
* @details a VTM file is a VTK Multiblock file. It contains relative path to different files organized in blocks.
* @param[in] cycle the current cycle number
* @param[in] elemManager the ElementRegionManager containing all the regions to be output and referred to in the VTM file
* @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 @@ -297,6 +299,11 @@ class VTKPolyDataWriterInterface
void writeElementFields( ElementRegionBase const & subRegion,
vtkCellData * cellData ) const;

/**
* @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
*/
void writeParticleFields( ParticleRegionBase const & region,
vtkCellData * cellData ) const;

Expand All @@ -311,7 +318,7 @@ class VTKPolyDataWriterInterface
void writeUnstructuredGrid( string const & path,
vtkUnstructuredGrid * ug ) const;

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/ExternalDataRepositoryManager.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< ExternalDataRepositoryManager >( groupKeys.externalDataRepositoryManager );

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 externalDataRepositoryManager = { "ExternalDataRepository" };///< External Data Repository key
dataRepository::GroupKey fieldSpecificationManager = { "FieldSpecifications" }; ///< Field specification key
dataRepository::GroupKey functionManager = { "Functions" }; ///< Functions key
dataRepository::GroupKey geometricObjectManager = { "Geometry" }; ///< Geometry key
Expand Down
13 changes: 11 additions & 2 deletions src/coreComponents/mesh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ set( mesh_headers
ElementRegionManager.hpp
ElementSubRegionBase.hpp
ElementType.hpp
ExternalDataRepositoryBase.hpp
ExternalDataRepositoryManager.hpp
EmbeddedSurfaceNodeManager.hpp
EmbeddedSurfaceSubRegion.hpp
MeshFields.hpp
Expand Down Expand Up @@ -54,12 +56,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 @@ -95,6 +98,8 @@ set( mesh_sources
ElementSubRegionBase.cpp
EmbeddedSurfaceNodeManager.cpp
EmbeddedSurfaceSubRegion.cpp
ExternalDataRepositoryBase.cpp
ExternalDataRepositoryManager.cpp
FaceElementSubRegion.cpp
FaceManager.cpp
MeshBody.cpp
Expand Down Expand Up @@ -127,9 +132,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 @@ -155,14 +162,16 @@ if( ENABLE_VTK )
set( mesh_headers ${mesh_headers}
generators/CollocatedNodes.hpp
generators/VTKFaceBlockUtilities.hpp
generators/VTKHierarchicalDataRepository.hpp
generators/VTKMeshGenerator.hpp
generators/VTKMeshGeneratorTools.hpp
generators/VTKWellGenerator.hpp
generators/VTKUtilities.hpp
generators/VTKUtilities.hpp
)
set( mesh_sources ${mesh_sources}
generators/CollocatedNodes.cpp
generators/VTKFaceBlockUtilities.cpp
generators/VTKHierarchicalDataRepository.cpp
generators/VTKMeshGenerator.cpp
generators/VTKMeshGeneratorTools.cpp
generators/VTKWellGenerator.cpp
Expand Down
54 changes: 54 additions & 0 deletions src/coreComponents/mesh/ExternalDataRepositoryBase.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 "ExternalDataRepositoryBase.hpp"

namespace geos
{
using namespace dataRepository;

ExternalDataRepositoryBase::ExternalDataRepositoryBase( string const & name, Group * const parent ):
Group( name, parent )

Check warning on line 22 in src/coreComponents/mesh/ExternalDataRepositoryBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/ExternalDataRepositoryBase.cpp#L21-L22

Added lines #L21 - L22 were not covered by tests
{
setInputFlags( InputFlags::OPTIONAL_NONUNIQUE );

Check warning on line 24 in src/coreComponents/mesh/ExternalDataRepositoryBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/ExternalDataRepositoryBase.cpp#L24

Added line #L24 was not covered by tests
}

Group * ExternalDataRepositoryBase::createChild( string const & childKey, string const & childName )

Check warning on line 27 in src/coreComponents/mesh/ExternalDataRepositoryBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/ExternalDataRepositoryBase.cpp#L27

Added line #L27 was not covered by tests
{
GEOS_LOG_RANK_0( "Adding External Data Repository: " << childKey << ", " << childName );
std::unique_ptr< ExternalDataRepositoryBase > event = ExternalDataRepositoryBase::CatalogInterface::factory( childKey, childName, this );
return &this->registerGroup< ExternalDataRepositoryBase >( childName, std::move( event ) );

Check warning on line 31 in src/coreComponents/mesh/ExternalDataRepositoryBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/ExternalDataRepositoryBase.cpp#L29-L31

Added lines #L29 - L31 were not covered by tests
}

void ExternalDataRepositoryBase::expandObjectCatalogs()

Check warning on line 34 in src/coreComponents/mesh/ExternalDataRepositoryBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/ExternalDataRepositoryBase.cpp#L34

Added line #L34 was not covered by tests
{
// Only add children if the parent is of type EventManager
// otherwise, this would fall into a loop
if( strcmp( this->getParent().getName().c_str(), "ExternalDataRepository" ) == 0 )

Check warning on line 38 in src/coreComponents/mesh/ExternalDataRepositoryBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/ExternalDataRepositoryBase.cpp#L38

Added line #L38 was not covered by tests
{
for( auto & catalogIter: ExternalDataRepositoryBase::getCatalog())

Check warning on line 40 in src/coreComponents/mesh/ExternalDataRepositoryBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/ExternalDataRepositoryBase.cpp#L40

Added line #L40 was not covered by tests
{
createChild( catalogIter.first, catalogIter.first );

Check warning on line 42 in src/coreComponents/mesh/ExternalDataRepositoryBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/mesh/ExternalDataRepositoryBase.cpp#L42

Added line #L42 was not covered by tests
}
}
}

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


}
77 changes: 77 additions & 0 deletions src/coreComponents/mesh/ExternalDataRepositoryBase.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 ExternalDataRepositoryBase.hpp
*/

#ifndef GEOS_MESH_EXTERNALDATAREPOSITORYBASE_HPP
#define GEOS_MESH_EXTERNALDATAREPOSITORYBASE_HPP

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


namespace geos
{

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

/**
* @brief Main constructor for ExternalDataRepositoryBase base class.
* @param[in] name of the ExternalDataRepositoryBase object
* @param[in] parent the parent Group pointer for the ExternalDataRepositoryBase object
*/
explicit ExternalDataRepositoryBase( 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 ExternalDataRepositoryBase type
using CatalogInterface = dataRepository::CatalogInterface< ExternalDataRepositoryBase, 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_ExternalDataRepositoryBase_HPP */
Loading
Loading