Commit 905c2eab authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[ex3] collect rejection info

parent b46e23d6
...@@ -177,20 +177,20 @@ int main(int argc, char** argv) ...@@ -177,20 +177,20 @@ int main(int argc, char** argv)
// If the set this geometry belongs to is finished, skip the rest // If the set this geometry belongs to is finished, skip the rest
if (status.finished(id)) if (status.finished(id))
{ status.increaseRejectedCounter(); continue; } { status.increaseRejectedCounter("set finished"); continue; }
// Moreover, we want to avoid small fragments (< 250 m²) // Moreover, we want to avoid small fragments (< 250 m²)
const auto containedArea = computeContainedMagnitude(geom, networkDomain); const auto containedArea = computeContainedMagnitude(geom, networkDomain);
if (containedArea < 350.0) if (containedArea < 350.0)
{ status.increaseRejectedCounter(); continue; } { status.increaseRejectedCounter("minimum contained area violation"); continue; }
// enforce constraints w.r.t. to the other entities // enforce constraints w.r.t. to the other entities
if (!constraintsMatrix.evaluate(entitySets, geom, id)) if (const auto res = constraintsMatrix.evaluate(entitySets, geom, id); !res)
{ status.increaseRejectedCounter(); continue; } { status.increaseRejectedCounter(res.violationLabel()); continue; }
// enforce constraints w.r.t. the domain boundaries // enforce constraints w.r.t. the domain boundaries
if (!constraintsOnDomain.evaluate(domainBoundaryFaces, geom)) if (const auto res = constraintsOnDomain.evaluate(domainBoundaryFaces, geom); !res)
{ status.increaseRejectedCounter(); continue; } { status.increaseRejectedCounter(res.violationLabel() + " (boundary)"); continue; }
// the geometry is admissible // the geometry is admissible
entitySets.addEntity(geom, id); entitySets.addEntity(geom, id);
...@@ -205,7 +205,9 @@ int main(int argc, char** argv) ...@@ -205,7 +205,9 @@ int main(int argc, char** argv)
const auto density = containedNetworkArea/domainVolume; const auto density = containedNetworkArea/domainVolume;
std::cout << "\nEntity density of the contained network: " << density << " m²/m³" << std::endl; std::cout << "\nEntity density of the contained network: " << density << " m²/m³" << std::endl;
// print info on rejection events
status.printRejectionData();
std::cout << std::endl;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
......
...@@ -143,24 +143,26 @@ while not status.finished(): ...@@ -143,24 +143,26 @@ while not status.finished():
# If the set this geometry belongs to is finished, skip the rest # If the set this geometry belongs to is finished, skip the rest
if status.finished(id): if status.finished(id):
sampleIntoSet1 = not sampleIntoSet1 sampleIntoSet1 = not sampleIntoSet1
status.increaseRejectedCounter() status.increaseRejectedCounter("set finished")
continue continue
# Moreover, we want to avoid small fragments (< 250 m²) # Moreover, we want to avoid small fragments (< 250 m²)
from frackit.geometry import computeContainedMagnitude from frackit.geometry import computeContainedMagnitude
containedArea = computeContainedMagnitude(geom, networkDomain); containedArea = computeContainedMagnitude(geom, networkDomain);
if containedArea < 350.0: if containedArea < 350.0:
status.increaseRejectedCounter() status.increaseRejectedCounter("minimum contained area violation")
continue continue
# enforce constraints w.r.t. to the other entities # enforce constraints w.r.t. to the other entities
if not constraintsMatrix.evaluate(entitySets, geom, id): check = constraintsMatrix.evaluate(entitySets, geom, id)
status.increaseRejectedCounter() if not check:
status.increaseRejectedCounter(check.violationLabel())
continue continue
# enforce constraints w.r.t. the domain boundaries # enforce constraints w.r.t. the domain boundaries
if not constraintsOnDomain.evaluate(domainBoundaryFaces, geom): check = constraintsOnDomain.evaluate(domainBoundaryFaces, geom)
status.increaseRejectedCounter() if not check:
status.increaseRejectedCounter(check.violationLabel() + " (boundary)")
continue continue
# the geometry is admissible # the geometry is admissible
...@@ -178,6 +180,9 @@ while not status.finished(): ...@@ -178,6 +180,9 @@ while not status.finished():
density = containedNetworkArea/domainVolume; density = containedNetworkArea/domainVolume;
print("\nEntity density of the contained network: {:f} m²/m³\n".format(density)) print("\nEntity density of the contained network: {:f} m²/m³\n".format(density))
# print info on rejection events
status.printRejectionData();
print("")
########################################################################## ##########################################################################
## 5. The entities of the network have been created. We can now ## ## 5. The entities of the network have been created. We can now ##
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment