Skip to content

Commit db9d01d

Browse files
authored
Merge pull request #1600 from LLNL/feature/kweiss/improve-shaping-logging
Improves some logging calls during shaping
2 parents 2f102d4 + a217a51 commit db9d01d

12 files changed

Lines changed: 649 additions & 359 deletions

File tree

src/axom/bump/docs/sphinx/bump_utilities.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ new explicit coordset where each point corresponds to a single index from the no
119119
stored in SliceData. This class can be used to select a subset of a coordset, reorder nodes
120120
in a coordset, or repeat nodes in a coordset.
121121

122-
.. literalinclude:: ../../utilities/ExtractZones.hpp
122+
.. literalinclude:: ../../ExtractZones.hpp
123123
:start-after: _bump_utilities_coordsetslicer_begin
124124
:end-before: _bump_utilities_coordsetslicer_end
125125
:language: C++
@@ -132,7 +132,7 @@ The ``axom::bump::ExtractZones`` class takes a list of selected zone ids and ext
132132
a new mesh from a source mesh that includes only the selected zones. There is a derived class
133133
``ExtractZonesAndMatset`` that also extracts a matset, if present.
134134

135-
.. literalinclude:: ../../utilities/ExtractZones.hpp
135+
.. literalinclude:: ../../ExtractZones.hpp
136136
:start-after: _bump_utilities_extractzones_begin
137137
:end-before: _bump_utilities_extractzones_end
138138
:language: C++
@@ -206,7 +206,7 @@ The ``axom::bump::MakeUnstructured`` class takes a structured topology
206206
and creates a new unstructured topology. This class does not need views to wrap the input
207207
structured topology.
208208

209-
.. literalinclude:: ../../tests/bump_blueprint_utilities.cpp
209+
.. literalinclude:: ../../tests/bump_mesh_operations.cpp
210210
:start-after: _bump_utilities_makeunstructured_begin
211211
:end-before: _bump_utilities_makeunstructured_end
212212
:language: C++
@@ -243,7 +243,7 @@ The ``axom::bump::MatsetSlicer`` class is similar to the ``FieldSlicer``
243243
class except it slices matsets instead of fields. The same ``SliceData`` can be passed to
244244
MatsetSlicer to pull out and assemble a new matset data for a specific list of zones.
245245

246-
.. literalinclude:: ../../utilities/ExtractZones.hpp
246+
.. literalinclude:: ../../ExtractZones.hpp
247247
:start-after: _bump_utilities_matsetslicer_begin
248248
:end-before: _bump_utilities_matsetslicer_end
249249
:language: C++
@@ -339,7 +339,7 @@ also expose polyhedra as a special ``PolyhedralFaces`` representation that repre
339339
polyhedron as a collection of ``axom::primal::Plane`` objects. This mode is selected by
340340
instantiating ``PrimalAdaptor`` with the ``makeFaces`` template parameter set to true.
341341

342-
.. literalinclude:: ../../utilities/MakeZoneVolumes.hpp
342+
.. literalinclude:: ../../MakeZoneVolumes.hpp
343343
:start-after: _bump_utilities_makezonevolumes_begin
344344
:end-before: _bump_utilities_makezonevolumes_end
345345
:language: C++
@@ -353,7 +353,7 @@ The ``axom::bump::RecenterField`` class uses an O2M relation to average
353353
field data from multiple values to an averaged value. In Axom, this is used to convert a field
354354
associated with the elements to a new field associated with the nodes.
355355

356-
.. literalinclude:: ../../tests/bump_blueprint_utilities.cpp
356+
.. literalinclude:: ../../tests/bump_mesh_operations.cpp
357357
:start-after: _bump_utilities_recenterfield_begin
358358
:end-before: _bump_utilities_recenterfield_end
359359
:language: C++
@@ -389,7 +389,7 @@ intersected with the zones in the target mesh and their overlaps are determined
389389
used to build a new matset on the target mesh. Each zone in the target mesh may recieve
390390
contributions from multiple zones and materials in the source mesh.
391391

392-
.. literalinclude:: ../../tests/mir_topology_mapper.cpp
392+
.. literalinclude:: ../../tests/bump_topology_mapper.cpp
393393
:start-after: _bump_utilities_topologymapper_begin
394394
:end-before: _bump_utilities_topologymapper_end
395395
:language: C++
@@ -404,7 +404,7 @@ sorted list of unique outputs, along with a list of offsets into the original va
404404
one representative value in the original list for each unique value. This class is used to help
405405
merge points.
406406

407-
.. literalinclude:: ../../tests/mir_clipfield.cpp
407+
.. literalinclude:: ../../tests/bump_clipfield.cpp
408408
:start-after: _bump_utilities_unique_begin
409409
:end-before: _bump_utilities_unique_end
410410
:language: C++

src/axom/bump/docs/sphinx/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
.. ##
44
.. ## SPDX-License-Identifier: (BSD-3-Clause)
55
6-
=======================
76
BUMP User Documentation
87
=======================
98

@@ -18,7 +17,6 @@ API Documentation
1817

1918
Doxygen generated API documentation can be found here: `API documentation <../../../../doxygen/html/coretop.html>`_
2019

21-
2220
.. toctree::
2321
:caption: Contents
2422
:maxdepth: 1

src/axom/quest/DiscreteShape.cpp

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ class AffineMatrixVisitor : public klee::GeometryOperatorVisitor
5454

5555
void visit(const klee::CompositeOperator&) override
5656
{
57-
SLIC_WARNING("CompositeOperator not supported for Shaper query");
57+
SLIC_WARNING_ROOT("CompositeOperator not supported for Shaper query");
5858
m_isValid = false;
5959
}
6060
void visit(const klee::SliceOperator&) override
6161
{
62-
SLIC_WARNING("SliceOperator not yet supported for Shaper query");
62+
SLIC_WARNING_ROOT("SliceOperator not yet supported for Shaper query");
6363
m_isValid = false;
6464
}
6565

@@ -145,9 +145,9 @@ std::shared_ptr<mint::Mesh> DiscreteShape::createMeshRepresentation()
145145
if(!m_shape.getGeometry().hasGeometry())
146146
{
147147
// If shape has no geometry, there's nothing to discretize.
148-
SLIC_DEBUG(axom::fmt::format("Current shape '{}' of material '{}' has no geometry",
149-
m_shape.getName(),
150-
m_shape.getMaterial()));
148+
SLIC_DEBUG_ROOT(axom::fmt::format("Current shape '{}' of material '{}' has no geometry",
149+
m_shape.getName(),
150+
m_shape.getMaterial()));
151151
return m_meshRep;
152152
}
153153

@@ -163,8 +163,8 @@ std::shared_ptr<mint::Mesh> DiscreteShape::createMeshRepresentation()
163163

164164
if(utilities::string::endsWith(shapePath, ".stl"))
165165
{
166-
SLIC_ASSERT_MSG(file_format == "stl",
167-
axom::fmt::format(" '{}' format requires .stl file type", file_format));
166+
SLIC_ERROR_ROOT_IF(file_format != "stl",
167+
axom::fmt::format(" '{}' format requires .stl file type", file_format));
168168

169169
axom::mint::Mesh* meshRep = nullptr;
170170
#ifdef AXOM_USE_MPI
@@ -178,8 +178,8 @@ std::shared_ptr<mint::Mesh> DiscreteShape::createMeshRepresentation()
178178
}
179179
else if(utilities::string::endsWith(shapePath, ".proe"))
180180
{
181-
SLIC_ASSERT_MSG(file_format == "proe",
182-
axom::fmt::format(" '{}' format requires .proe file type", file_format));
181+
SLIC_ERROR_ROOT_IF(file_format != "proe",
182+
axom::fmt::format(" '{}' format requires .proe file type", file_format));
183183

184184
axom::mint::Mesh* meshRep = nullptr;
185185
#ifdef AXOM_USE_MPI
@@ -192,8 +192,8 @@ std::shared_ptr<mint::Mesh> DiscreteShape::createMeshRepresentation()
192192
#ifdef AXOM_USE_C2C
193193
else if(utilities::string::endsWith(shapePath, ".contour"))
194194
{
195-
SLIC_ASSERT_MSG(file_format == "c2c",
196-
axom::fmt::format(" '{}' format requires .contour file type", file_format));
195+
SLIC_ERROR_ROOT_IF(file_format != "c2c",
196+
axom::fmt::format(" '{}' format requires .contour file type", file_format));
197197

198198
// Get the transforms that are being applied to the mesh. Get them
199199
// as a single concatenated matrix.
@@ -230,7 +230,7 @@ std::shared_ptr<mint::Mesh> DiscreteShape::createMeshRepresentation()
230230
#endif
231231
else
232232
{
233-
SLIC_ERROR(
233+
SLIC_ERROR_ROOT(
234234
axom::fmt::format("Unsupported filetype for this Axom configuration. "
235235
"Provided file was '{}', with format '{}'",
236236
shapePath,
@@ -716,7 +716,7 @@ numerics::Matrix<double> DiscreteShape::sorAxisRotMatrix(const Vector3D& dir)
716716
void DiscreteShape::setSamplesPerKnotSpan(int nSamples)
717717
{
718718
using axom::utilities::clampLower;
719-
SLIC_WARNING_IF(
719+
SLIC_WARNING_ROOT_IF(
720720
nSamples < 1,
721721
axom::fmt::format("Samples per knot span must be at least 1. Provided value was {}", nSamples));
722722

@@ -725,25 +725,26 @@ void DiscreteShape::setSamplesPerKnotSpan(int nSamples)
725725

726726
void DiscreteShape::setVertexWeldThreshold(double threshold)
727727
{
728-
SLIC_WARNING_IF(
728+
SLIC_WARNING_ROOT_IF(
729729
threshold <= 0.,
730-
axom::fmt::format("Vertex weld threshold should be positive Provided value was {}", threshold));
730+
axom::fmt::format("Vertex weld threshold should be positive. Provided value was {}", threshold));
731731

732732
m_vertexWeldThreshold = threshold;
733733
}
734734

735735
void DiscreteShape::setPercentError(double percent)
736736
{
737737
using axom::utilities::clampVal;
738-
SLIC_WARNING_IF(percent <= MINIMUM_PERCENT_ERROR,
739-
axom::fmt::format("Percent error must be greater than {}. Provided value "
740-
"was {}. Dynamic refinement will not be used.",
741-
MINIMUM_PERCENT_ERROR,
742-
percent));
743-
SLIC_WARNING_IF(percent > MAXIMUM_PERCENT_ERROR,
744-
axom::fmt::format("Percent error must be less than {}. Provided value was {}",
745-
MAXIMUM_PERCENT_ERROR,
746-
percent));
738+
SLIC_WARNING_ROOT_IF(percent <= MINIMUM_PERCENT_ERROR,
739+
axom::fmt::format("Percent error must be greater than {}. Provided value "
740+
"was {}. Dynamic refinement will not be used.",
741+
MINIMUM_PERCENT_ERROR,
742+
percent));
743+
SLIC_WARNING_ROOT_IF(
744+
percent > MAXIMUM_PERCENT_ERROR,
745+
axom::fmt::format("Percent error must be less than {}. Provided value was {}",
746+
MAXIMUM_PERCENT_ERROR,
747+
percent));
747748
if(percent <= MINIMUM_PERCENT_ERROR)
748749
{
749750
m_refinementType = DiscreteShape::RefinementUniformSegments;
@@ -753,8 +754,8 @@ void DiscreteShape::setPercentError(double percent)
753754

754755
void DiscreteShape::setPrefixPath(const std::string& prefixPath)
755756
{
756-
SLIC_ERROR_IF(!prefixPath.empty() && !axom::utilities::filesystem::pathExists(prefixPath),
757-
"Path '" + prefixPath + "' does not exist.");
757+
SLIC_ERROR_ROOT_IF(!prefixPath.empty() && !axom::utilities::filesystem::pathExists(prefixPath),
758+
axom::fmt::format("Path '{}' does not exist.", prefixPath));
758759
m_prefixPath = prefixPath;
759760
}
760761

@@ -765,16 +766,16 @@ void DiscreteShape::setParentGroup(axom::sidre::Group* parentGroup)
765766
// Use object address to create a unique name for sidre group under parent.
766767
std::string myGroupName;
767768
int i = 0;
768-
while(myGroupName.empty())
769+
do
769770
{
770-
std::ostringstream os;
771-
os << "DiscreteShapeTemp-" << i;
772-
if(!parentGroup->hasGroup(os.str()))
771+
const std::string str = axom::fmt::format("DiscreteShapeTemp-{}", i);
772+
if(!parentGroup->hasGroup(str))
773773
{
774-
myGroupName = os.str();
774+
myGroupName = str;
775775
}
776776
++i;
777-
}
777+
} while(myGroupName.empty());
778+
778779
m_sidreGroup = parentGroup->createGroup(myGroupName);
779780
}
780781
}

src/axom/quest/Shaper.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void Shaper::setFilePath(const std::string& filePath)
175175
void Shaper::setSamplesPerKnotSpan(int nSamples)
176176
{
177177
using axom::utilities::clampLower;
178-
SLIC_WARNING_IF(
178+
SLIC_WARNING_ROOT_IF(
179179
nSamples < 1,
180180
axom::fmt::format("Samples per knot span must be at least 1. Provided value was {}", nSamples));
181181

@@ -184,7 +184,7 @@ void Shaper::setSamplesPerKnotSpan(int nSamples)
184184

185185
void Shaper::setVertexWeldThreshold(double threshold)
186186
{
187-
SLIC_WARNING_IF(
187+
SLIC_WARNING_ROOT_IF(
188188
threshold <= 0.,
189189
axom::fmt::format("Vertex weld threshold should be positive Provided value was {}", threshold));
190190

@@ -194,15 +194,16 @@ void Shaper::setVertexWeldThreshold(double threshold)
194194
void Shaper::setPercentError(double percent)
195195
{
196196
using axom::utilities::clampVal;
197-
SLIC_WARNING_IF(percent <= MINIMUM_PERCENT_ERROR,
198-
axom::fmt::format("Percent error must be greater than {}. Provided value "
199-
"was {}. Dynamic refinement will not be used.",
200-
MINIMUM_PERCENT_ERROR,
201-
percent));
202-
SLIC_WARNING_IF(percent > MAXIMUM_PERCENT_ERROR,
203-
axom::fmt::format("Percent error must be less than {}. Provided value was {}",
204-
MAXIMUM_PERCENT_ERROR,
205-
percent));
197+
SLIC_WARNING_ROOT_IF(percent <= MINIMUM_PERCENT_ERROR,
198+
axom::fmt::format("Percent error must be greater than {}. Provided value "
199+
"was {}. Dynamic refinement will not be used.",
200+
MINIMUM_PERCENT_ERROR,
201+
percent));
202+
SLIC_WARNING_ROOT_IF(
203+
percent > MAXIMUM_PERCENT_ERROR,
204+
axom::fmt::format("Percent error must be less than {}. Provided value was {}",
205+
MAXIMUM_PERCENT_ERROR,
206+
percent));
206207
if(percent <= MINIMUM_PERCENT_ERROR)
207208
{
208209
m_refinementType = DiscreteShape::RefinementUniformSegments;
@@ -237,8 +238,9 @@ void Shaper::loadShapeInternal(const klee::Shape& shape, double percentError, do
237238
SLIC_INFO_ROOT(
238239
axom::fmt::format("{:-^80}", axom::fmt::format(" Loading shape '{}' ", shape.getName())));
239240

240-
SLIC_ASSERT_MSG(this->isValidFormat(this->shapeFormat(shape)),
241-
axom::fmt::format("Shape has unsupported format: '{}", this->shapeFormat(shape)));
241+
SLIC_ERROR_ROOT_IF(
242+
!this->isValidFormat(this->shapeFormat(shape)),
243+
axom::fmt::format("Shape has unsupported format: '{}", this->shapeFormat(shape)));
242244

243245
// Code for discretizing shapes has been factored into DiscreteShape class.
244246
DiscreteShape discreteShape(shape, m_dataStore.getRoot(), m_prefixPath);

src/axom/quest/examples/shaping_driver.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct Input
105105
auto res = axom::NumericArray<int, 2>(boxResolution.data());
106106
auto bbox = BBox2D(Pt2D(boxMins.data()), Pt2D(boxMaxs.data()));
107107

108-
SLIC_INFO(
108+
SLIC_INFO_ROOT(
109109
axom::fmt::format("Creating inline box mesh of resolution {} and bounding box {}", res, bbox));
110110

111111
mesh = quest::util::make_cartesian_mfem_mesh_2D(bbox, res, outputOrder);
@@ -118,14 +118,14 @@ struct Input
118118
auto res = axom::NumericArray<int, 3>(boxResolution.data());
119119
auto bbox = BBox3D(Pt3D(boxMins.data()), Pt3D(boxMaxs.data()));
120120

121-
SLIC_INFO(
121+
SLIC_INFO_ROOT(
122122
axom::fmt::format("Creating inline box mesh of resolution {} and bounding box {}", res, bbox));
123123

124124
mesh = quest::util::make_cartesian_mfem_mesh_3D(bbox, res, outputOrder);
125125
}
126126
break;
127127
default:
128-
SLIC_ERROR("Only 2D and 3D meshes are currently supported.");
128+
SLIC_ERROR_ROOT("Only 2D and 3D meshes are currently supported.");
129129
break;
130130
}
131131

@@ -456,7 +456,6 @@ int main(int argc, char** argv)
456456

457457
#ifdef AXOM_USE_MPI
458458
MPI_Bcast(&retval, 1, MPI_INT, 0, MPI_COMM_WORLD);
459-
MPI_Finalize();
460459
#endif
461460
exit(retval);
462461
}

src/axom/sina/docs/sphinx/hdf5_vs_json.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
.. ##
44
.. ## SPDX-License-Identifier: (BSD-3-Clause)
55
6-
.. _curvesets-label:
6+
.. _output-format-label:
77

8-
=========
8+
=============
99
HDF5 and JSON
10-
=========
10+
=============
1111

1212
Sina's C++ and Python Code supports loading both JSON and HDF5 files as Documents,
1313
and saving Documents to either file type.
@@ -21,7 +21,7 @@ Why You Should Use JSON
2121
------------------------------
2222

2323
* JSON is more universally parsable
24-
* JSON code is human readable allowing you more, easier flexibility with searching for relevent data. This is most applicable with smaller files since large amounts of data or curve sets quickly become more efficient to navigate digitally
24+
* JSON code is human readable allowing you more, easier flexibility with searching for relevant data. This is most applicable with smaller files since large amounts of data or curve sets quickly become more efficient to navigate digitally
2525
* JSON outperforms HDF5 in speed and size efficiency when dealing with non-curve set data and outperforms at smaller curve set sizes (just before :math:`10^2` Curve Sets for Size and around :math:`10^3.25` for Speed)
2626

2727
------------------------------

0 commit comments

Comments
 (0)