Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the three 'Robin' boundary conditions. #263

Merged
merged 1 commit into from
Aug 8, 2022
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
9 changes: 3 additions & 6 deletions src/sbml/packages/spatial/extension/SpatialExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,7 @@ SpatialExtension::init()
static
const char* SBML_BOUNDARY_KIND_STRINGS[] =
{
"Robin_valueCoefficient"
, "Robin_inwardNormalGradientCoefficient"
, "Robin_sum"
, "Neumann"
"Neumann"
, "Dirichlet"
, "invalid BoundaryKind value"
};
Expand All @@ -481,7 +478,7 @@ LIBSBML_EXTERN
const char*
BoundaryKind_toString(BoundaryKind_t bk)
{
int min = SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT;
int min = SPATIAL_BOUNDARYKIND_NEUMANN;
int max = SPATIAL_BOUNDARYKIND_INVALID;

if (bk < min || bk > max)
Expand Down Expand Up @@ -533,7 +530,7 @@ LIBSBML_EXTERN
int
BoundaryKind_isValid(BoundaryKind_t bk)
{
int min = SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT;
int min = SPATIAL_BOUNDARYKIND_NEUMANN;
int max = SPATIAL_BOUNDARYKIND_INVALID;

if (bk < min || bk >= max)
Expand Down
25 changes: 6 additions & 19 deletions src/sbml/packages/spatial/extension/SpatialExtension.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,7 @@ typedef enum
*/
typedef enum
{
SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT /*!< The spatial boundarykind is @c "Robin_valueCoefficient". */
, SPATIAL_BOUNDARYKIND_ROBIN_INWARD_NORMAL_GRADIENT_COEFFICIENT /*!< The spatial boundarykind is @c "Robin_inwardNormalGradientCoefficient". */
, SPATIAL_BOUNDARYKIND_ROBIN_SUM /*!< The spatial boundarykind is @c "Robin_sum". */
, SPATIAL_BOUNDARYKIND_NEUMANN /*!< The spatial boundarykind is @c "Neumann". */
SPATIAL_BOUNDARYKIND_NEUMANN /*!< The spatial boundarykind is @c "Neumann". */
, SPATIAL_BOUNDARYKIND_DIRICHLET /*!< The spatial boundarykind is @c "Dirichlet". */
, SPATIAL_BOUNDARYKIND_INVALID /*!< Invalid BoundaryKind value. */
} BoundaryKind_t;
Expand All @@ -449,9 +446,6 @@ typedef enum
* @param bk the #BoundaryKind_t enumeration value to convert.
*
* @return A string corresponding to the given type:
* "Robin_valueCoefficient",
* "Robin_inwardNormalGradientCoefficient",
* "Robin_sum",
* "Neumann",
* "Dirichlet",
* or @c NULL if the value is @sbmlconstant{SPATIAL_BOUNDARYKIND_INVALID,
Expand Down Expand Up @@ -485,9 +479,9 @@ BoundaryKind_parse(const char* code);
* @sbmlconstant{SPATIAL_BOUNDARYKIND_INVALID, BoundaryKind_t} if no match is
* found.
*
* @note The matching is case-sensitive: "Robin_valueCoefficient" will return
* @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT, BoundaryKind_t},
* but "Robin_valueCoefficient" will return
* @note The matching is case-sensitive: "Neumann" will return
* @sbmlconstant{SPATIAL_BOUNDARYKIND_NEUMANN, BoundaryKind_t},
* but "neumann" will return
* @sbmlconstant{SPATIAL_BOUNDARYKIND_INVALID, BoundaryKind_t}.
*
* @if conly
Expand All @@ -506,10 +500,6 @@ BoundaryKind_fromString(const char* code);
* @param bk the #BoundaryKind_t enumeration to query.
*
* @return @c 1 (true) if the #BoundaryKind_t is
* @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT, BoundaryKind_t},
* @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_INWARD_NORMAL_GRADIENT_COEFFICIENT,
* BoundaryKind_t},
* @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_SUM, BoundaryKind_t},
* @sbmlconstant{SPATIAL_BOUNDARYKIND_NEUMANN, BoundaryKind_t}, or
* @sbmlconstant{SPATIAL_BOUNDARYKIND_DIRICHLET, BoundaryKind_t};
* @c 0 (false) otherwise (including
Expand All @@ -531,16 +521,13 @@ BoundaryKind_isValid(BoundaryKind_t bk);
* @param code the string to query.
*
* @return @c 1 (true) if the string is
* "Robin_valueCoefficient",
* "Robin_inwardNormalGradientCoefficient",
* "Robin_sum",
* "Neumann",
* "Dirichlet", or
* "invalid BoundaryKind value";
* @c 0 (false) otherwise.
*
* @note The matching is case-sensitive: "Robin_valueCoefficient" will return
* @c 1 (true), but "Robin_valueCoefficient" will return @c 0 (false).
* @note The matching is case-sensitive: "Neumann" will return
* @c 1 (true), but "neumann" will return @c 0 (false).
*
* @if conly
* @memberof Spatial_t
Expand Down
22 changes: 0 additions & 22 deletions src/sbml/packages/spatial/sbml/BoundaryCondition.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@
* Level&nbsp;3 Version&nbsp;1 Spatial specification, the following are the
* allowable values for "type":
* <ul>
* <li> @c "Robin_valueCoefficient", TODO:add description
*
* <li> @c "Robin_inwardNormalGradientCoefficient", TODO:add description
*
* <li> @c "Robin_sum", TODO:add description
*
* <li> @c "Neumann", TODO:add description
*
* <li> @c "Dirichlet", TODO:add description
Expand Down Expand Up @@ -198,11 +192,6 @@ class LIBSBML_EXTERN BoundaryCondition : public SBase
* @if clike The value is drawn from the enumeration @ref BoundaryKind_t
* @endif
* The possible values returned by this method are:
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT,
* BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_INWARD_NORMAL_GRADIENT_COEFFICIENT,
* BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_SUM, BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_NEUMANN, BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_DIRICHLET, BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_INVALID, BoundaryKind_t}
Expand All @@ -218,9 +207,6 @@ class LIBSBML_EXTERN BoundaryCondition : public SBase
*
* @copydetails doc_boundarycondition_type
* The possible values returned by this method are:
* @li @c "Robin_valueCoefficient"
* @li @c "Robin_inwardNormalGradientCoefficient"
* @li @c "Robin_sum"
* @li @c "Neumann"
* @li @c "Dirichlet"
* @li @c "invalid BoundaryKind value"
Expand Down Expand Up @@ -888,11 +874,6 @@ BoundaryCondition_getVariable(const BoundaryCondition_t * bc);
* @copydetails doc_boundarycondition_type
* @if clike The value is drawn from the enumeration @ref BoundaryKind_t @endif
* The possible values returned by this method are:
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT,
* BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_INWARD_NORMAL_GRADIENT_COEFFICIENT,
* BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_ROBIN_SUM, BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_NEUMANN, BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_DIRICHLET, BoundaryKind_t}
* @li @sbmlconstant{SPATIAL_BOUNDARYKIND_INVALID, BoundaryKind_t}
Expand All @@ -916,9 +897,6 @@ BoundaryCondition_getType(const BoundaryCondition_t * bc);
*
* @copydetails doc_boundarycondition_type
* The possible values returned by this method are:
* @li @c "Robin_valueCoefficient"
* @li @c "Robin_inwardNormalGradientCoefficient"
* @li @c "Robin_sum"
* @li @c "Neumann"
* @li @c "Dirichlet"
* @li @c "invalid BoundaryKind value"
Expand Down
3 changes: 0 additions & 3 deletions src/sbml/packages/spatial/validator/SpatialSBMLError.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@ typedef enum
, SpatialBoundaryConditionsMustBeUnique = 1223651
, SpatialDirichletUnits = 1223652
, SpatialNeumannUnits = 1223653
, SpatialRobinValueCoefficientUnits = 1223654
, SpatialInwardNormalGradientCoefficientUnits = 1223655
, SpatialRobinSumUnits = 1223656
, SpatialGeometryAllowedCoreAttributes = 1223701
, SpatialGeometryAllowedCoreElements = 1223702
, SpatialGeometryAllowedAttributes = 1223703
Expand Down
35 changes: 2 additions & 33 deletions src/sbml/packages/spatial/validator/SpatialSBMLErrorTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -3204,8 +3204,7 @@ static const packageErrorTableEntry spatialErrorTable[] =
"The value of the attribute 'spatial:type' of a <boundaryCondition> object "
"must conform to the syntax of SBML data type 'BoundaryKind' and may only "
"take on the allowed values of 'BoundaryKind' defined in SBML; that is, the "
"value must be one of the following: 'Robin_valueCoefficient', "
"'Robin_inwardNormalGradientCoefficient', 'Robin_sum', 'Neumann' or "
"value must be one of the following: 'Neumann' or "
"'Dirichlet'.",
{ "L3V1 Spatial V1 Section"
}
Expand Down Expand Up @@ -3250,7 +3249,7 @@ static const packageErrorTableEntry spatialErrorTable[] =
"Each BoundaryCondition must define only one boundary.",
LIBSBML_CAT_GENERAL_CONSISTENCY,
LIBSBML_SEV_ERROR,
"For every combination of species and boundary, there must be at most exactly one <boundaryCondition> of type 'Neumann', or exactly one <boundaryCondition> of type 'Dirichlet', or exactly three <boundaryCondition> elements, one of each of the three 'Robin' types.",
"For every combination of species and boundary, there must be at most exactly one <boundaryCondition> of type 'Neumann', or exactly one <boundaryCondition> of type 'Dirichlet'.",
{ "L3V1 Spatial V1 Section"
}
},
Expand All @@ -3275,36 +3274,6 @@ static const packageErrorTableEntry spatialErrorTable[] =
}
},

// 1223654
{ SpatialRobinValueCoefficientUnits,
"A 'Robin_valueCoefficient' BoundaryCondition's units should scale with dimensionless.",
LIBSBML_CAT_UNITS_CONSISTENCY,
LIBSBML_SEV_WARNING,
"The units of a <parameter> with a <boundaryCondition> child of type 'Robin_valueCoefficient' should should scale with the other 'Robin' boundary conditions for the same species and boundary, with suggested base units of dimensionless.",
{ "L3V1 Spatial V1 Section"
}
},

// 1223655
{ SpatialInwardNormalGradientCoefficientUnits,
"A 'Robin_inwardNormalGradientCoefficient' BoundaryCondition's units should scale with 1/length.",
LIBSBML_CAT_UNITS_CONSISTENCY,
LIBSBML_SEV_WARNING,
"The units of a <parameter> with a <boundaryCondition> child of type 'Robin_inwardNormalGradientCoefficient' should should scale with the other 'Robin' boundary conditions for the same species and boundary, with suggested base units of 1/length.",
{ "L3V1 Spatial V1 Section"
}
},

// 1223656
{ SpatialRobinSumUnits,
"A 'Robin_sum' BoundaryCondition's units should scale with concentration.",
LIBSBML_CAT_UNITS_CONSISTENCY,
LIBSBML_SEV_WARNING,
"The units of a <parameter> with a <boundaryCondition> child of type 'Robin_sum' should should scale with the other 'Robin' boundary conditions for the same species and boundary, with suggested base units of the concentration of the referenced <species>.",
{ "L3V1 Spatial V1 Section"
}
},

// 1223701
{ SpatialGeometryAllowedCoreAttributes,
"Core attributes allowed on <geometry>.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ SpatialUniqueBoundaryConditionsCheck::check_(const Model& m, const Model&)
if (m.getLevel() < 3) {
return;
}
set<pair<string, string> > dirichlet_targets, neumann_targets, robin_in_targets, robin_value_targets, robin_sum_targets;
set<pair<string, string> > dirichlet_targets, neumann_targets;
for (unsigned long p = 0; p < m.getNumParameters(); p++) {
const Parameter* param = m.getParameter(p);
const SpatialParameterPlugin* spp = static_cast<const SpatialParameterPlugin*>(param->getPlugin("spatial"));
Expand Down Expand Up @@ -127,27 +127,6 @@ SpatialUniqueBoundaryConditionsCheck::check_(const Model& m, const Model&)
logFailure(m);
continue;
}
if (robin_in_targets.find(bc_pair) != robin_in_targets.end()) {
if (bk != SPATIAL_BOUNDARYKIND_ROBIN_SUM && bk != SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT) {
msg += ", but another <boundaryCondition> of type 'Robin_inwardNormalGradientCoefficient' already exists for that species boundary.";
logFailure(m);
continue;
}
}
if (robin_value_targets.find(bc_pair) != robin_value_targets.end()) {
if (bk != SPATIAL_BOUNDARYKIND_ROBIN_SUM && bk != SPATIAL_BOUNDARYKIND_ROBIN_INWARD_NORMAL_GRADIENT_COEFFICIENT) {
msg += ", but another <boundaryCondition> of type 'Robin_valueCoefficient' already exists for that species boundary.";
logFailure(m);
continue;
}
}
if (robin_sum_targets.find(bc_pair) != robin_sum_targets.end()) {
if (bk != SPATIAL_BOUNDARYKIND_ROBIN_INWARD_NORMAL_GRADIENT_COEFFICIENT && bk != SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT) {
msg += ", but another <boundaryCondition> of type 'Robin_sum' already exists for that species boundary.";
logFailure(m);
continue;
}
}


switch (bk) {
Expand All @@ -157,70 +136,9 @@ SpatialUniqueBoundaryConditionsCheck::check_(const Model& m, const Model&)
case SPATIAL_BOUNDARYKIND_NEUMANN:
neumann_targets.insert(bc_pair);
break;
case SPATIAL_BOUNDARYKIND_ROBIN_INWARD_NORMAL_GRADIENT_COEFFICIENT:
robin_in_targets.insert(bc_pair);
break;
case SPATIAL_BOUNDARYKIND_ROBIN_SUM:
robin_sum_targets.insert(bc_pair);
break;
case SPATIAL_BOUNDARYKIND_ROBIN_VALUE_COEFFICIENT:
robin_value_targets.insert(bc_pair);
break;
}
}
}

//Now check for exactly three Robin boundaries:
for (set<pair<string, string> >::iterator r_i_pair = robin_in_targets.begin(); r_i_pair != robin_in_targets.end(); r_i_pair++) {
pair<string, string> rip = *r_i_pair;
string msg1 = "A <boundaryCondition> has a variable of '";
msg1 += rip.first + "' and a target of '" + rip.second;
msg1 += "', with a type of 'Robin_inwardNormalGradientCoefficient', but there is no corresponding <boundaryCondition> with the same variable and target with type '";
if (robin_sum_targets.find(rip) == robin_sum_targets.end()) {
msg = msg1 + "Robin_sum'.";
logFailure(m);
robin_sum_targets.insert(rip);
}
if (robin_value_targets.find(rip) == robin_value_targets.end()) {
msg = msg1 + "Robin_valueCoefficient'.";
logFailure(m);
robin_value_targets.insert(rip);
}
}

for (set<pair<string, string> >::iterator r_i_pair = robin_sum_targets.begin(); r_i_pair != robin_sum_targets.end(); r_i_pair++) {
pair<string, string> rip = *r_i_pair;
string msg1 = "A <boundaryCondition> has a variable of '";
msg1 += rip.first + "' and a target of '" + rip.second;
msg1 += "', with a type of 'Robin_sum', but there is no corresponding <boundaryCondition> with the same variable and target with type '";
if (robin_in_targets.find(rip) == robin_in_targets.end()) {
msg = msg1 + "Robin_inwardNormalGradientCoefficient'.";
logFailure(m);
robin_in_targets.insert(rip);
}
if (robin_value_targets.find(rip) == robin_value_targets.end()) {
msg = msg1 + "Robin_valueCoefficient'.";
logFailure(m);
robin_value_targets.insert(rip);
}
}

for (set<pair<string, string> >::iterator r_i_pair = robin_value_targets.begin(); r_i_pair != robin_value_targets.end(); r_i_pair++) {
pair<string, string> rip = *r_i_pair;
string msg1 = "A <boundaryCondition> has a variable of '";
msg1 += rip.first + "' and a target of '" + rip.second;
msg1 += "', with a type of 'Robin_valueCoefficient', but there is no corresponding <boundaryCondition> with the same variable and target with type '";
if (robin_in_targets.find(rip) == robin_in_targets.end()) {
msg = msg1 + "Robin_inwardNormalGradientCoefficient'.";
logFailure(m);
robin_in_targets.insert(rip);
}
if (robin_sum_targets.find(rip) == robin_sum_targets.end()) {
msg = msg1 + "Robin_sum'.";
logFailure(m);
robin_sum_targets.insert(rip);
}
}
}


Expand Down
Loading