void SubProblem::checkMatProps(std::map<T, std::set<std::string>> & props, std::map<T, std::multimap<std::string, std::string>> & check_props, std::map<T, std::set<MaterialPropertyName>> & zero_props) { // Variable for storing the value for ANY_BLOCK_ID/ANY_BOUNDARY_ID T any_id = getAnyID<T>(); // Variable for storing all available blocks/boundaries from the mesh std::set<T> all_ids(mesh().getBlockOrBoundaryIDs<T>()); // Loop through the properties to check for (const auto & check_it : check_props) { // The current id for the property being checked (BoundaryID || BlockID) T check_id = check_it.first; // In the case when the material being checked has an ID is set to ANY, then loop through all // the possible ids and verify that the material property is defined. std::set<T> check_ids = {check_id}; if (check_id == any_id) check_ids = all_ids; // Loop through all the block/boundary ids for (const auto & id : check_ids) { // Loop through all the stored properties for (const auto & prop_it : check_it.second) { // Produce an error if the material property is not defined on the current block/boundary // and any block/boundary // and not is not a zero material property. if (props[id].count(prop_it.second) == 0 && props[any_id].count(prop_it.second) == 0 && zero_props[id].count(prop_it.second) == 0 && zero_props[any_id].count(prop_it.second) == 0) { std::string check_name = restrictionCheckName(id); if (check_name.empty()) check_name = std::to_string(id); mooseError("Material property '", prop_it.second, "', requested by '", prop_it.first, "' is not defined on ", restrictionTypeName<T>(), " ", check_name); } } } } }
void SubProblem::checkBoundaryMatProps() { // Variable for storing the value for ANY_BLOCK_ID/ANY_BOUNDARY_ID BoundaryID any_id = Moose::ANY_BOUNDARY_ID; // Variable for storing all available blocks/boundaries from the mesh std::set<BoundaryID> all_ids(mesh().getBoundaryIDs()); // Loop through the properties to check for (const auto & check_it : _map_boundary_material_props_check) { // The current id for the property being checked (BoundaryID || BlockID) BoundaryID check_id = check_it.first; // In the case when the material being checked has an ID is set to ANY, then loop through all // the possible ids and verify that the material property is defined. std::set<BoundaryID> check_ids{check_id}; if (check_id == any_id) check_ids = all_ids; // Loop through all the block/boundary ids for (const auto & id : check_ids) { // Loop through all the stored properties for (const auto & prop_it : check_it.second) { // Produce an error if the material property is not defined on the current block/boundary // and any block/boundary // and not is not a zero material property. if (_map_boundary_material_props[id].count(prop_it.second) == 0 && _map_boundary_material_props[any_id].count(prop_it.second) == 0 && _zero_boundary_material_props[id].count(prop_it.second) == 0 && _zero_boundary_material_props[any_id].count(prop_it.second) == 0) { std::string check_name = restrictionBoundaryCheckName(id); if (check_name.empty()) check_name = std::to_string(id); mooseError("Material property '", prop_it.second, "', requested by '", prop_it.first, "' is not defined on boundary ", check_name); } } } } }
void SubProblem::checkMatProps(std::map<T, std::set<std::string> > & props, std::map<T, std::multimap<std::string, std::string> > & check_props, std::map<T, std::set<MaterialPropertyName> > & zero_props) { // Set flag for type: block/boundary bool block_type; // Variable for storing the value for ANY_BLOCK_ID/ANY_BOUNDARY_ID T any_id = mesh().getAnyID<T>(); // Variable for storing all available blocks/boundaries from the mesh std::set<T> all_ids(mesh().getBlockOrBoundaryIDs<T>()); // Loop through the properties to check for (typename std::map<T, std::multimap<std::string, std::string> >::const_iterator check_it = check_props.begin(); check_it != check_props.end(); ++check_it) { // The current id for the property being checked (BoundaryID || BlockID) T check_id = check_it->first; // Get the name of the block/boundary (for error reporting) std::string check_name = restrictionCheckName(check_id); // Create a name if it doesn't exist if (check_name.empty()) { std::ostringstream ss; ss << check_id; check_name = ss.str(); } // In the case when the material being checked has an ID is set to ANY, then loop through all // the possible ids and verify that the material property is defined. if (check_id == any_id) { // Loop through all the block/boundary ids for (typename std::set<T>::const_iterator all_it = all_ids.begin(); all_it != all_ids.end(); ++all_it) { // Loop through all the stored properties for (std::multimap<std::string, std::string>::const_iterator prop_it = check_it->second.begin(); prop_it != check_it->second.end(); ++prop_it) { // Produce an error if the material property is not defined on the current block/boundary and any block/boundary // and not is not a zero material property. if (props[*all_it].find(prop_it->second) == props[*all_it].end() && props[any_id].find(prop_it->second) == props[any_id].end() && zero_props[*all_it].find(prop_it->second) == zero_props[*all_it].end() && zero_props[any_id].find(prop_it->second) == zero_props[any_id].end()) mooseError("Material property '" << prop_it->second << "', requested by '" << prop_it->first << "' is not defined on " << restrictionTypeName<T>() << " " << *all_it); } } } // If the property is contained in the map of properties, loop over the stored names for the current id and // check that the property is defined else if (props.find(check_id) != props.end()) for (std::multimap<std::string, std::string>::const_iterator prop_it = check_it->second.begin(); prop_it != check_it->second.end(); ++prop_it) { // Check if the name is contained in the map and skip over the id if it is Moose::ANY_BLOCK_ID/ANY_BOUNDARY_ID if (props[check_id].find(prop_it->second) == props[check_id].end() && zero_props[check_id].find(prop_it->second) == zero_props[check_id].end() && check_id != any_id) mooseError("Material property '" + prop_it->second + "', requested by '" + prop_it->first + "' is not defined on " + restrictionTypeName<T>() + " " + check_name); } else mooseError("No material defined on " + restrictionTypeName<T>() + " " + check_name); } }