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)
// If the set this geometry belongs to is finished, skip the rest
if (status.finished(id))
{ status.increaseRejectedCounter(); continue; }
{ status.increaseRejectedCounter("set finished"); continue; }
// Moreover, we want to avoid small fragments (< 250 m²)
const auto containedArea = computeContainedMagnitude(geom, networkDomain);
if (containedArea < 350.0)
{ status.increaseRejectedCounter(); continue; }
{ status.increaseRejectedCounter("minimum contained area violation"); continue; }
// enforce constraints w.r.t. to the other entities
if (!constraintsMatrix.evaluate(entitySets, geom, id))
{ status.increaseRejectedCounter(); continue; }
if (const auto res = constraintsMatrix.evaluate(entitySets, geom, id); !res)
{ status.increaseRejectedCounter(res.violationLabel()); continue; }
// enforce constraints w.r.t. the domain boundaries
if (!constraintsOnDomain.evaluate(domainBoundaryFaces, geom))
{ status.increaseRejectedCounter(); continue; }
if (const auto res = constraintsOnDomain.evaluate(domainBoundaryFaces, geom); !res)
{ status.increaseRejectedCounter(res.violationLabel() + " (boundary)"); continue; }
// the geometry is admissible
entitySets.addEntity(geom, id);
......@@ -205,7 +205,9 @@ int main(int argc, char** argv)
const auto density = containedNetworkArea/domainVolume;
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():
# If the set this geometry belongs to is finished, skip the rest
if status.finished(id):
sampleIntoSet1 = not sampleIntoSet1
status.increaseRejectedCounter()
status.increaseRejectedCounter("set finished")
continue
# Moreover, we want to avoid small fragments (< 250 m²)
from frackit.geometry import computeContainedMagnitude
containedArea = computeContainedMagnitude(geom, networkDomain);
if containedArea < 350.0:
status.increaseRejectedCounter()
status.increaseRejectedCounter("minimum contained area violation")
continue
# enforce constraints w.r.t. to the other entities
if not constraintsMatrix.evaluate(entitySets, geom, id):
status.increaseRejectedCounter()
check = constraintsMatrix.evaluate(entitySets, geom, id)
if not check:
status.increaseRejectedCounter(check.violationLabel())
continue
# enforce constraints w.r.t. the domain boundaries
if not constraintsOnDomain.evaluate(domainBoundaryFaces, geom):
status.increaseRejectedCounter()
check = constraintsOnDomain.evaluate(domainBoundaryFaces, geom)
if not check:
status.increaseRejectedCounter(check.violationLabel() + " (boundary)")
continue
# the geometry is admissible
......@@ -178,6 +180,9 @@ while not status.finished():
density = containedNetworkArea/domainVolume;
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 ##
......
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