Skip to content

Commit eb8b730

Browse files
authored
Merge branch 'develop' into feature/han12/2d_shaping
2 parents a310f86 + 049c839 commit eb8b730

34 files changed

+1977
-523
lines changed

.mailmap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Cyrus D. Harrison <[email protected]> Cyrus Harrison <[email protected]>
2424
Cyrus D. Harrison <[email protected]> Cyrus Harrison <[email protected]>
2525
Cyrus D. Harrison <[email protected]> Cyrus <[email protected]>
2626
Daniel Taller <[email protected]> Danny Taller <[email protected]>
27+
Eric B. Chin <[email protected]> E. B. Chin <[email protected]>
2728
Esteban Pauli <[email protected]> Esteban Pauli <[email protected]>
2829
Evan Taylor Desantola <[email protected]> Evan Taylor DeSantola <[email protected]>
2930
format-robot <[email protected]> format-robot <[email protected]>
@@ -67,6 +68,8 @@ Robert Carson <[email protected]> Robert <[email protected]>
6768
Robert Carson <[email protected]> rcarson3 <[email protected]>
6869
Robert Cohn <[email protected]> rscohn2 <[email protected]>
6970
Samuel P. Mish <[email protected]> samuelpmishLLNL <[email protected]>
71+
Sterbentz <[email protected]> Sterbentz <[email protected]>
72+
7073

7174
Axom Shared User <[email protected]> Asctoolkit Shared User <[email protected]>
7275
Axom Shared User <[email protected]> Asctoolkit Shared User <[email protected]>

.uberenv_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"package_final_phase": "initconfig",
55
"package_source_dir": "../..",
66
"spack_url": "https://github.com/spack/spack.git",
7-
"spack_commit": "82358642aa54ce7fb37e6b19dc20e6740c62bff7",
7+
"spack_commit": "0161b662f73b75d25b31b5422f336eb97c26cdb8",
88
"spack_configs_path": "scripts/spack/configs",
99
"spack_packages_path": ["scripts/spack/radiuss-spack-configs/packages", "scripts/spack/packages"],
1010
"spack_concretizer": "clingo",

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ to use Open Cascade's file I/O capabilities in support of Quest applications.
4141
- Adds a piecewise method to load external data using `sidre::IOManager`. This adds new overloaded methods
4242
of `loadExternalData` in `sidre::IOManager` and `sidre::Group`.
4343
- Adds intersection routines between `primal::Ray` objects and `primal::NURBSCurve`/`primal::NURBSPatch` objects.
44+
- Adds LineFileTagCombiner to Lumberjack to allow combining messages if line number, file, and tag are equal.
4445

4546
### Changed
4647
- `primal::NumericArray` has been moved to `core`. The header is `core/NumericArray.hpp`.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and
2+
// other Axom Project Developers. See the top-level LICENSE file for details.
3+
//
4+
// SPDX-License-Identifier: (BSD-3-Clause)
5+
6+
/*!
7+
*******************************************************************************
8+
* \file LineFileTagCombiner.hpp
9+
*
10+
* \brief This file contains the class implementation of the
11+
* LineFileTagCombiner.
12+
*******************************************************************************
13+
*/
14+
15+
#ifndef LINEFILETAGCOMBINER_HPP
16+
#define LINEFILETAGCOMBINER_HPP
17+
18+
#include "axom/lumberjack/Combiner.hpp"
19+
#include "axom/lumberjack/Message.hpp"
20+
21+
#include <string>
22+
23+
namespace axom
24+
{
25+
namespace lumberjack
26+
{
27+
/*!
28+
*******************************************************************************
29+
* \class LineFileTagCombiner
30+
*
31+
* \brief Combines Message classes if their Message::fileName,
32+
* Message::lineNumer, and Message::tag are equal.
33+
*
34+
*******************************************************************************
35+
*/
36+
class LineFileTagCombiner : public axom::lumberjack::Combiner
37+
{
38+
public:
39+
LineFileTagCombiner() { }
40+
41+
/*!
42+
*****************************************************************************
43+
* \brief Returns the unique string identifier for this combiner. Used by
44+
* Lumberjack to differentiate between other combiners.
45+
*****************************************************************************
46+
*/
47+
const std::string id() { return m_id; }
48+
49+
/*!
50+
*****************************************************************************
51+
* \brief Function used by Lumberjack to indicate whether two messages should
52+
* be combined.
53+
*
54+
* They are not actually combined by this function. Message classes are
55+
* triggered for combination if Message::fileName, Message::lineNumer,
56+
* and Message::tag are equal.
57+
*
58+
* \param [in] leftMessage One of the Messages to be compared.
59+
* \param [in] rightMessage One of the Messages to be compared.
60+
*****************************************************************************
61+
*/
62+
bool shouldMessagesBeCombined(const axom::lumberjack::Message& leftMessage,
63+
const axom::lumberjack::Message& rightMessage)
64+
{
65+
return ((leftMessage.lineNumber() == rightMessage.lineNumber()) &&
66+
leftMessage.fileName().compare(rightMessage.fileName()) == 0 &&
67+
leftMessage.tag().compare(rightMessage.tag()) == 0);
68+
}
69+
70+
/*!
71+
*****************************************************************************
72+
* \brief Combines the combinee into the combined Message.
73+
*
74+
* The only thing truly combined in this Combiner is the ranks from combinee
75+
* to combined. The text will not be combined, even if it is not equal.
76+
* Only text from the first message will be saved.
77+
*
78+
* \param [in,out] combined the Message that will be modified.
79+
* \param [in] combinee the Message that is combined into the other.
80+
* \param [in] ranksLimit The limit on how many individual ranks are tracked
81+
* in the combined Message. Message::rankCount is always incremented.
82+
*
83+
* \pre shouldMessagesBeCombined(combined, combinee) must be true
84+
*****************************************************************************
85+
*/
86+
void combine(axom::lumberjack::Message& combined,
87+
const axom::lumberjack::Message& combinee,
88+
const int ranksLimit)
89+
{
90+
combined.addRanks(combinee.ranks(), combinee.count(), ranksLimit);
91+
}
92+
93+
private:
94+
const std::string m_id = "LineFileTagCombiner";
95+
};
96+
97+
} // end namespace lumberjack
98+
} // end namespace axom
99+
100+
#endif

src/axom/lumberjack/docs/sphinx/combiner_class.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,15 @@ the ranksLimit) and incrementing the Message's count as well. This is handled b
4646
Message.addRanks().
4747

4848
.. note:: You can add this Combiner by calling Lumberjack::addCombiner(new TextEqualityCombiner).
49+
50+
.. _linefiletagcombiner_class_label:
51+
52+
LineFileTagCombiner
53+
^^^^^^^^^^^^^^^^^^^
54+
55+
This Combiner combines the two given Messages if the Message line number, file name,
56+
and tag are equal. It does so by adding the second Message's ranks to the first
57+
Message (if not past the ranksLimit) and incrementing the Message's count as well.
58+
This is handled by Message.addRanks().
59+
60+
.. note:: You can add this Combiner by calling Lumberjack::addCombiner(new LineFileTagCombiner). The combiner does not compare the text of the two messages passed in. Therefore, the message texts do not get combined, and the first message text remains unchanged.

src/axom/lumberjack/tests/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ set(lumberjack_serial_tests
1313
lumberjack_Lumberjack.hpp
1414
lumberjack_Message.hpp
1515
lumberjack_TextEqualityCombiner.hpp
16-
lumberjack_TextTagCombiner.hpp )
16+
lumberjack_TextTagCombiner.hpp
17+
lumberjack_LineFileTagCombiner.hpp )
1718

1819
axom_add_executable(NAME lumberjack_serial_tests
1920
SOURCES lumberjack_serial_main.cpp
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
#include <gtest/gtest.h>
2+
#include <string>
3+
#include <sstream>
4+
#include "axom/lumberjack/Message.hpp"
5+
#include "axom/lumberjack/LineFileTagCombiner.hpp"
6+
7+
// Helper function to create a Message
8+
inline axom::lumberjack::Message createMessage(const std::string& text,
9+
int rank,
10+
int rankCount,
11+
const std::string& fileName,
12+
int lineNumber,
13+
const std::string& tag)
14+
{
15+
axom::lumberjack::Message message;
16+
message.text(text);
17+
message.addRank(rank, rankCount);
18+
message.fileName(fileName);
19+
message.lineNumber(lineNumber);
20+
message.tag(tag);
21+
return message;
22+
}
23+
24+
// Helper function to verify Message attributes
25+
inline void verifyMessage(const axom::lumberjack::Message& message,
26+
const std::string& expectedText,
27+
int expectedLineNumber,
28+
const std::string& expectedFileName,
29+
int expectedCount,
30+
const std::vector<int>& expectedRanks,
31+
const std::string& expectedTag)
32+
{
33+
EXPECT_EQ(message.text().compare(expectedText), 0);
34+
EXPECT_EQ(message.lineNumber(), expectedLineNumber);
35+
EXPECT_EQ(message.fileName().compare(expectedFileName), 0);
36+
EXPECT_EQ(message.count(), expectedCount);
37+
EXPECT_EQ(message.ranks().size(), expectedRanks.size());
38+
for(size_t i = 0; i < expectedRanks.size(); ++i)
39+
{
40+
EXPECT_EQ(message.ranks()[i], expectedRanks[i]);
41+
}
42+
EXPECT_EQ(message.tag().compare(expectedTag), 0);
43+
}
44+
45+
// Struct to hold test parameters
46+
struct TestParams
47+
{
48+
std::string caseName {""};
49+
int lineNumber1 {-1};
50+
int lineNumber2 {-1};
51+
std::string fileName1 {""};
52+
std::string fileName2 {""};
53+
std::string tag1 {""};
54+
std::string tag2 {""};
55+
bool shouldCombine {false};
56+
};
57+
58+
// Parameterized Test Fixture
59+
class LumberjackLineFileTagCombinerTest
60+
: public ::testing::TestWithParam<TestParams>
61+
{ };
62+
63+
TEST_P(LumberjackLineFileTagCombinerTest, CombineMessages)
64+
{
65+
// Arrange
66+
TestParams params = GetParam();
67+
std::string text1 =
68+
"This message does not matter because we do not filter by text";
69+
std::string text2 =
70+
"This message ALSO does not matter because we do not filter by text";
71+
72+
axom::lumberjack::Message m1 =
73+
createMessage(text1, 13, 5, params.fileName1, params.lineNumber1, params.tag1);
74+
axom::lumberjack::Message m2 =
75+
createMessage(text2, 14, 5, params.fileName2, params.lineNumber2, params.tag2);
76+
77+
axom::lumberjack::LineFileTagCombiner combiner;
78+
79+
// Act
80+
bool shouldMessagesBeCombined = combiner.shouldMessagesBeCombined(m1, m2);
81+
if(shouldMessagesBeCombined)
82+
{
83+
combiner.combine(m1, m2, 5);
84+
}
85+
86+
// Assert
87+
EXPECT_EQ(shouldMessagesBeCombined, params.shouldCombine);
88+
if(params.shouldCombine)
89+
{
90+
verifyMessage(m1,
91+
text1,
92+
params.lineNumber1,
93+
params.fileName1,
94+
2,
95+
{13, 14},
96+
params.tag1);
97+
verifyMessage(m2,
98+
text2,
99+
params.lineNumber2,
100+
params.fileName2,
101+
1,
102+
{14},
103+
params.tag2);
104+
}
105+
else
106+
{
107+
verifyMessage(m1,
108+
text1,
109+
params.lineNumber1,
110+
params.fileName1,
111+
1,
112+
{13},
113+
params.tag1);
114+
verifyMessage(m2,
115+
text2,
116+
params.lineNumber2,
117+
params.fileName2,
118+
1,
119+
{14},
120+
params.tag2);
121+
}
122+
}
123+
124+
// Custom Name Generator for Parameterized Tests
125+
inline std::string CustomNameGenerator(
126+
const ::testing::TestParamInfo<TestParams>& info)
127+
{
128+
const TestParams& params = info.param;
129+
return params.caseName;
130+
}
131+
132+
// Define test cases
133+
INSTANTIATE_TEST_SUITE_P(
134+
LumberjackTests,
135+
LumberjackLineFileTagCombinerTest,
136+
::testing::Values(
137+
// Positive case: Equal line numbers, filenames, and tags
138+
TestParams {"case1", 154, 154, "foo.cpp", "foo.cpp", "myTag", "myTag", true},
139+
140+
// Negative case: Different line numbers, same filenames, same tags
141+
TestParams {"case2", 12000, 154, "foo.cpp", "foo.cpp", "myTag", "myTag", false},
142+
143+
// Negative case: Same line numbers, different filenames, same tags
144+
TestParams {"case3", 154, 154, "foo.cpp", "bar.cpp", "myTag", "myTag", false},
145+
146+
// Negative case: Same line numbers, same filenames, different tags
147+
TestParams {"case4", 154, 154, "foo.cpp", "foo.cpp", "myTag", "myOtherTag", false},
148+
149+
// Negative case: Different line numbers, different filenames, same tags
150+
TestParams {"case5", 12000, 154, "foo.cpp", "bar.cpp", "myTag", "myTag", false},
151+
152+
// Negative case: Different line numbers, same filenames, different tags
153+
TestParams {"case6", 12000, 154, "foo.cpp", "foo.cpp", "myTag", "myOtherTag", false},
154+
155+
// Negative case: Same line numbers, different filenames, different tags
156+
TestParams {"case7", 154, 154, "foo.cpp", "bar.cpp", "myTag", "myOtherTag", false},
157+
158+
// Negative case: Different line numbers, different filenames, different tags
159+
TestParams {"case8", 12000, 154, "foo.cpp", "bar.cpp", "myTag", "myOtherTag", false}),
160+
CustomNameGenerator // Use the custom name generator
161+
);

src/axom/lumberjack/tests/lumberjack_serial_main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "lumberjack_Message.hpp"
1010
#include "lumberjack_TextEqualityCombiner.hpp"
1111
#include "lumberjack_TextTagCombiner.hpp"
12+
#include "lumberjack_LineFileTagCombiner.hpp"
1213

1314
int main(int argc, char** argv)
1415
{

src/axom/primal/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ set( primal_headers
6969
operators/detail/intersect_patch_impl.hpp
7070
operators/detail/intersect_impl.hpp
7171
operators/detail/intersect_ray_impl.hpp
72-
operators/detail/winding_number_impl.hpp
72+
operators/detail/winding_number_2d_impl.hpp
73+
operators/detail/winding_number_3d_impl.hpp
7374

7475
## utils
7576
utils/ZipIndexable.hpp

0 commit comments

Comments
 (0)