79 if (levelSet ==
nullptr) {
81 .addWarning(
"No level set was passed to Check.")
86 std::ostringstream oss;
88 for (hrleConstSparseStarIterator<hrleDomain<T, D>, 1> it(
89 levelSet->getDomain());
90 !it.isFinished(); it.next()) {
92 if (it.getCenter().isDefined()) {
93 for (
int i = 0; i < 2 *
D; ++i) {
94 if (it.getNeighbor(i).isDefined()) {
95 if (std::abs(GetStatusFromDistance(it.getCenter().getValue()) -
96 GetStatusFromDistance(it.getNeighbor(i).getValue())) >
98 oss <<
"The defined point " << it.getCenter().getStartIndices()
99 <<
" has an inconsistent defined neighbor in direction "
100 << getDirectionString(i) <<
"!" << std::endl;
102 oss <<
"Value center point: " << it.getCenter().getValue()
103 <<
" Value neighbor point: " << it.getNeighbor(i).getValue()
107 if (it.getNeighbor(i).getValue() >= 0.) {
108 if (it.getCenter().getValue() <
T(-0.5)) {
109 oss <<
"The defined point " << it.getCenter().getStartIndices()
110 <<
" has a level set value less than -0.5 but has an "
111 "undefined positive neighbor in direction "
112 << getDirectionString(i) <<
"!" << std::endl;
115 if (it.getCenter().getValue() >
T(0.5)) {
116 oss <<
"The defined point " << it.getCenter().getStartIndices()
117 <<
" has a level set value greater than 0.5 but has an "
118 "undefined negative neighbor in direction "
119 << getDirectionString(i) <<
"!" << std::endl;
125 for (
int i = 0; i < 2 *
D; ++i) {
126 if (!it.getNeighbor(i).isDefined()) {
127 if (isNegative(it.getCenter().getValue()) !=
128 isNegative(it.getNeighbor(i).getValue())) {
129 oss <<
"The undefined run from "
130 << it.getCenter().getStartIndices() <<
" to "
131 << it.getCenter().getEndIndices()
132 <<
" has undefined neighbor grid points of opposite sign in "
134 << getDirectionString(i) <<
"!" << std::endl;
142 if (std::string s = oss.str(); !s.empty()) {
146 std::string message =
"Report from Check:\n" + s;
147 Logger::getInstance().addError(s);