Skip to content

Commit

Permalink
#275: check that spatial dimensions match before running test
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed Oct 27, 2022
1 parent 6135015 commit 9e41596
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,17 @@ END_CONSTRAINT
// 1221350
START_CONSTRAINT(SpatialCompartmentMappingUnitSizeMustBeFraction, CompartmentMapping, cmap)
{
SpatialModelPlugin *plug = (SpatialModelPlugin*)(m.getPlugin("spatial"));
pre(plug != NULL);
const Compartment *pComp = dynamic_cast<const Compartment*>(cmap.getParentSBMLObject());
pre(pComp != NULL);
pre(plug->isSetGeometry());
DomainType* pDomain = plug->getGeometry()->getDomainType(cmap.getDomainType());
pre(pDomain != NULL);
// this constraint should only apply when
// the domainType has the same dimension as the compartment
pre(pComp->getSpatialDimensions() == pDomain->getSpatialDimensions());

bool fail = false;
if (cmap.isSetUnitSize() && (cmap.getUnitSize() > 1 || cmap.getUnitSize() < 0)) {
fail = true;
Expand Down

0 comments on commit 9e41596

Please sign in to comment.