本文整理汇总了C++中MooseSharedPointer::get方法的典型用法代码示例。如果您正苦于以下问题:C++ MooseSharedPointer::get方法的具体用法?C++ MooseSharedPointer::get怎么用?C++ MooseSharedPointer::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MooseSharedPointer
的用法示例。
在下文中一共展示了MooseSharedPointer::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
BCWarehouse::addPresetNodalBC(BoundaryID boundary_id, MooseSharedPointer<PresetNodalBC> & bc)
{
_all_objects.push_back(bc.get());
_all_ptrs.push_back(MooseSharedNamespace::static_pointer_cast<BoundaryCondition>(bc));
_preset_nodal_bcs[boundary_id].push_back(bc.get());
}
示例2: addOutputFilename
void
OutputWarehouse::addOutput(MooseSharedPointer<Output> & output)
{
_all_ptrs.push_back(output);
// Add the object to the warehouse storage, Checkpoint placed at end so they are called last
Checkpoint * cp = dynamic_cast<Checkpoint *>(output.get());
if (cp != NULL)
_all_objects.push_back(output.get());
else
_all_objects.insert(_all_objects.begin(), output.get());
// Store the name and pointer
_object_map[output->name()] = output.get();
_object_names.insert(output->name());
// If the output object is a FileOutput then store the output filename
FileOutput * ptr = dynamic_cast<FileOutput *>(output.get());
if (ptr != NULL)
addOutputFilename(ptr->filename());
// Insert object sync times to the global set
if (output->parameters().isParamValid("sync_times"))
{
std::vector<Real> sync_times = output->parameters().get<std::vector<Real> >("sync_times");
_sync_times.insert(sync_times.begin(), sync_times.end());
}
}
示例3: addBoundaryMaterial
void MaterialWarehouse::addBoundaryMaterial(std::vector<BoundaryID> boundaries, MooseSharedPointer<Material> & material)
{
_all_ptrs.push_back(material);
_all_objects.push_back(material.get());
for (std::vector<BoundaryID>::const_iterator it = boundaries.begin(); it != boundaries.end(); ++it)
{
_boundaries.insert(*it);
_active_boundary_materials[*it].push_back(material.get());
_mat_by_name[material->name()].push_back(material.get());
}
}
示例4: addNeighborMaterial
void MaterialWarehouse::addNeighborMaterial(std::vector<SubdomainID> blocks, MooseSharedPointer<Material> & material)
{
_all_ptrs.push_back(material);
_all_objects.push_back(material.get());
for (unsigned int i=0; i<blocks.size(); ++i)
{
SubdomainID blk_id = blocks[i];
_blocks.insert(blk_id);
_active_neighbor_materials[blk_id].push_back(material.get());
_mat_by_name[material->name()].push_back(material.get());
}
}
示例5:
void
AuxiliarySystem::addKernel(const std::string & kernel_name, const std::string & name, InputParameters parameters)
{
parameters.set<AuxiliarySystem *>("_aux_sys") = this;
for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
{
parameters.set<THREAD_ID>("_tid") = tid;
MooseSharedPointer<AuxKernel> kernel = MooseSharedNamespace::static_pointer_cast<AuxKernel>(_factory.create(kernel_name, name, parameters));
// Add this AuxKernel to multiple ExecStores
const std::vector<ExecFlagType> & exec_flags = kernel->execFlags();
for (unsigned int i=0; i<exec_flags.size(); ++i)
_auxs(exec_flags[i])[tid].addAuxKernel(kernel);
_mproblem._objects_by_name[tid][name].push_back(kernel.get());
if (kernel->boundaryRestricted())
{
const std::set<BoundaryID> & boundary_ids = kernel->boundaryIDs();
for (std::set<BoundaryID>::const_iterator it = boundary_ids.begin(); it != boundary_ids.end(); ++it)
_vars[tid].addBoundaryVar(*it, &kernel->variable());
}
}
}
示例6:
void
PartitionerAction::act()
{
_mesh->setIsCustomPartitionerRequested(true);
MooseSharedPointer<MoosePartitioner> mp = _factory.create<MoosePartitioner>(_type, _name, _moose_object_pars);
_mesh->setCustomPartitioner(mp.get());
}
示例7:
void
MultiAppWarehouse::addMultiApp(MooseSharedPointer<MultiApp> multi_app)
{
_all_ptrs.push_back(multi_app);
_all_objects.push_back(multi_app.get());
MooseSharedPointer<TransientMultiApp> trans_multi_app = MooseSharedNamespace::dynamic_pointer_cast<TransientMultiApp>(multi_app);
if (trans_multi_app.get())
_transient_multi_apps.push_back(trans_multi_app.get());
}
示例8:
void
TransferWarehouse::addTransfer(MooseSharedPointer<Transfer> transfer)
{
_all_ptrs.push_back(transfer);
_all_transfers.push_back(transfer.get());
MooseSharedPointer<MultiAppTransfer> multi_app_transfer = MooseSharedNamespace::dynamic_pointer_cast<MultiAppTransfer>(transfer);
if (multi_app_transfer.get())
_multi_app_transfers.push_back(multi_app_transfer.get());
}
示例9:
MooseObjectAction *
SetupDebugAction::createOutputAction(const std::string & type, const std::string & name)
{
// Set the 'type =' parameters for the desired object
_action_params.set<std::string>("type") = type;
// Create the action
MooseSharedPointer<MooseObjectAction> action = MooseSharedNamespace::static_pointer_cast<MooseObjectAction>(_action_factory.create("AddOutputAction", name, _action_params));
// Set the object parameters
InputParameters & object_params = action->getObjectParams();
object_params.set<bool>("_built_by_moose") = true;
// Add the action to the warehouse
_awh.addActionBlock(action);
// Return the pointer to the action
return action.get();
}
示例10: mooseError
void
SetupPreconditionerAction::act()
{
if (_problem.get() != NULL)
{
// build the preconditioner
_moose_object_pars.set<FEProblem *>("_fe_problem") = _problem.get();
MooseSharedPointer<MoosePreconditioner> pc = MooseSharedNamespace::static_pointer_cast<MoosePreconditioner>(_factory.create(_type, _name, _moose_object_pars));
if (!pc.get())
mooseError("Failed to build the preconditioner.");
_problem->getNonlinearSystem().setPreconditioner(pc);
/**
* Go ahead and set common precondition options here. The child classes will still be called
* through the action warehouse
*/
Moose::PetscSupport::storePetscOptions(*_problem, _pars);
}
}
示例11: if
void
UserObjectWarehouse::addUserObject(MooseSharedPointer<UserObject> & user_object)
{
// Add the object and its name to the lists of all objects
_all_ptrs.push_back(user_object);
UserObject * raw_ptr = user_object.get();
_all_objects.push_back(raw_ptr);
_name_to_user_objects[user_object->name()] = raw_ptr;
// Add an ElementUserObject
if (dynamic_cast<ElementUserObject*>(raw_ptr))
{
// Extract the BlockIDs (see BlockRestrictable)
ElementUserObject * element_uo = dynamic_cast<ElementUserObject *>(raw_ptr);
const std::set<SubdomainID> & blks = element_uo->blockIDs();
// Add to the list of all SideUserObjects
_all_element_user_objects.push_back(element_uo);
// Loop through each of the block ids and update the various storage lists
for (std::set<SubdomainID>::const_iterator it = blks.begin(); it != blks.end(); ++it)
{
_block_element_user_objects[*it].push_back(element_uo);
_block_ids_with_user_objects.insert(*it);
}
}
// Add a SideUserObject
else if (dynamic_cast<SideUserObject *>(raw_ptr))
{
// Extract the BoundaryIDs (see BoundaryRestrictable)
SideUserObject * side_uo = dynamic_cast<SideUserObject *>(raw_ptr);
const std::set<BoundaryID> & bnds = side_uo->boundaryIDs();
// Add to the list of all SideUserObjects
_all_side_user_objects.push_back(side_uo);
// Loop through each of the block ids and update the various storage lists
for (std::set<BoundaryID>::const_iterator it = bnds.begin(); it != bnds.end(); ++it)
{
_boundary_side_user_objects[*it].push_back(side_uo);
_boundary_ids_with_user_objects.insert(*it);
}
}
// Add an InternalSideUserObject
else if (dynamic_cast<InternalSideUserObject *>(raw_ptr))
{
// Extract the BlockIDs (see BlockRestrictable)
InternalSideUserObject * element_uo = dynamic_cast<InternalSideUserObject *>(raw_ptr);
const std::set<SubdomainID> & blks = element_uo->blockIDs();
// Add to the list of all SideUserObjects
_all_internal_side_user_objects.push_back(element_uo);
// Loop through each of the block ids and update the various storage lists
for (std::set<SubdomainID>::const_iterator it = blks.begin(); it != blks.end(); ++it)
{
_block_internal_side_user_objects[*it].push_back(element_uo);
_block_ids_with_user_objects.insert(*it);
}
}
// Add a NodalUserObject
else if (dynamic_cast<NodalUserObject *>(raw_ptr))
{
// Extract the Boundary and Block Ids (see BoundaryRestrictable and BlockRestrictable)
NodalUserObject * nodal_uo = dynamic_cast<NodalUserObject *>(raw_ptr);
const std::set<BoundaryID> & bnds = nodal_uo->boundaryIDs();
const std::set<SubdomainID> & blks = nodal_uo->blockIDs();
// Update the list of all NodalUserObjects
_all_nodal_user_objects.push_back(nodal_uo);
// If the Block IDs does not contain ANY_BLOCK_ID, then the object is block restricted
if (blks.find(Moose::ANY_BLOCK_ID) == blks.end())
for (std::set<SubdomainID>::const_iterator it = blks.begin(); it != blks.end(); ++it)
{
_block_nodal_user_objects[*it].push_back(nodal_uo);
_block_ids_with_nodal_user_objects.insert(*it);
}
// Otherwise the objects is boundary restricted
else
for (std::set<BoundaryID>::const_iterator it = bnds.begin(); it != bnds.end(); ++it)
{
_boundary_nodal_user_objects[*it].push_back(nodal_uo);
_nodeset_ids_with_user_objects.insert(*it);
}
}
// Add a GeneralUserObject
else
{
GeneralUserObject * general_uo = dynamic_cast<GeneralUserObject*>(raw_ptr);
// FIXME: generic pps multithreaded
_all_generic_user_objects.push_back(general_uo);
//.........这里部分代码省略.........
示例12:
void
DamperWarehouse::addDamper(MooseSharedPointer<Damper> & damper)
{
_all_ptrs.push_back(damper);
_all_objects.push_back(damper.get());
}
示例13: if
void
ActionWarehouse::addActionBlock(MooseSharedPointer<Action> action)
{
/**
* Note: This routine uses the XTerm colors directly which is not advised for general purpose output coloring.
* Most users should prefer using Problem::colorText() which respects the "color_output" option for terminals
* that do not support coloring. Since this routine is intended for debugging only and runs before several
* objects exist in the system, we are just using the constants directly.
*/
std::string registered_identifier = action->parameters().get<std::string>("registered_identifier");
std::set<std::string> tasks;
if (_show_parser)
Moose::err << COLOR_DEFAULT << "Parsing Syntax: " << COLOR_GREEN << action->name() << '\n'
<< COLOR_DEFAULT << "Building Action: " << COLOR_DEFAULT << action->type() << '\n'
<< COLOR_DEFAULT << "Registered Identifier: " << COLOR_GREEN << registered_identifier << '\n'
<< COLOR_DEFAULT << "Specific Task: " << COLOR_CYAN << action->specificTaskName() << '\n';
/**
* We need to see if the current Action satisfies multiple tasks. There are a few cases to consider:
*
* 1. The current Action is registered with multiple syntax blocks. In this case we can only use the
* current instance to satisfy the specific task listed for this syntax block. We can detect this
* case by inspecting whether it has a "specific task name" set in the Action instance.
*
* 2. This action does not have a valid "registered identifier" set in the Action instance. This means
* that this Action was not built by the Parser. It was most likely created through a Meta-Action.
* In this case, the ActionFactory itself would have already set the task it found from the build
* info used to construct the Action.
*
* 3. The current Action is registered with only a single syntax block. In this case we can simply
* re-use the current instance to act and satisfy _all_ registered tasks. This is the normal
* case where we have a Parser-built Action that does not have a specific task name to satisfy.
* We will use the Action "type" to retrieve the list of tasks that this Action may satisfy.
*/
if (action->specificTaskName() != "") // Case 1
tasks.insert(action->specificTaskName());
else if (registered_identifier == "") // Case 2
{
std::set<std::string> local_tasks = action->getAllTasks();
mooseAssert(local_tasks.size() == 1, "More than one task inside of the " << action->name());
tasks.insert(*local_tasks.begin());
}
else // Case 3
tasks = _action_factory.getTasksByAction(action->type());
//TODO: Now we need to weed out the double registrations!
for (std::set<std::string>::iterator it = tasks.begin(); it != tasks.end(); ++it)
{
const std::string & task = *it;
// Some error checking
if (!_syntax.hasTask(task))
mooseError("A(n) " << task << " is not a registered task");
// Make sure that the ObjectAction task and Action task are consistent
// otherwise that means that is action was built by the wrong type
MooseSharedPointer<MooseObjectAction> moa = MooseSharedNamespace::dynamic_pointer_cast<MooseObjectAction>(action);
if (moa.get())
{
InputParameters mparams = moa->getObjectParams();
if (mparams.have_parameter<std::string>("_moose_base"))
{
const std::string & base = mparams.get<std::string>("_moose_base");
if (!_syntax.verifyMooseObjectTask(base, *it))
mooseError("Task " << *it << " is not registered to build " << base << " derived objects");
}
else
mooseError("Unable to locate registered base parameter for " << moa->getMooseObjectType());
}
// Add the current task to current action
action->appendTask(*it);
if (_show_parser)
Moose::err << COLOR_YELLOW << "Adding Action: " << COLOR_DEFAULT << action->type() << " (" << COLOR_YELLOW << *it << COLOR_DEFAULT << ")\n";
// Add it to the warehouse
_all_ptrs.push_back(action);
_action_blocks[*it].push_back(action.get());
}
if (_show_parser)
Moose::err << std::endl;
}
示例14: if
void
PostprocessorWarehouse::addPostprocessor(MooseSharedPointer<Postprocessor> & postprocessor)
{
_all_ptrs.push_back(postprocessor);
Postprocessor * raw_ptr = postprocessor.get();
_all_postprocessors.push_back(raw_ptr);
if (dynamic_cast<ElementPostprocessor*>(raw_ptr))
{
ElementPostprocessor * elem_pp = dynamic_cast<ElementPostprocessor*>(raw_ptr);
const std::set<SubdomainID> & block_ids = dynamic_cast<ElementPostprocessor*>(elem_pp)->blockIDs();
_all_element_postprocessors.push_back(elem_pp);
for (std::set<SubdomainID>::const_iterator it = block_ids.begin(); it != block_ids.end(); ++it)
{
_element_postprocessors[*it].push_back(elem_pp);
_block_ids_with_postprocessors.insert(*it);
}
}
else if (dynamic_cast<SidePostprocessor*>(raw_ptr))
{
SidePostprocessor * side_pp = dynamic_cast<SidePostprocessor*>(raw_ptr);
_all_side_postprocessors.push_back(side_pp);
const std::set<BoundaryID> & bnds = dynamic_cast<SidePostprocessor*>(side_pp)->boundaryIDs();
for (std::set<BoundaryID>::const_iterator it = bnds.begin(); it != bnds.end(); ++it)
{
_side_postprocessors[*it].push_back(side_pp);
_boundary_ids_with_postprocessors.insert(*it);
}
}
else if (dynamic_cast<InternalSidePostprocessor*>(raw_ptr))
{
InternalSidePostprocessor * internal_side_pp = dynamic_cast<InternalSidePostprocessor*>(raw_ptr);
_all_internal_side_postprocessors.push_back(internal_side_pp);
const std::set<SubdomainID> & blks = dynamic_cast<InternalSidePostprocessor*>(internal_side_pp)->blockIDs();
for (std::set<SubdomainID>::const_iterator it = blks.begin(); it != blks.end(); ++it)
{
_internal_side_postprocessors[*it].push_back(internal_side_pp);
_block_ids_with_postprocessors.insert(*it);
}
}
else if (dynamic_cast<NodalPostprocessor*>(raw_ptr))
{
NodalPostprocessor * nodal_pp = dynamic_cast<NodalPostprocessor*>(raw_ptr);
// NodalPostprocessors can be "block" restricted and/or "boundary" restricted
const std::set<BoundaryID> & bnds = nodal_pp->boundaryIDs();
const std::set<SubdomainID> & blks = nodal_pp->blockIDs();
// Add to the storage of all postprocessors
_all_nodal_postprocessors.push_back(nodal_pp);
// If the Block IDs are not empty, then the postprocessor is block restricted
if (blks.find(Moose::ANY_BLOCK_ID) == blks.end())
for (std::set<SubdomainID>::const_iterator it = blks.begin(); it != blks.end(); ++it)
{
_block_nodal_postprocessors[*it].push_back(nodal_pp);
_block_ids_with_nodal_postprocessors.insert(*it);
}
// Otherwise the postprocessor is a boundary postprocessor
else
for (std::set<BoundaryID>::const_iterator it = bnds.begin(); it != bnds.end(); ++it)
{
_nodal_postprocessors[*it].push_back(nodal_pp);
_nodeset_ids_with_postprocessors.insert(*it);
}
}
else if (dynamic_cast<GeneralPostprocessor*>(raw_ptr))
{
GeneralPostprocessor * general_pp = dynamic_cast<GeneralPostprocessor*>(raw_ptr);
// FIXME: generic pps multithreaded
_generic_postprocessors.push_back(general_pp);
_all_generic_postprocessors.push_back(general_pp);
}
else
mooseError("Unknown type of Postprocessor!");
}
示例15:
void
SplitWarehouse::addSplit(const std::string& name, MooseSharedPointer<Split> & split)
{
_all_objects.push_back(split.get());
_all_splits_by_name.insert(std::make_pair(name, split));
}