Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/sbml/packages/spatial/validator/SpatialSBMLErrorTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,9 +882,9 @@ static const packageErrorTableEntry spatialErrorTable[] =
{ SpatialCompartmentMappingUnitSizeMustBeFraction,
"The 'unitSize' attribute must be between 0 and 1.",
LIBSBML_CAT_GENERAL_CONSISTENCY,
LIBSBML_SEV_ERROR,
"The attribute 'spatial:unitSize' on a <compartmentMapping> must have a value "
"between 0 and 1, inclusive.",
LIBSBML_SEV_WARNING,
"The attribute 'spatial:unitSize' on a <compartmentMapping> should have a value "
"between 0 and 1, inclusive, when the dimensions of the referenced compartments are the same.",
{ "L3V1 Spatial V1 Section"
}
},
Expand All @@ -894,7 +894,7 @@ static const packageErrorTableEntry spatialErrorTable[] =
"The 'unitSize' attributes should sum to 1.",
LIBSBML_CAT_GENERAL_CONSISTENCY,
LIBSBML_SEV_WARNING,
"The values of the 'spatial:unitSize' attributes of every <compartmentMapping> with the same 'spatial:domainType' should sum to 1.",
"The values of the 'spatial:unitSize' attributes of every <compartmentMapping> with the same 'spatial:domainType' should sum to 1, when the dimensions of the referenced compartments are the same.",
{ "L3V1 Spatial V1 Section"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,30 @@ 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());
const Compartment* pOtherComp = NULL;
for (unsigned int i = 0; i < m.getNumCompartments(); ++i)
{
const Compartment* comp = m.getCompartment(i);
if (!comp) continue;
const SpatialCompartmentPlugin *compPlugin = dynamic_cast<const SpatialCompartmentPlugin *>(comp->getPlugin("spatial"));
if (!compPlugin) continue;
const CompartmentMapping* otherMapping = compPlugin->getCompartmentMapping();
if (!otherMapping) continue;
if (otherMapping->getDomainType() != cmap.getDomainType()) continue;
pOtherComp = comp;
break;
}
pre(pOtherComp != NULL);

// this constraint should only apply when
// the domainType's compartment has the same dimension as the mapped compartment
pre(pComp->getSpatialDimensions() == pOtherComp->getSpatialDimensions());

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