void Material::registerPropName(std::string prop_name, bool is_get, Material::Prop_State state) { if (!is_get) { _props_to_flags[prop_name] |= static_cast<int>(state); if (static_cast<int>(state) % 2 == 0) _has_stateful_property = true; } // Store material properties for block ids for (std::set<SubdomainID>::const_iterator it = blockIDs().begin(); it != blockIDs().end(); ++it) { // Only save this prop as a "supplied" prop is it was registered as a result of a call to declareProperty not getMaterialProperty if (!is_get) _supplied_props.insert(prop_name); _fe_problem.storeMatPropName(*it, prop_name); } // Store material properties for the boundary ids for (std::set<BoundaryID>::const_iterator it = boundaryIDs().begin(); it != boundaryIDs().end(); ++it) { // Only save this prop as a "supplied" prop is it was registered as a result of a call to declareProperty not getMaterialProperty if (!is_get) _supplied_props.insert(prop_name); _fe_problem.storeMatPropName(*it, prop_name); } }
void Material::registerPropName(std::string prop_name, bool is_get, Material::Prop_State state) { if (!is_get) { _props_to_flags[prop_name] |= static_cast<int>(state); if (static_cast<int>(state) % 2 == 0) _has_stateful_property = true; } // Store material properties for block ids for (const auto & block_id : blockIDs()) { // Only save this prop as a "supplied" prop is it was registered as a result of a call to declareProperty not getMaterialProperty if (!is_get) _supplied_props.insert(prop_name); _fe_problem.storeMatPropName(block_id, prop_name); } // Store material properties for the boundary ids for (const auto & boundary_id : boundaryIDs()) { // Only save this prop as a "supplied" prop is it was registered as a result of a call to declareProperty not getMaterialProperty if (!is_get) _supplied_props.insert(prop_name); _fe_problem.storeMatPropName(boundary_id, prop_name); } }
SideUserObject::SideUserObject(const InputParameters & parameters) : UserObject(parameters), BoundaryRestrictable(parameters), MaterialPropertyInterface(parameters, boundaryIDs()), Coupleable(parameters, false), MooseVariableDependencyInterface(), UserObjectInterface(parameters), TransientInterface(parameters, "side_user_objects"), PostprocessorInterface(parameters), ZeroInterface(parameters), _mesh(_subproblem.mesh()), _q_point(_assembly.qPointsFace()), _qrule(_assembly.qRuleFace()), _JxW(_assembly.JxWFace()), _coord(_assembly.coordTransformation()), _normals(_assembly.normals()), _current_elem(_assembly.elem()), _current_side(_assembly.side()), _current_side_elem(_assembly.sideElem()), _current_side_volume(_assembly.sideElemVolume()) { // Keep track of which variables are coupled so we know what we depend on const std::vector<MooseVariable *> & coupled_vars = getCoupledMooseVars(); for (unsigned int i=0; i<coupled_vars.size(); i++) addMooseVariableDependency(coupled_vars[i]); }
void InternalVolume::initialSetup() { SideIntegralPostprocessor::initialSetup(); const std::set<SubdomainID> & subdomains = _mesh.meshSubdomains(); std::set<SubdomainID>::const_iterator iter = subdomains.begin(); const std::set<SubdomainID>::const_iterator iter_end = subdomains.end(); for ( ; iter != iter_end; ++iter) { const std::set<BoundaryID> & boundaries = _mesh.getSubdomainBoundaryIds(*iter); std::set<BoundaryID>::const_iterator bnd = boundaries.begin(); const std::set<BoundaryID>::const_iterator bnd_end = boundaries.end(); for ( ; bnd != bnd_end; ++bnd ) { const std::set<BoundaryID> & b = boundaryIDs(); std::set<BoundaryID>::const_iterator bit = b.begin(); const std::set<BoundaryID>::const_iterator bit_end = b.end(); for ( ; bit != bit_end; ++bit ) if (*bit == *bnd) { Moose::CoordinateSystemType coord_sys = _fe_problem.getCoordSystem(*iter); if (_component != 0 && coord_sys == Moose::COORD_RSPHERICAL) mooseError("With spherical coordinates, the component must be 0 in InternalVolume."); if (_component > 1 && coord_sys == Moose::COORD_RZ) mooseError("With cylindrical coordinates, the component must be 0 or 1 in InternalVolume."); } } } }
InterfaceUserObject::InterfaceUserObject(const InputParameters & parameters) : UserObject(parameters), BoundaryRestrictableRequired(this, false), // false for applying to sidesets TwoMaterialPropertyInterface(this, Moose::EMPTY_BLOCK_IDS, boundaryIDs()), NeighborCoupleable(this, false, false), MooseVariableDependencyInterface(), UserObjectInterface(this), TransientInterface(this), PostprocessorInterface(this), _mesh(_subproblem.mesh()), _q_point(_assembly.qPointsFace()), _qrule(_assembly.qRuleFace()), _JxW(_assembly.JxWFace()), _coord(_assembly.coordTransformation()), _normals(_assembly.normals()), _current_elem(_assembly.elem()), _current_side(_assembly.side()), _current_side_elem(_assembly.sideElem()), _current_side_volume(_assembly.sideElemVolume()), _neighbor_elem(_assembly.neighbor()), _current_neighbor_volume(_assembly.neighborVolume()) { // Keep track of which variables are coupled so we know what we depend on const std::vector<MooseVariableFEBase *> & coupled_vars = getCoupledMooseVars(); for (const auto & var : coupled_vars) addMooseVariableDependency(var); }
AuxKernel::AuxKernel(const InputParameters & parameters) : MooseObject(parameters), BlockRestrictable(parameters), BoundaryRestrictable(parameters), SetupInterface(parameters), CoupleableMooseVariableDependencyIntermediateInterface(parameters, parameters.get<AuxiliarySystem *>("_aux_sys")->getVariable(parameters.get<THREAD_ID>("_tid"), parameters.get<AuxVariableName>("variable")).isNodal()), FunctionInterface(parameters), UserObjectInterface(parameters), TransientInterface(parameters, "aux_kernels"), MaterialPropertyInterface(parameters, blockIDs(), boundaryIDs()), PostprocessorInterface(parameters), DependencyResolverInterface(), RandomInterface(parameters, *parameters.get<FEProblem *>("_fe_problem"), parameters.get<THREAD_ID>("_tid"), parameters.get<AuxiliarySystem *>("_aux_sys")->getVariable(parameters.get<THREAD_ID>("_tid"), parameters.get<AuxVariableName>("variable")).isNodal()), GeometricSearchInterface(parameters), Restartable(parameters, "AuxKernels"), ZeroInterface(parameters), MeshChangedInterface(parameters), _subproblem(*parameters.get<SubProblem *>("_subproblem")), _sys(*parameters.get<SystemBase *>("_sys")), _nl_sys(*parameters.get<SystemBase *>("_nl_sys")), _aux_sys(*parameters.get<AuxiliarySystem *>("_aux_sys")), _tid(parameters.get<THREAD_ID>("_tid")), _assembly(_subproblem.assembly(_tid)), _var(_aux_sys.getVariable(_tid, parameters.get<AuxVariableName>("variable"))), _nodal(_var.isNodal()), _bnd(boundaryRestricted()), _mesh(_subproblem.mesh()), _q_point(_bnd ? _assembly.qPointsFace() : _assembly.qPoints()), _qrule(_bnd ? _assembly.qRuleFace() : _assembly.qRule()), _JxW(_bnd ? _assembly.JxWFace() : _assembly.JxW()), _coord(_assembly.coordTransformation()), _u(_nodal ? _var.nodalSln() : _var.sln()), _u_old(_nodal ? _var.nodalSlnOld() : _var.slnOld()), _u_older(_nodal ? _var.nodalSlnOlder() : _var.slnOlder()), _test(_var.phi()), _current_elem(_var.currentElem()), _current_side(_var.currentSide()), _current_elem_volume(_assembly.elemVolume()), _current_side_volume(_assembly.sideElemVolume()), _current_node(_assembly.node()), _solution(_aux_sys.solution()) { _supplied_vars.insert(parameters.get<AuxVariableName>("variable")); std::map<std::string, std::vector<MooseVariable *> > coupled_vars = getCoupledVars(); for (std::map<std::string, std::vector<MooseVariable *> >::iterator it = coupled_vars.begin(); it != coupled_vars.end(); ++it) for (std::vector<MooseVariable *>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) _depend_vars.insert((*it2)->name()); }
Material::Material(const InputParameters & parameters) : MooseObject(parameters), BlockRestrictable(this), BoundaryRestrictable(this, blockIDs(), false), // false for being _not_ nodal SetupInterface(this), Coupleable(this, false), MooseVariableDependencyInterface(), ScalarCoupleable(this), FunctionInterface(this), DistributionInterface(this), UserObjectInterface(this), TransientInterface(this), MaterialPropertyInterface(this, blockIDs(), boundaryIDs()), PostprocessorInterface(this), VectorPostprocessorInterface(this), DependencyResolverInterface(), Restartable(this, "Materials"), MeshChangedInterface(parameters), // The false flag disables the automatic call buildOutputVariableHideList; // for Material objects the hide lists are handled by MaterialOutputAction OutputInterface(parameters, false), RandomInterface(parameters, *parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"), parameters.get<THREAD_ID>("_tid"), false), _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")), _fe_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")), _tid(parameters.get<THREAD_ID>("_tid")), _assembly(_subproblem.assembly(_tid)), _bnd(_material_data_type != Moose::BLOCK_MATERIAL_DATA), _neighbor(_material_data_type == Moose::NEIGHBOR_MATERIAL_DATA), _qp(std::numeric_limits<unsigned int>::max()), _qrule(_bnd ? _assembly.qRuleFace() : _assembly.qRule()), _JxW(_bnd ? _assembly.JxWFace() : _assembly.JxW()), _coord(_assembly.coordTransformation()), _q_point(_bnd ? _assembly.qPointsFace() : _assembly.qPoints()), _normals(_assembly.normals()), _current_elem(_neighbor ? _assembly.neighbor() : _assembly.elem()), _current_subdomain_id(_neighbor ? _assembly.currentNeighborSubdomainID() : _assembly.currentSubdomainID()), _current_side(_neighbor ? _assembly.neighborSide() : _assembly.side()), _mesh(_subproblem.mesh()), _coord_sys(_assembly.coordSystem()), _compute(getParam<bool>("compute")), _constant_option(getParam<MooseEnum>("constant_on").getEnum<ConstantTypeEnum>()), _has_stateful_property(false) { // Fill in the MooseVariable dependencies const std::vector<MooseVariableFE *> & coupled_vars = getCoupledMooseVars(); for (const auto & var : coupled_vars) addMooseVariableDependency(var); }
void SideSetsBetweenSubdomains::modify() { MeshBase & mesh = _mesh_ptr->getMesh(); SubdomainID master_id = _mesh_ptr->getSubdomainID(getParam<SubdomainName>("master_block")); SubdomainID paired_id = _mesh_ptr->getSubdomainID(getParam<SubdomainName>("paired_block")); std::vector<BoundaryName> boundary_names = boundaryNames(); std::vector<BoundaryID> boundary_ids(boundaryIDs().begin(), boundaryIDs().end()); // Get a reference to our BoundaryInfo object for later use BoundaryInfo & boundary_info = mesh.get_boundary_info(); MeshBase::const_element_iterator el = mesh.active_elements_begin(); const MeshBase::const_element_iterator end_el = mesh.active_elements_end(); for (; el != end_el ; ++el) { const Elem* elem = *el; SubdomainID curr_subdomain = elem->subdomain_id(); // We only need to loop over elements in the master subdomain if (curr_subdomain != master_id) continue; for (unsigned int side=0; side<elem->n_sides(); side++) { const Elem * neighbor = elem->neighbor(side); if (neighbor != NULL && neighbor->subdomain_id() == paired_id) // is this side between the two blocks? // Add the boundaries for (unsigned int i=0; i<boundary_ids.size(); ++i) boundary_info.add_side(elem, side, boundary_ids[i]); } } for (unsigned int i=0; i<boundary_ids.size(); ++i) boundary_info.sideset_name(boundary_ids[i]) = boundary_names[i]; }
Material::Material(const std::string & name, InputParameters parameters) : MooseObject(name, parameters), BlockRestrictable(parameters), BoundaryRestrictable(parameters, blockIDs()), SetupInterface(parameters), Coupleable(parameters, false), MooseVariableDependencyInterface(), ScalarCoupleable(parameters), FunctionInterface(parameters), UserObjectInterface(parameters), TransientInterface(parameters, "materials"), MaterialPropertyInterface(parameters, blockIDs(), boundaryIDs()), PostprocessorInterface(parameters), DependencyResolverInterface(), Restartable(parameters, "Materials"), ZeroInterface(parameters), MeshChangedInterface(parameters), // The false flag disables the automatic call buildOutputVariableHideList; // for Material objects the hide lists are handled by MaterialOutputAction OutputInterface(parameters, false), _subproblem(*parameters.get<SubProblem *>("_subproblem")), _fe_problem(*parameters.get<FEProblem *>("_fe_problem")), _tid(parameters.get<THREAD_ID>("_tid")), _assembly(_subproblem.assembly(_tid)), _bnd(parameters.get<bool>("_bnd")), _neighbor(getParam<bool>("_neighbor")), _material_data(*parameters.get<MaterialData *>("_material_data")), _qp(std::numeric_limits<unsigned int>::max()), _qrule(_bnd ? _assembly.qRuleFace() : _assembly.qRule()), _JxW(_bnd ? _assembly.JxWFace() : _assembly.JxW()), _coord(_assembly.coordTransformation()), _q_point(_bnd ? _assembly.qPointsFace() : _assembly.qPoints()), _normals(_assembly.normals()), _current_elem(_neighbor ? _assembly.neighbor() : _assembly.elem()), _current_side(_neighbor ? _assembly.neighborSide() : _assembly.side()), _mesh(_subproblem.mesh()), _coord_sys(_assembly.coordSystem()), _has_stateful_property(false) { // Fill in the MooseVariable dependencies const std::vector<MooseVariable *> & coupled_vars = getCoupledMooseVars(); for (unsigned int i=0; i<coupled_vars.size(); i++) addMooseVariableDependency(coupled_vars[i]); // Update the MaterialData pointer in BlockRestrictable to use the correct MaterialData object _blk_material_data = &_material_data; }
void AutoPositionsMultiApp::fillPositions() { MooseMesh & master_mesh = _fe_problem.mesh(); const std::set<BoundaryID> & bids = boundaryIDs(); for (const auto & boundary_id : bids) { // Grab the nodes on the boundary ID and add a Sub-App at each one. const std::vector<dof_id_type> & boundary_node_ids = master_mesh.getNodeList(boundary_id); for (const auto & boundary_node_id : boundary_node_ids) { Node & node = master_mesh.nodeRef(boundary_node_id); _positions.push_back(node); } } }
void Material::registerPropName(std::string prop_name, bool is_get, Material::Prop_State state) { if (!is_get) { _supplied_props.insert(prop_name); _supplied_prop_ids.insert(_material_data->getPropertyId(prop_name)); _props_to_flags[prop_name] |= static_cast<int>(state); if (static_cast<int>(state) % 2 == 0) _has_stateful_property = true; } // Store material properties for block ids for (const auto & block_id : blockIDs()) _fe_problem.storeMatPropName(block_id, prop_name); // Store material properties for the boundary ids for (const auto & boundary_id : boundaryIDs()) _fe_problem.storeMatPropName(boundary_id, prop_name); }
NodalUserObject::NodalUserObject(const InputParameters & parameters) : UserObject(parameters), BlockRestrictable(parameters), BoundaryRestrictable(parameters, blockIDs()), MaterialPropertyInterface(parameters, blockIDs(), boundaryIDs()), UserObjectInterface(parameters), Coupleable(parameters, true), ScalarCoupleable(parameters), MooseVariableDependencyInterface(), TransientInterface(parameters, "nodal_user_objects"), PostprocessorInterface(parameters), RandomInterface(parameters, _fe_problem, _tid, true), ZeroInterface(parameters), _mesh(_subproblem.mesh()), _qp(0), _current_node(_assembly.node()) { const std::vector<MooseVariable *> & coupled_vars = getCoupledMooseVars(); for (unsigned int i=0; i<coupled_vars.size(); i++) addMooseVariableDependency(coupled_vars[i]); }
NodalUserObject::NodalUserObject(const InputParameters & parameters) : UserObject(parameters), BlockRestrictable(parameters), BoundaryRestrictable(parameters, blockIDs(), true), // true for applying to nodesets MaterialPropertyInterface(this, blockIDs(), boundaryIDs()), UserObjectInterface(this), Coupleable(this, true), ScalarCoupleable(this), MooseVariableDependencyInterface(), TransientInterface(this), PostprocessorInterface(this), RandomInterface(parameters, _fe_problem, _tid, true), ZeroInterface(parameters), _mesh(_subproblem.mesh()), _qp(0), _current_node(_assembly.node()), _unique_node_execute(getParam<bool>("unique_node_execute")) { const std::vector<MooseVariable *> & coupled_vars = getCoupledMooseVars(); for (const auto & var : coupled_vars) addMooseVariableDependency(var); }
void AutoPositionsMultiApp::fillPositions() { MooseMesh & master_mesh = _fe_problem.mesh(); const std::set<BoundaryID> & bids = boundaryIDs(); for (std::set<BoundaryID>::iterator bid_it = bids.begin(); bid_it != bids.end(); ++bid_it) { BoundaryID boundary_id = *bid_it; // Grab the nodes on the boundary ID and add a Sub-App at each one. const std::vector<dof_id_type> & boundary_node_ids = master_mesh.getNodeList(boundary_id); for (unsigned int i=0; i<boundary_node_ids.size(); i++) { Node & node = master_mesh.nodeRef(boundary_node_ids[i]); _positions.push_back(node); } } }
bool BoundaryRestrictable::hasBoundaryMaterialPropertyHelper(const std::string & prop_name) const { // Reference to MaterialWarehouse for testing and retrieving boundary ids const MaterialWarehouse & warehouse = _bnd_feproblem->getMaterialWarehouse(); // Complete set of BoundaryIDs that this object is defined const std::set<BoundaryID> & ids = hasBoundary(Moose::ANY_BOUNDARY_ID) ? meshBoundaryIDs() : boundaryIDs(); // Loop over each BoundaryID for this object for (const auto & id : ids) { // Storage of material properties that have been DECLARED on this BoundaryID std::set<std::string> declared_props; // If boundary materials exist, populated the set of properties that were declared if (warehouse.hasActiveBoundaryObjects(id)) { const std::vector<MooseSharedPointer<Material> > & mats = warehouse.getActiveBoundaryObjects(id); for (const auto & mat : mats) { const std::set<std::string> & mat_props = mat->getSuppliedItems(); declared_props.insert(mat_props.begin(), mat_props.end()); } } // If the supplied property is not in the list of properties on the current id, return false if (declared_props.find(prop_name) == declared_props.end()) return false; } // If you get here the supplied property is defined on all boundaries return true; }
bool BoundaryRestrictable::hasBoundaryMaterialPropertyHelper(const std::string & prop_name) const { // Reference to MaterialWarehouse for testing and retrieving boundary ids MaterialWarehouse & material_warehouse = _bnd_feproblem->getMaterialWarehouse(_bnd_tid); // Complete set of BoundaryIDs that this object is defined const std::set<BoundaryID> & ids = hasBoundary(Moose::ANY_BOUNDARY_ID) ? meshBoundaryIDs() : boundaryIDs(); // Loop over each BoundaryID for this object for (std::set<BoundaryID>::const_iterator id_it = ids.begin(); id_it != ids.end(); ++id_it) { // Storage of material properties that have been DECLARED on this BoundaryID std::set<std::string> declared_props; // If boundary materials exist, populated the set of properties that were declared if (material_warehouse.hasBoundaryMaterials(*id_it)) { std::vector<Material *> mats = material_warehouse.getBoundaryMaterials(*id_it); for (std::vector<Material *>::iterator mat_it = mats.begin(); mat_it != mats.end(); ++mat_it) { const std::set<std::string> & mat_props = (*mat_it)->getSuppliedItems(); declared_props.insert(mat_props.begin(), mat_props.end()); } } // If the supplied property is not in the list of properties on the current id, return false if (declared_props.find(prop_name) == declared_props.end()) return false; } // If you get here the supplied property is defined on all boundaries return true; }
void AddExtraNodeset::modify() { // make sure the input is not empty bool data_valid = false; if (_pars.isParamValid("nodes")) if (getParam<std::vector<unsigned int> >("nodes").size() != 0) data_valid = true; if (_pars.isParamValid("coord")) { unsigned int n_coord = getParam<std::vector<Real> >("coord").size(); if (n_coord % _mesh_ptr->dimension() != 0) mooseError("Size of node coordinates does not match the mesh dimension"); if (n_coord !=0) data_valid = true; } if (!data_valid) mooseError("Node set can not be empty!"); // Get the BoundaryIDs from the mesh std::vector<BoundaryName> boundary_names = boundaryNames(); std::vector<BoundaryID> boundary_ids(boundaryIDs().begin(), boundaryIDs().end()); // Get a reference to our BoundaryInfo object BoundaryInfo & boundary_info = _mesh_ptr->getMesh().get_boundary_info(); // add nodes with their ids const std::vector<unsigned int> & nodes = getParam<std::vector<unsigned int> >("nodes"); for (unsigned int i=0; i<nodes.size(); i++) for (unsigned int j=0; j<boundary_ids.size(); ++j) boundary_info.add_node(nodes[i], boundary_ids[j]); // add nodes with their coordinates const std::vector<Real> & coord = getParam<std::vector<Real> >("coord"); unsigned int dim = _mesh_ptr->dimension(); unsigned int n_nodes = coord.size() / dim; for (unsigned int i=0; i<n_nodes; i++) { Point p; for (unsigned int j=0; j<dim; j++) p(j) = coord[i*dim+j]; const Elem* elem = _mesh_ptr->getMesh().point_locator() (p); if (!elem) mooseError("Unable to locate the following point within the domain, please check its coordinates:\n" << p); bool on_node = false; for (unsigned int j=0; j<elem->n_nodes(); j++) { const Node* node = elem->get_node(j); Point q; for (unsigned int k=0; k<dim; k++) q(k) = (*node)(k); if (p.absolute_fuzzy_equals(q, getParam<Real>("tolerance"))) { for (unsigned int j=0; j<boundary_ids.size(); ++j) boundary_info.add_node(node, boundary_ids[j]); on_node = true; break; } } if (!on_node) mooseError("Point can not be located!"); } for (unsigned int i=0; i<boundary_ids.size(); ++i) boundary_info.sideset_name(boundary_ids[i]) = boundary_names[i]; }
AuxKernel::AuxKernel(const InputParameters & parameters) : MooseObject(parameters), MooseVariableInterface<Real>(this, parameters.getCheckedPointerParam<AuxiliarySystem *>("_aux_sys") ->getVariable(parameters.get<THREAD_ID>("_tid"), parameters.get<AuxVariableName>("variable")) .isNodal()), BlockRestrictable(this), BoundaryRestrictable(this, mooseVariable()->isNodal()), SetupInterface(this), CoupleableMooseVariableDependencyIntermediateInterface(this, mooseVariable()->isNodal()), FunctionInterface(this), UserObjectInterface(this), TransientInterface(this), MaterialPropertyInterface(this, blockIDs(), boundaryIDs()), PostprocessorInterface(this), DependencyResolverInterface(), RandomInterface(parameters, *parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"), parameters.get<THREAD_ID>("_tid"), mooseVariable()->isNodal()), GeometricSearchInterface(this), Restartable(this, "AuxKernels"), MeshChangedInterface(parameters), VectorPostprocessorInterface(this), _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")), _sys(*getCheckedPointerParam<SystemBase *>("_sys")), _nl_sys(*getCheckedPointerParam<SystemBase *>("_nl_sys")), _aux_sys(*getCheckedPointerParam<AuxiliarySystem *>("_aux_sys")), _tid(parameters.get<THREAD_ID>("_tid")), _assembly(_subproblem.assembly(_tid)), _var(_aux_sys.getFieldVariable<Real>(_tid, parameters.get<AuxVariableName>("variable"))), _nodal(_var.isNodal()), _bnd(boundaryRestricted()), _mesh(_subproblem.mesh()), _q_point(_bnd ? _assembly.qPointsFace() : _assembly.qPoints()), _qrule(_bnd ? _assembly.qRuleFace() : _assembly.qRule()), _JxW(_bnd ? _assembly.JxWFace() : _assembly.JxW()), _coord(_assembly.coordTransformation()), _u(_nodal ? _var.nodalValue() : _var.sln()), _u_old(_nodal ? _var.nodalValueOld() : _var.slnOld()), _u_older(_nodal ? _var.nodalValueOlder() : _var.slnOlder()), _test(_var.phi()), _current_elem(_assembly.elem()), _current_side(_assembly.side()), _current_elem_volume(_assembly.elemVolume()), _current_side_volume(_assembly.sideElemVolume()), _current_node(_assembly.node()), _solution(_aux_sys.solution()) { addMooseVariableDependency(mooseVariable()); _supplied_vars.insert(parameters.get<AuxVariableName>("variable")); std::map<std::string, std::vector<MooseVariableFE *>> coupled_vars = getCoupledVars(); for (const auto & it : coupled_vars) for (const auto & var : it.second) _depend_vars.insert(var->name()); }
BndTestDirichletBC::BndTestDirichletBC(const InputParameters & parameters) : NodalBC(parameters), _value(getParam<Real>("value")) { // Get an test enum from the kernel parameters MooseEnum test = parameters.get<MooseEnum>("test"); // test that hasBlocks is working if (test == "hasBoundary") { // Define a SubdomainName vector for testing against std::vector<BoundaryName> id_names(1); id_names[0] = "1"; // Define a SubdomainID vector for testing against std::vector<BoundaryID> ids(1); ids[0] = 1; // Define a SubdomainID set for testing against std::set<BoundaryID> id_set(ids.begin(), ids.end()); // Test true single SudomainName input if (!hasBoundary("1")) mooseError("Test 1: hasBoundary(SubdomainName) = true failed"); // Test false of single Subdomain input if (hasBoundary("3")) mooseError("Test 2: hasBoundary(BoundaryName) = false failed"); // Test true vector BoundaryName input if (!hasBoundary(id_names)) mooseError("Test 3: hasBoundary(std::vector<BoundaryName>) = true failed"); // Test false vector SudomainName input id_names.push_back("3"); if (hasBoundary(id_names)) mooseError("Test 4: hasBoundary(std::vector<BoundaryName>) = false failed"); // Test true single BoundaryID input if (!hasBoundary(1)) mooseError("Test 5: hasBoundary(BoundaryID) = true failed"); // Test false single BoundaryID input if (hasBoundary(5)) mooseError("Test 6: hasBoundary(BoundaryID) = false failed"); // Test true for std::vector<BoundaryID> if (!hasBoundary(ids)) mooseError("Test 7: hasBoundary(std::vector<BoundaryID>) = true failed"); // Test false for std::vector<BoundaryID> ids.push_back(4); if (hasBoundary(ids)) mooseError("Test 8: hasBoundary(std::vector<BoundaryID>) = false failed"); // Test true for std::set<BoundaryID> if (!hasBoundary(id_set)) mooseError("Test 9: hasBoundary(std::set<BoundaryID) = true failed"); // Test false for std::set<BoundaryID> id_set.insert(12); if (hasBoundary(id_set)) mooseError("Test 10: hasBoundary(std::set<BoundaryID>) = false failed"); // This is the expected error, all the above tests passed mooseError("hasBoundary testing passed"); } // Test that the boundarhNames() method is working else if (test == "boundaryNames") { const std::vector<BoundaryName> & bnds = boundaryNames(); if (bnds.size() == 1 && bnds[0] == "1") mooseError("boundaryNames test passed"); // expected error else mooseError("boundaryNames test failed"); } // Test that the boundaryIDS() is working else if (test == "boundaryIDs") { const std::set<BoundaryID> & ids = boundaryIDs(); if (ids.count(1) == 1) mooseError("boundaryIDs test passed"); // expected error else mooseError("boundaryIDs test faild"); } // Test that the isBoundarySubset() is working else if (test == "isBoundarySubset") { std::set<BoundaryID> sub_id; sub_id.insert(10); sub_id.insert(1); sub_id.insert(4); sub_id.insert(2); if (isBoundarySubset(sub_id)) mooseError("isBoundarySubset test passed"); // expetect error else mooseError("isBoundarySubset test failed"); } // Test that hasMaterialPropertyBoundary is working properly else if (test == "hasBoundaryMaterialProperty_true") { if (hasBoundaryMaterialProperty<Real>("a")) mooseError("hasBoundaryMaterialProperty is true, test passed"); // expected error else mooseError("hasBoundaryMaterialProperty is false, test failed"); } else if (test == "hasBoundaryMaterialProperty_false") { if (hasBoundaryMaterialProperty<Real>("b")) mooseError("hasBoundaryMaterialProperty is true, test failed"); else mooseError("hasBoundaryMaterialProperty is false, test passed"); // expected error } }