Skip to content

Commit 8df337f

Browse files
authored
Merge branch 'develop' into feature/han12/pygeosx_docker
2 parents 411c1de + c2768e6 commit 8df337f

File tree

129 files changed

+3800
-1563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+3800
-1563
lines changed

.integrated_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
baselines:
22
bucket: geosx
3-
baseline: integratedTests/baseline_integratedTests-pr3653-11335-b8096ce
3+
baseline: integratedTests/baseline_integratedTests-pr3679-11653-e066fbb
44

55
allow_fail:
66
all: ''

BASELINE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ This file is designed to track changes to the integrated test baselines.
66
Any developer who updates the baseline ID in the .integrated_tests.yaml file is expected to create an entry in this file with the pull request number, date, and their justification for rebaselining.
77
These notes should be in reverse-chronological order, and use the following time format: (YYYY-MM-DD).
88

9+
PR #3679 (2025-05-27) <https://storage.googleapis.com/geosx/integratedTests/baseline_integratedTests-pr3679-11653-e066fbb.tar.gz>
10+
=====================
11+
Removed `maxStableDt` and `registerWrapper` for `meshTargets`.
12+
913
PR #3653 (2025-05-13) <https://storage.googleapis.com/geosx/integratedTests/baseline_integratedTests-pr3653-11335-b8096ce.tar.gz>
1014
=====================
1115
Change black oil phase labelling for gas only cells.

inputFiles/compositionalMultiphaseWell/simpleCo2InjTutorial_base.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797

9898
<PressurePorosity
9999
name="rockPorosity"
100-
defaultReferencePorosity="0.1"
100+
defaultReferencePorosity="0.05"
101101
referencePressure="1.0e7"
102102
compressibility="4.5e-10"/>
103103

@@ -144,7 +144,7 @@
144144
setNames="{ all }"
145145
objectPath="ElementRegions/reservoir"
146146
fieldName="rockPerm_permeability"
147-
scale="3e-15"
147+
scale="1.5e-15"
148148
functionName="permzFunc"/>
149149

150150
<FieldSpecification

src/coreComponents/common/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ set( common_headers
2929
format/table/TableFormatter.hpp
3030
format/table/TableData.hpp
3131
format/EnumStrings.hpp
32+
format/LogPart.hpp
3233
format/Format.hpp
3334
format/StringUtilities.hpp
3435
logger/Logger.hpp
@@ -72,6 +73,7 @@ set( common_sources
7273
format/table/TableLayout.cpp
7374
format/table/TableFormatter.cpp
7475
format/table/TableData.cpp
76+
format/LogPart.cpp
7577
format/StringUtilities.cpp
7678
logger/Logger.cpp
7779
BufferAllocator.cpp
@@ -153,6 +155,6 @@ install( TARGETS common LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )
153155

154156
if( GEOS_ENABLE_TESTS )
155157
add_subdirectory( unitTests )
156-
add_subdirectory( format/table/unitTests )
157158
add_subdirectory( format/unitTests )
159+
add_subdirectory( format/table/unitTests )
158160
endif()
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
/*
2+
* ------------------------------------------------------------------------------------------------------------
3+
* SPDX-License-Identifier: LGPL-2.1-only
4+
*
5+
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6+
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7+
* Copyright (c) 2018-2020 TotalEnergies
8+
* Copyright (c) 2019- GEOSX Contributors
9+
* All rights reserved
10+
*
11+
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12+
* ------------------------------------------------------------------------------------------------------------
13+
*/
14+
15+
/**
16+
* @file LogPart.cpp
17+
*/
18+
19+
#include "LogPart.hpp"
20+
#include "common/format/StringUtilities.hpp"
21+
#include <algorithm>
22+
23+
using namespace geos::stringutilities;
24+
namespace geos
25+
{
26+
27+
LogPart::LogPart( string_view logPartTitle, bool enableOutput )
28+
{
29+
m_formattedStartDescription.m_title = logPartTitle;
30+
m_formattedEndDescription.m_title = GEOS_FMT( "{}{}", m_prefixEndTitle, logPartTitle );
31+
32+
m_enableOutput = enableOutput;
33+
}
34+
35+
void LogPart::addDescription( string_view description )
36+
{
37+
size_t compareWidth = m_width;
38+
m_startDescription.m_names.push_back( stringutilities::divideLines< string >( compareWidth, description ) );
39+
m_startDescription.m_values.push_back( std::vector< string >() );
40+
}
41+
42+
void LogPart::addEndDescription( string_view description )
43+
{
44+
size_t compareWidth = m_width;
45+
m_endDescription.m_names.push_back( stringutilities::divideLines< string >( compareWidth, description ) );
46+
m_endDescription.m_values.push_back( std::vector< string >() );
47+
48+
}
49+
50+
51+
void LogPart::setMinWidth( size_t const & minWidth )
52+
{
53+
m_minWidth = minWidth;
54+
}
55+
56+
void LogPart::setMaxWidth( size_t const & maxWidth )
57+
{
58+
m_maxWidth = maxWidth;
59+
}
60+
61+
62+
double clamp( double v, double min, double max )
63+
{
64+
return std::min( max, std::max( min, v ));
65+
}
66+
67+
void LogPart::formatDescriptions( LogPart::Description & description,
68+
FormattedDescription & formattedDescription )
69+
{
70+
std::vector< string > & formattedLines = formattedDescription.m_lines;
71+
size_t const borderSpaceWidth = m_nbBorderChar * 2 + m_borderMargin * 2;
72+
73+
size_t const formattingCharSize = borderSpaceWidth;
74+
size_t & maxNameSize = formattedDescription.m_maxNameWidth;
75+
size_t & maxValueSize = formattedDescription.m_maxValueWidth;
76+
77+
formattedLines.reserve( description.m_names.size() * 2 );
78+
79+
/// clamp
80+
m_width = std::min( m_maxWidth, std::max( m_minWidth, m_width ));
81+
82+
for( size_t idxName = 0; idxName < description.m_names.size(); idxName++ )
83+
{
84+
auto const & nonFormattedNames = description.m_names[idxName];
85+
auto const & nonFormattedValues = description.m_values[idxName];
86+
87+
// Format name with no values associated
88+
if( nonFormattedValues.empty())
89+
{
90+
size_t maxLineLength = m_width - borderSpaceWidth;
91+
auto wrappedNames = stringutilities::wrapTextToMaxLength( nonFormattedNames, maxLineLength );
92+
93+
for( auto & name : wrappedNames )
94+
{
95+
auto const currMaxNameSize = std::max( name.size(), maxNameSize );
96+
if( currMaxNameSize + formattingCharSize < m_width )
97+
{
98+
// append space at the end of name if needed
99+
name.reserve( m_width - borderSpaceWidth );
100+
name.append( std::string( m_width - currMaxNameSize - formattingCharSize, ' ' ));
101+
}
102+
formattedLines.push_back( name );
103+
}
104+
continue;
105+
}
106+
107+
// Format name with values assiociated
108+
size_t maxLineLength = m_width - maxNameSize - formattingCharSize - m_delimiter.size();
109+
auto wrappedValues = stringutilities::wrapTextToMaxLength( nonFormattedValues, maxLineLength );
110+
111+
// format name
112+
std::vector< string > formatNames {nonFormattedNames};
113+
for( size_t idxSubName = 0; idxSubName < formatNames.size(); idxSubName++ )
114+
{
115+
size_t const spaces = idxSubName < wrappedValues.size() ?
116+
maxNameSize - formatNames[idxSubName].size() :
117+
m_width - formatNames[idxSubName].size() - formattingCharSize;
118+
// append space at the end of name if needed
119+
formatNames[idxSubName].reserve( formatNames[idxSubName].size() + spaces );
120+
formatNames[idxSubName].append( spaces, ' ' );
121+
}
122+
123+
size_t const lineCount = std::max( formatNames.size(), wrappedValues.size());
124+
125+
// format values
126+
size_t const minValueSizeRequired = m_width - maxNameSize - formattingCharSize - m_delimiter.size();
127+
for( auto & wrappedValue : wrappedValues )
128+
{
129+
wrappedValue.reserve( minValueSizeRequired );
130+
wrappedValue.append( minValueSizeRequired - wrappedValue.size(), ' ' );
131+
}
132+
maxValueSize = std::max( maxValueSize,
133+
(std::max_element( wrappedValues.begin(), wrappedValues.end() ))->size() );
134+
135+
// add the first line
136+
string firstLine;
137+
firstLine.reserve( formatNames.front().size() + m_delimiter.size() + wrappedValues.front().size());
138+
firstLine.append( formatNames.front()).append( m_delimiter ).append( wrappedValues.front());
139+
formattedLines.push_back( firstLine );
140+
141+
// combination name + value
142+
for( size_t idxLine = 1; idxLine < lineCount; ++idxLine )
143+
{
144+
if( idxLine < formatNames.size() && idxLine < wrappedValues.size())
145+
{ // name + value
146+
formattedLines.push_back( GEOS_FMT( "{}{}{}", formatNames[idxLine], m_delimiter, wrappedValues[idxLine] ));
147+
}
148+
else if( idxLine < formatNames.size())
149+
{ // subnames remaining
150+
formattedLines.push_back( formatNames[idxLine] );
151+
}
152+
else if( idxLine < wrappedValues.size())
153+
{ // subvalues remaining
154+
size_t const spaceAvailable = maxNameSize + wrappedValues[idxLine].size() + m_delimiter.size();
155+
formattedLines.push_back( GEOS_FMT( "{:>{}}", wrappedValues[idxLine], spaceAvailable ));
156+
}
157+
}
158+
}
159+
}
160+
161+
string LogPart::outputDescription( FormattedDescription & formattedDescription )
162+
{
163+
std::ostringstream oss;
164+
string const borderCharacters = string( m_nbBorderChar, m_borderCharacter );
165+
string const borderSpaces = string( m_borderMargin, ' ' );
166+
167+
for( auto const & line : formattedDescription.m_lines )
168+
{
169+
oss << borderCharacters;
170+
oss << borderSpaces << line << borderSpaces;
171+
oss << borderCharacters << '\n';
172+
}
173+
return oss.str();
174+
}
175+
176+
string LogPart::outputTitle( LogPart::FormattedDescription & formattedDescription )
177+
{
178+
size_t const titleRowLength = m_width;
179+
string const borderCharacters = string( m_nbBorderChar, m_borderCharacter );
180+
181+
return GEOS_FMT( "\n{}{:^{}}{}\n",
182+
borderCharacters,
183+
formattedDescription.m_title,
184+
titleRowLength - 4,
185+
borderCharacters );
186+
}
187+
188+
void LogPart::begin( std::ostream & os )
189+
{
190+
if( !m_enableOutput )
191+
return;
192+
193+
194+
if( !m_startDescription.m_names.empty())
195+
{
196+
formatDescriptions( m_startDescription, m_formattedStartDescription );
197+
}
198+
199+
string const line = string( m_width, m_borderCharacter );
200+
os << '\n' << line;
201+
os << outputTitle( m_formattedStartDescription );
202+
os << line << '\n';
203+
os << outputDescription( m_formattedStartDescription ) << '\n';
204+
}
205+
206+
void LogPart::end( std::ostream & os )
207+
{
208+
if( !m_enableOutput )
209+
return;
210+
211+
formatDescriptions( m_endDescription, m_formattedEndDescription );
212+
213+
string const line = string( m_width, m_borderCharacter );
214+
if( !m_endDescription.m_names.empty() )
215+
{
216+
os << '\n';
217+
os << outputDescription( m_formattedEndDescription );
218+
os << line;
219+
}
220+
os << outputTitle( m_formattedEndDescription );
221+
os << line << "\n\n";
222+
}
223+
224+
}

0 commit comments

Comments
 (0)