diff --git a/inputFiles/wavePropagation/benchmarks/elas3D_benchmark_base.xml b/inputFiles/wavePropagation/benchmarks/elas3D_benchmark_base.xml index a1759a7b731..36a95b6e247 100644 --- a/inputFiles/wavePropagation/benchmarks/elas3D_benchmark_base.xml +++ b/inputFiles/wavePropagation/benchmarks/elas3D_benchmark_base.xml @@ -220,7 +220,8 @@ + levelNames="{ FE1 }" + plotLevel="3"/> diff --git a/inputFiles/wavePropagation/elas3D_small_base.xml b/inputFiles/wavePropagation/elas3D_small_base.xml index 0ed1a918810..8581b072068 100644 --- a/inputFiles/wavePropagation/elas3D_small_base.xml +++ b/inputFiles/wavePropagation/elas3D_small_base.xml @@ -198,6 +198,7 @@ diff --git a/integratedTests b/integratedTests index 490987ae0c4..d7244a7b383 160000 --- a/integratedTests +++ b/integratedTests @@ -1 +1 @@ -Subproject commit 490987ae0c4f2c0b25a889766d2f1060ffd7ace8 +Subproject commit d7244a7b3839764c0c8328af24563c537fc7dfd0 diff --git a/src/coreComponents/fileIO/Outputs/VTKOutput.cpp b/src/coreComponents/fileIO/Outputs/VTKOutput.cpp index d6c912d7bac..b9b6256bc1a 100644 --- a/src/coreComponents/fileIO/Outputs/VTKOutput.cpp +++ b/src/coreComponents/fileIO/Outputs/VTKOutput.cpp @@ -36,6 +36,7 @@ VTKOutput::VTKOutput( string const & name, m_plotLevel(), m_onlyPlotSpecifiedFieldNames(), m_fieldNames(), + m_levelNames(), m_writer( getOutputDirectory() + '/' + m_plotFileRoot ) { enableLogLevelInput(); @@ -70,6 +71,10 @@ VTKOutput::VTKOutput( string const & name, setInputFlag( InputFlags::OPTIONAL ). setDescription( "Names of the fields to output. If this attribute is specified, GEOSX outputs all the fields specified by the user, regardless of their `plotLevel`" ); + registerWrapper( viewKeysStruct::levelNames, &m_levelNames ). + setInputFlag( InputFlags::OPTIONAL ). + setDescription( "Names of mesh levels to output." ); + registerWrapper( viewKeysStruct::binaryString, &m_writeBinaryData ). setApplyDefaultValue( m_writeBinaryData ). setInputFlag( InputFlags::OPTIONAL ). @@ -88,6 +93,7 @@ void VTKOutput::postProcessInput() { m_writer.setOutputLocation( getOutputDirectory(), m_plotFileRoot ); m_writer.setFieldNames( m_fieldNames.toViewConst() ); + m_writer.setLevelNames( m_levelNames.toViewConst() ); m_writer.setOnlyPlotSpecifiedFieldNamesFlag( m_onlyPlotSpecifiedFieldNames ); string const fieldNamesString = viewKeysStruct::fieldNames; diff --git a/src/coreComponents/fileIO/Outputs/VTKOutput.hpp b/src/coreComponents/fileIO/Outputs/VTKOutput.hpp index 93abd3e865d..c87b92a0513 100644 --- a/src/coreComponents/fileIO/Outputs/VTKOutput.hpp +++ b/src/coreComponents/fileIO/Outputs/VTKOutput.hpp @@ -94,6 +94,7 @@ class VTKOutput : public OutputBase static constexpr auto outputRegionTypeString = "outputRegionType"; static constexpr auto onlyPlotSpecifiedFieldNames = "onlyPlotSpecifiedFieldNames"; static constexpr auto fieldNames = "fieldNames"; + static constexpr auto levelNames = "levelNames"; } vtkOutputViewKeys; /// @endcond @@ -120,6 +121,9 @@ class VTKOutput : public OutputBase /// array of names of the fields to output array1d< string > m_fieldNames; + /// array of names of the mesh levels to output (an empty array means all levels are saved) + array1d< string > m_levelNames; + /// VTK output mode vtk::VTKOutputMode m_writeBinaryData = vtk::VTKOutputMode::BINARY; diff --git a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp index 1016b332851..fce83637687 100644 --- a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp +++ b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.cpp @@ -1156,14 +1156,24 @@ void VTKPolyDataWriterInterface::writeVtmFile( integer const cycle, { if( meshLevel.isShallowCopy() ) - { return; + + string const & meshLevelName = meshLevel.getName(); + + if( !m_levelNames.empty()) + { + if( m_levelNames.find( meshLevelName ) == m_levelNames.end()) + return; } + string const & meshBodyName = meshBody.getName(); + ElementRegionManager const & elemManager = meshLevel.getElemManager(); + ParticleManager const & particleManager = meshLevel.getParticleManager(); - string const meshPath = joinPath( getCycleSubFolder( cycle ), meshBody.getName(), meshLevel.getName() ); + string const meshPath = joinPath( getCycleSubFolder( cycle ), meshBodyName, meshLevelName ); + int const mpiSize = MpiWrapper::commSize(); auto addElementRegion = [&]( ElementRegionBase const & region ) @@ -1180,8 +1190,9 @@ void VTKPolyDataWriterInterface::writeVtmFile( integer const cycle, auto addParticleRegion = [&]( ParticleRegionBase const & region ) { - std::vector< string > const blockPath{ meshBody.getName(), meshLevel.getName(), region.getCatalogName(), region.getName() }; - string const regionPath = joinPath( meshPath, region.getName() ); + string const & regionName = region.getName(); + std::vector< string > const blockPath{ meshBodyName, meshLevelName, region.getCatalogName(), regionName }; + string const regionPath = joinPath( meshPath, regionName ); for( int i = 0; i < mpiSize; i++ ) { string const dataSetName = getRankFileName( i ); @@ -1290,15 +1301,20 @@ void VTKPolyDataWriterInterface::write( real64 const time, { if( meshLevel.isShallowCopy() ) - { return; + + string const & meshLevelName = meshLevel.getName(); + + if( !m_levelNames.empty()) + { + if( m_levelNames.find( meshLevelName ) == m_levelNames.end()) + return; } ElementRegionManager const & elemManager = meshLevel.getElemManager(); ParticleManager const & particleManager = meshLevel.getParticleManager(); NodeManager const & nodeManager = meshLevel.getNodeManager(); EmbeddedSurfaceNodeManager const & embSurfNodeManager = meshLevel.getEmbSurfNodeManager(); - string const & meshLevelName = meshLevel.getName(); string const & meshBodyName = meshBody.getName(); if( m_requireFieldRegistrationCheck && !m_fieldNames.empty() ) diff --git a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.hpp b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.hpp index 8d1fc54290a..1baa383407c 100644 --- a/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.hpp +++ b/src/coreComponents/fileIO/vtk/VTKPolyDataWriterInterface.hpp @@ -148,6 +148,14 @@ class VTKPolyDataWriterInterface m_fieldNames.insert( fieldNames.begin(), fieldNames.end() ); } + /** + * @brief Set the names of the mesh levels to output + * @param[in] levelNames the mesh levels to output (an empty array means all levels are saved) + */ + void setLevelNames( arrayView1d< string const > const & levelNames ) + { + m_levelNames.insert( levelNames.begin(), levelNames.end() ); + } /** * @brief Main method of this class. Write all the files for one time step. @@ -318,6 +326,9 @@ class VTKPolyDataWriterInterface /// Names of the fields to output std::set< string > m_fieldNames; + /// Names of the mesh levels to output (an empty array means all levels are saved) + std::set< string > m_levelNames; + /// The previousCycle integer m_previousCycle; diff --git a/src/coreComponents/schema/docs/VTK.rst b/src/coreComponents/schema/docs/VTK.rst index 4ba3e3b3870..3a376546ee3 100644 --- a/src/coreComponents/schema/docs/VTK.rst +++ b/src/coreComponents/schema/docs/VTK.rst @@ -6,6 +6,7 @@ Name Type Default Description childDirectory string Child directory path fieldNames groupNameRef_array {} Names of the fields to output. If this attribute is specified, GEOSX outputs all the fields specified by the user, regardless of their `plotLevel` format geos_vtk_VTKOutputMode binary Output data format. Valid options: ``binary``, ``ascii`` +levelNames string_array {} Names of mesh levels to output. logLevel integer 0 Log level name groupName required A name is required for any non-unique nodes onlyPlotSpecifiedFieldNames integer 0 If this flag is equal to 1, then we only plot the fields listed in `fieldNames`. Otherwise, we plot all the fields with the required `plotLevel`, plus the fields listed in `fieldNames` diff --git a/src/coreComponents/schema/schema.xsd b/src/coreComponents/schema/schema.xsd index 3498d60b3e9..c9e84b3858e 100644 --- a/src/coreComponents/schema/schema.xsd +++ b/src/coreComponents/schema/schema.xsd @@ -1981,6 +1981,8 @@ the relative residual norm satisfies: + +