www.mooseframework.org
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ImageSubdomain Class Reference

MeshModifier for defining a Subdomains based on Image data. More...

#include <ImageSubdomain.h>

Inheritance diagram for ImageSubdomain:
[legend]

Public Member Functions

 ImageSubdomain (const InputParameters &parameters)
 Class constructor. More...
 
void modifyMesh (MooseMesh *mesh, MooseMesh *displaced_mesh)
 The base method called to trigger modification to the Mesh. More...
 
std::vector< std::string > & getDependencies ()
 Return the MeshModifiers that must run before this MeshModifier. More...
 
const std::string & name () const
 Get the name of the object. More...
 
const InputParametersparameters () const
 Get the parameters of the object. More...
 
template<typename T >
const T & getParam (const std::string &name) const
 Retrieve a parameter for the object. More...
 
bool isParamValid (const std::string &name) const
 Test if the supplied parameter is valid. More...
 
MooseAppgetMooseApp ()
 Get the MooseApp this object is associated with. More...
 
virtual bool enabled ()
 Return the enabled status of the object. More...
 
template<typename... Args>
void mooseError (Args &&...args) const
 
template<typename... Args>
void mooseWarning (Args &&...args) const
 
template<typename... Args>
void mooseDeprecated (Args &&...args) const
 
template<typename... Args>
void mooseInfo (Args &&...args) const
 
virtual Real sample (const Point &p)
 Return the pixel value for the given point. More...
 
virtual void setupImageSampler (MooseMesh &mesh)
 Perform initialization of image data. More...
 
std::string fileSuffix ()
 
const std::vector< std::string > & filenames ()
 

Public Attributes

const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 

Protected Member Functions

virtual void modify () override
 Pure virtual modify function MUST be overridden by children classes. More...
 
virtual void initialize ()
 This method is called immediatly before modify to perform any necessary initialization on the modififer before it runs. More...
 
void modifyMeshHelper (MooseMesh *mesh)
 Utility for performing the same operation on both undiplaced and displaced meshes. More...
 
template<typename T >
T & declareRestartableData (std::string data_name)
 Declare a piece of data as "restartable". More...
 
template<typename T >
T & declareRestartableData (std::string data_name, const T &init_value)
 Declare a piece of data as "restartable" and initialize it. More...
 
template<typename T >
T & declareRestartableDataWithContext (std::string data_name, void *context)
 Declare a piece of data as "restartable". More...
 
template<typename T >
T & declareRestartableDataWithContext (std::string data_name, const T &init_value, void *context)
 Declare a piece of data as "restartable" and initialize it. More...
 
void vtkShiftAndScale ()
 Apply image re-scaling using the vtkImageShiftAndRescale object. More...
 
void vtkThreshold ()
 Perform thresholding. More...
 
void vtkMagnitude ()
 Convert the image to greyscale. More...
 
void vtkFlip ()
 Perform image flipping. More...
 
void errorCheck ()
 

Protected Attributes

MooseMesh_mesh_ptr
 Pointer to the mesh. More...
 
MooseApp_app
 The MooseApp this object is associated with. More...
 
const InputParameters_pars
 Parameters of this object, references the InputParameters stored in the InputParametersWarehouse. More...
 
const std::string & _name
 The name of this object, reference to value stored in InputParameters. More...
 
const bool & _enabled
 Reference to the "enable" InputParaemters, used by Controls for toggling on/off MooseObjects. More...
 
int _status
 
std::string _file_suffix
 
std::vector< std::string > _filenames
 

Detailed Description

MeshModifier for defining a Subdomains based on Image data.

Definition at line 31 of file ImageSubdomain.h.

Constructor & Destructor Documentation

ImageSubdomain::ImageSubdomain ( const InputParameters parameters)

Class constructor.

Parameters
parametersThe input parameters

Definition at line 33 of file ImageSubdomain.C.

34  : MeshModifier(parameters), ImageSampler(parameters)
35 {
36 }
ImageSampler(const InputParameters &parameters)
Constructor.
Definition: ImageSampler.C:62
MeshModifier(const InputParameters &parameters)
Constructor.
Definition: MeshModifier.C:37

Member Function Documentation

template<typename T >
T & Restartable::declareRestartableData ( std::string  data_name)
protectedinherited

Declare a piece of data as "restartable".

This means that in the event of a restart this piece of data will be restored back to its previous value.

NOTE: This returns a reference! Make sure you store it in a reference!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)

Definition at line 224 of file Restartable.h.

225 {
226  return declareRestartableDataWithContext<T>(data_name, NULL);
227 }
template<typename T >
T & Restartable::declareRestartableData ( std::string  data_name,
const T &  init_value 
)
protectedinherited

Declare a piece of data as "restartable" and initialize it.

This means that in the event of a restart this piece of data will be restored back to its previous value.

NOTE: This returns a reference! Make sure you store it in a reference!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)
init_valueThe initial value of the data

Definition at line 231 of file Restartable.h.

232 {
233  return declareRestartableDataWithContext<T>(data_name, init_value, NULL);
234 }
template<typename T >
T & Restartable::declareRestartableDataWithContext ( std::string  data_name,
void *  context 
)
protectedinherited

Declare a piece of data as "restartable".

This means that in the event of a restart this piece of data will be restored back to its previous value.

NOTE: This returns a reference! Make sure you store it in a reference!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)
contextContext pointer that will be passed to the load and store functions

Definition at line 238 of file Restartable.h.

239 {
241  mooseError("No valid SubProblem found for ", _restartable_system_name, "/", _restartable_name);
242 
243  std::string full_name = _restartable_system_name + "/" + _restartable_name + "/" + data_name;
244  RestartableData<T> * data_ptr = new RestartableData<T>(full_name, context);
245 
247 
248  return data_ptr->get();
249 }
std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:202
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string _restartable_name
The name of the object.
Definition: Restartable.h:196
void registerRestartableDataOnSubProblem(std::string name, RestartableDataValue *data, THREAD_ID tid)
Helper function so we don&#39;t have to include SubProblem in the header.
Definition: Restartable.C:49
Concrete definition of a parameter value for a specified type.
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208
THREAD_ID _restartable_tid
The thread ID for this object.
Definition: Restartable.h:205
template<typename T >
T & Restartable::declareRestartableDataWithContext ( std::string  data_name,
const T &  init_value,
void *  context 
)
protectedinherited

Declare a piece of data as "restartable" and initialize it.

This means that in the event of a restart this piece of data will be restored back to its previous value.

NOTE: This returns a reference! Make sure you store it in a reference!

Parameters
data_nameThe name of the data (usually just use the same name as the member variable)
init_valueThe initial value of the data
contextContext pointer that will be passed to the load and store functions

Definition at line 253 of file Restartable.h.

256 {
258  mooseError("No valid SubProblem found for ", _restartable_system_name, "/", _restartable_name);
259 
260  std::string full_name = _restartable_system_name + "/" + _restartable_name + "/" + data_name;
261  RestartableData<T> * data_ptr = new RestartableData<T>(full_name, context);
262 
263  data_ptr->set() = init_value;
264 
266 
267  return data_ptr->get();
268 }
std::string _restartable_system_name
The system name this object is in.
Definition: Restartable.h:202
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
std::string _restartable_name
The name of the object.
Definition: Restartable.h:196
void registerRestartableDataOnSubProblem(std::string name, RestartableDataValue *data, THREAD_ID tid)
Helper function so we don&#39;t have to include SubProblem in the header.
Definition: Restartable.C:49
Concrete definition of a parameter value for a specified type.
SubProblem * _restartable_subproblem
Pointer to the SubProblem class.
Definition: Restartable.h:208
THREAD_ID _restartable_tid
The thread ID for this object.
Definition: Restartable.h:205
virtual bool MooseObject::enabled ( )
inlinevirtualinherited

Return the enabled status of the object.

Reimplemented in EigenKernel.

Definition at line 77 of file MooseObject.h.

Referenced by EigenKernel::enabled().

77 { return _enabled; }
const bool & _enabled
Reference to the "enable" InputParaemters, used by Controls for toggling on/off MooseObjects.
Definition: MooseObject.h:117
void FileRangeBuilder::errorCheck ( )
protectedinherited

Definition at line 156 of file FileRangeBuilder.C.

Referenced by FileRangeBuilder::filenames(), and ImageMesh::ImageMesh().

157 {
158  switch (_status)
159  {
160  case 0:
161  return;
162  case 1:
163  mooseError("Cannot provide both file and file_base parameters");
164  break;
165  case 2:
166  mooseError("You must provide a valid value for either the 'file' parameter or the "
167  "'file_base' parameter.");
168  break;
169  case 3:
170  mooseError(
171  "If you provide a 'file_base', you must also provide a valid 'file_suffix', e.g. 'png'.");
172  break;
173  default:
174  mooseError("Unknown error code!");
175  }
176 }
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
const std::vector<std::string>& FileRangeBuilder::filenames ( )
inlineinherited

Definition at line 44 of file FileRangeBuilder.h.

Referenced by ImageSampler::setupImageSampler().

44 { return _filenames; }
std::vector< std::string > _filenames
std::string FileRangeBuilder::fileSuffix ( )
inlineinherited

Definition at line 43 of file FileRangeBuilder.h.

Referenced by ImageSampler::setupImageSampler().

43 { return _file_suffix; }
std::string _file_suffix
std::vector<std::string>& MeshModifier::getDependencies ( )
inlineinherited

Return the MeshModifiers that must run before this MeshModifier.

Definition at line 52 of file MeshModifier.h.

52 { return _depends_on; }
std::vector< std::string > _depends_on
A list of modifiers that are required to run before this modifier may run.
Definition: MeshModifier.h:78
MooseApp& MooseObject::getMooseApp ( )
inlineinherited

Get the MooseApp this object is associated with.

Definition at line 72 of file MooseObject.h.

Referenced by RestartableDataIO::createBackup(), RestartableDataIO::deserializeRestartableData(), Resurrector::restartRestartableData(), and RestartableDataIO::restoreBackup().

72 { return _app; }
MooseApp & _app
The MooseApp this object is associated with.
Definition: MooseObject.h:108
template<typename T >
const T & MooseObject::getParam ( const std::string &  name) const
inherited

Retrieve a parameter for the object.

Parameters
nameThe name of the parameter
Returns
The value of the parameter

Definition at line 122 of file MooseObject.h.

Referenced by FEProblemBase::addMaterial(), ConstraintWarehouse::addObject(), BicubicSplineFunction::BicubicSplineFunction(), Piecewise::buildFromXandY(), EigenKernel::EigenKernel(), FieldSplitPreconditioner::FieldSplitPreconditioner(), FiniteDifferencePreconditioner::FiniteDifferencePreconditioner(), GenericConstantRankTwoTensor::GenericConstantRankTwoTensor(), TimeSequenceStepper::init(), BlockRestrictable::initializeBlockRestrictable(), BoundaryRestrictable::initializeBoundaryRestrictable(), Console::initialSetup(), AdvancedOutput::initialSetup(), SideSetsBetweenSubdomains::modify(), MeshExtruder::modify(), AddExtraNodeset::modify(), SideSetsAroundSubdomain::modify(), RenameBlock::modify(), MooseObject::parameters(), ParsedAddSideset::ParsedAddSideset(), ParsedAux::ParsedAux(), ParsedODEKernel::ParsedODEKernel(), ParsedSubdomainMeshModifier::ParsedSubdomainMeshModifier(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), SingleMatrixPreconditioner::SingleMatrixPreconditioner(), TimePeriod::TimePeriod(), and VectorOfPostprocessors::VectorOfPostprocessors().

123 {
124  return InputParameters::getParamHelper(name, _pars, static_cast<T *>(0));
125 }
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:47
static const T & getParamHelper(const std::string &name, const InputParameters &pars, const T *the_type)
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
Definition: MooseObject.h:111
virtual void MeshModifier::initialize ( )
inlineprotectedvirtualinherited

This method is called immediatly before modify to perform any necessary initialization on the modififer before it runs.

Definition at line 59 of file MeshModifier.h.

Referenced by MeshModifier::modifyMesh().

59 {}
bool MooseObject::isParamValid ( const std::string &  name) const
inlineinherited

Test if the supplied parameter is valid.

Parameters
nameThe name of the parameter to test

Definition at line 67 of file MooseObject.h.

Referenced by BicubicSplineFunction::BicubicSplineFunction(), Piecewise::buildFromFile(), Piecewise::buildFromXandY(), GeneratedMesh::buildMesh(), LibmeshPartitioner::clone(), OversampleOutput::cloneMesh(), CSVReader::CSVReader(), MultiAppNearestNodeTransfer::execute(), FileOutput::FileOutput(), MultiApp::fillPositions(), MultiAppNearestNodeTransfer::getLocalNodes(), MultiAppNearestNodeTransfer::getNearestNode(), IterationAdaptiveDT::init(), EigenExecutionerBase::init(), MooseMesh::init(), AdvancedOutput::initExecutionTypes(), BlockRestrictable::initializeBlockRestrictable(), BoundaryRestrictable::initializeBoundaryRestrictable(), SolutionAux::initialSetup(), MooseParsedVectorFunction::initialSetup(), Console::initialSetup(), Receiver::initialSetup(), SolutionFunction::initialSetup(), MooseParsedGradFunction::initialSetup(), MooseParsedFunction::initialSetup(), AdvancedOutput::initialSetup(), AdvancedOutput::initPostprocessorOrVectorPostprocessorLists(), IterationAdaptiveDT::IterationAdaptiveDT(), LeastSquaresFit::LeastSquaresFit(), LibmeshPartitioner::LibmeshPartitioner(), BreakBoundaryOnSubdomain::modify(), MeshExtruder::modify(), MeshSideSet::modify(), AssignElementSubdomainID::modify(), ParsedSubdomainMeshModifier::modify(), RenameBlock::modify(), SubdomainBoundingBox::modify(), EigenExecutionerBase::normalizeSolution(), Output::Output(), Exodus::outputSetup(), PetscOutput::PetscOutput(), Piecewise::Piecewise(), SolutionUserObject::readExodusII(), RenameBlock::RenameBlock(), Piecewise::setData(), SolutionUserObject::SolutionUserObject(), and TimePeriod::TimePeriod().

67 { return _pars.isParamValid(name); }
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:47
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
const InputParameters & _pars
Parameters of this object, references the InputParameters stored in the InputParametersWarehouse.
Definition: MooseObject.h:111
void ImageSubdomain::modify ( )
overrideprotectedvirtual

Pure virtual modify function MUST be overridden by children classes.

This is where the MeshModifier actually does it's work.

Implements MeshModifier.

Definition at line 39 of file ImageSubdomain.C.

40 {
41  // Check that we have access to the mesh
42  if (!_mesh_ptr)
43  mooseError("_mesh_ptr must be initialized before calling SubdomainBoundingBox::modify()");
44 
45  // Initialize the ImageSampler
47 
48  // Reference the the libMesh::MeshBase
49  MeshBase & mesh = _mesh_ptr->getMesh();
50 
51  // Loop over the elements and sample the image at the element centroid and use the value for the
52  // subdomain id
53  for (auto & elem : mesh.active_element_ptr_range())
54  {
55  SubdomainID id = static_cast<SubdomainID>(round(sample(elem->centroid())));
56  elem->subdomain_id() = id;
57  }
58 }
subdomain_id_type SubdomainID
Definition: MooseTypes.h:77
virtual void setupImageSampler(MooseMesh &mesh)
Perform initialization of image data.
Definition: ImageSampler.C:80
MooseMesh * _mesh_ptr
Pointer to the mesh.
Definition: MeshModifier.h:74
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2355
virtual Real sample(const Point &p)
Return the pixel value for the given point.
Definition: ImageSampler.C:219
void mooseError(Args &&...args) const
Definition: MooseObject.h:80
void MeshModifier::modifyMesh ( MooseMesh mesh,
MooseMesh displaced_mesh 
)
inherited

The base method called to trigger modification to the Mesh.

This method can trigger (re-)initialiation of the Mesh if necessary, modify the mesh through the virtual override, and also force prepare the mesh if requested.

Definition at line 47 of file MeshModifier.C.

48 {
49  // Initialize or reinitialize any mesh related structures.
50  initialize();
51 
52  modifyMeshHelper(mesh);
53 
54  // Now do the same thing for the displaced mesh if it exists
55  if (displaced_mesh)
56  modifyMeshHelper(displaced_mesh);
57 }
virtual void initialize()
This method is called immediatly before modify to perform any necessary initialization on the modifif...
Definition: MeshModifier.h:59
void modifyMeshHelper(MooseMesh *mesh)
Utility for performing the same operation on both undiplaced and displaced meshes.
Definition: MeshModifier.C:60
void MeshModifier::modifyMeshHelper ( MooseMesh mesh)
protectedinherited

Utility for performing the same operation on both undiplaced and displaced meshes.

Definition at line 60 of file MeshModifier.C.

Referenced by MeshModifier::initialize(), and MeshModifier::modifyMesh().

61 {
62  // Set pointer to the mesh so that derived classes may use them
63  _mesh_ptr = mesh;
64 
65  // Modify the mesh!
66  modify();
67 
68  // Prepare the mesh if requested
69  if (_force_prepare)
70  mesh->prepare();
71 }
virtual void modify()=0
Pure virtual modify function MUST be overridden by children classes.
const bool _force_prepare
Flag to determine if the mesh should be prepared after this modifier is run.
Definition: MeshModifier.h:81
MooseMesh * _mesh_ptr
Pointer to the mesh.
Definition: MeshModifier.h:74
void prepare(bool force=false)
Calls prepare_for_use() if force=true on the underlying Mesh object, then communicates various bounda...
Definition: MooseMesh.C:311
template<typename... Args>
void MooseObject::mooseDeprecated ( Args &&...  args) const
inlineinherited
template<typename... Args>
void MooseObject::mooseError ( Args &&...  args) const
inlineinherited

Definition at line 80 of file MooseObject.h.

Referenced by FEProblemBase::addInitialCondition(), DiracKernel::addPointWithValidId(), FEProblemBase::addPostprocessor(), MooseMesh::addQuadratureNode(), FEProblemBase::addVectorPostprocessor(), Output::advancedExecuteOn(), AnnularMesh::AnnularMesh(), MultiApp::appPostprocessorValue(), MultiApp::appProblem(), MultiApp::appProblemBase(), MultiApp::appUserObjectBase(), Function::average(), Axisymmetric2D3DSolutionFunction::Axisymmetric2D3DSolutionFunction(), BicubicSplineFunction::BicubicSplineFunction(), BoundingValueElementDamper::BoundingValueElementDamper(), BoundingValueNodalDamper::BoundingValueNodalDamper(), BoundsAux::BoundsAux(), MooseMesh::buildCoarseningMap(), Piecewise::buildFromFile(), Piecewise::buildFromXandY(), Piecewise::buildFromXY(), TiledMesh::buildMesh(), GeneratedMesh::buildMesh(), ImageMesh::buildMesh3D(), MooseMesh::buildRefinementMap(), EigenExecutionerBase::chebyshev(), FEProblemBase::checkCoordinateSystems(), FEProblemBase::checkDependMaterialsHelper(), FEProblemBase::checkDisplacementOrders(), Material::checkExecutionStage(), Steady::checkIntegrity(), EigenExecutionerBase::checkIntegrity(), SubProblem::checkMatProps(), FEProblemBase::checkProblemIntegrity(), Material::checkStatefulSanity(), FEProblemBase::checkUserObjects(), LibmeshPartitioner::clone(), CompositeFunction::CompositeFunction(), ElementLpNormAux::compute(), ElementH1ErrorFunctionAux::compute(), TimeSequenceStepperBase::computeFailedDT(), IterationAdaptiveDT::computeFailedDT(), TimeStepper::computeFailedDT(), FEProblemBase::computeResidual(), Material::computeSubdomainProperties(), PenetrationAux::computeValue(), TimeStepper::constrainStep(), AuxKernel::coupledDot(), AuxKernel::coupledDotDu(), DebugResidualAux::DebugResidualAux(), BicubicSplineFunction::derivative(), DGKernel::DGKernel(), SolutionUserObject::discontinuousPointValue(), SolutionUserObject::discontinuousPointValueGradient(), FEProblemBase::duplicateVariableCheck(), EigenProblem::EigenProblem(), Eigenvalues::Eigenvalues(), ElementalVariableValue::ElementalVariableValue(), MooseMesh::errorIfDistributedMesh(), SolutionUserObject::evalMeshFunction(), SolutionUserObject::evalMeshFunctionGradient(), SolutionUserObject::evalMultiValuedMeshFunction(), SolutionUserObject::evalMultiValuedMeshFunctionGradient(), PerflogDumper::execute(), NodalValueSampler::execute(), MultiAppPostprocessorTransfer::execute(), DiscreteElementUserObject::execute(), MultiAppPostprocessorInterpolationTransfer::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), MultiAppNearestNodeTransfer::execute(), PointValue::execute(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), MultiAppVariableValueSampleTransfer::execute(), FindValueOnLine::execute(), MultiAppInterpolationTransfer::execute(), TimeExtremeValue::execute(), LeastSquaresFit::execute(), FEProblemBase::executeControls(), FileOutput::FileOutput(), MultiApp::fillPositions(), VerifyElementUniqueID::finalize(), VerifyNodalUniqueID::finalize(), DiscreteElementUserObject::finalize(), MemoryUsage::finalize(), PointSamplerBase::finalize(), Transfer::find_sys(), FiniteDifferencePreconditioner::FiniteDifferencePreconditioner(), FunctionDT::FunctionDT(), FunctionScalarAux::FunctionScalarAux(), FunctionScalarIC::FunctionScalarIC(), GapValueAux::GapValueAux(), GeneratedMesh::GeneratedMesh(), GenericConstantMaterial::GenericConstantMaterial(), GenericFunctionMaterial::GenericFunctionMaterial(), MooseMesh::getBoundaryID(), MultiApp::getBoundingBox(), MooseMesh::getCoarseningMap(), FEProblemBase::getCoordSystem(), PiecewiseConstant::getDirection(), FEProblemBase::getDistribution(), MultiApp::getExecutioner(), FEProblemBase::getFunction(), SolutionUserObject::getLocalVarIndex(), AuxKernel::getMaterialProperty(), AuxKernel::getMaterialPropertyOld(), AuxKernel::getMaterialPropertyOlder(), GeneratedMesh::getMaxInDimension(), AnnularMesh::getMaxInDimension(), FEProblemBase::getMaxQps(), FEProblemBase::getMaxShapeFunctions(), GeneratedMesh::getMinInDimension(), AnnularMesh::getMinInDimension(), MooseMesh::getMortarInterface(), MooseMesh::getMortarInterfaceByName(), MooseMesh::getNodeBlockIds(), MooseMesh::getNodeList(), FEProblemBase::getNonlinearSystem(), MooseMesh::getPairedBoundaryMapping(), ImageMesh::GetPixelInfo(), MaterialStdVectorAux::getRealValue(), MooseMesh::getRefinementMap(), FEProblemBase::getSampler(), DisplacedProblem::getScalarVariable(), FEProblemBase::getScalarVariable(), MooseMesh::getSubdomainBoundaryIds(), MooseMesh::getSubdomainID(), DisplacedProblem::getSystem(), FEProblemBase::getSystem(), FEProblemBase::getUserObjectBase(), NumVars::getValue(), PerformanceData::getValue(), Residual::getValue(), FindValueOnLine::getValueAtPoint(), DisplacedProblem::getVariable(), FEProblemBase::getVariable(), MultiApp::globalAppToLocal(), MooseParsedVectorFunction::gradient(), AdvancedOutput::hasOutputHelper(), CSVTimeSequenceStepper::init(), IterationAdaptiveDT::init(), EigenExecutionerBase::init(), MooseMesh::init(), FEProblemBase::init(), NumPicardIterations::initialize(), FullSolveMultiApp::initialSetup(), SolutionAux::initialSetup(), Axisymmetric2D3DSolutionFunction::initialSetup(), Exodus::initialSetup(), SolutionFunction::initialSetup(), SolutionUserObject::initialSetup(), FEProblemBase::initialSetup(), AdvancedOutput::initOutputList(), AdvancedOutput::initShowHideLists(), Material::initStatefulProperties(), Function::integral(), IntegratedBC::IntegratedBC(), InterfaceKernel::InterfaceKernel(), EigenExecutionerBase::inversePowerIteration(), InversePowerMethod::InversePowerMethod(), IterationAdaptiveDT::IterationAdaptiveDT(), KernelBase::KernelBase(), LeastSquaresFit::LeastSquaresFit(), LibmeshPartitioner::LibmeshPartitioner(), LinearCombinationFunction::LinearCombinationFunction(), LinearCombinationPostprocessor::LinearCombinationPostprocessor(), LinearNodalConstraint::LinearNodalConstraint(), LineMaterialSamplerBase< T >::LineMaterialSamplerBase(), MaterialRealTensorValueAux::MaterialRealTensorValueAux(), MaterialRealVectorValueAux::MaterialRealVectorValueAux(), MaterialStdVectorRealGradientAux::MaterialStdVectorRealGradientAux(), MaterialVectorPostprocessor::MaterialVectorPostprocessor(), SubProblem::meshChanged(), MeshExtruder::MeshExtruder(), SideSetsFromPoints::modify(), SideSetsFromNormals::modify(), AddExtraNodeset::modify(), MeshExtruder::modify(), AssignElementSubdomainID::modify(), AddAllSideSetsByNormals::modify(), ElementDeleterBase::modify(), ParsedSubdomainMeshModifier::modify(), RenameBlock::modify(), modify(), BoundingBoxNodeSet::modify(), OrientedSubdomainBoundingBox::modify(), AddSideSetsFromBoundingBox::modify(), SubdomainBoundingBox::modify(), MultiAppMeshFunctionTransfer::MultiAppMeshFunctionTransfer(), MultiAppPostprocessorTransfer::MultiAppPostprocessorTransfer(), NearestNodeDistanceAux::NearestNodeDistanceAux(), NearestNodeValueAux::NearestNodeValueAux(), NodalBC::NodalBC(), NodalConstraint::NodalConstraint(), NodalEqualValueConstraint::NodalEqualValueConstraint(), NodalKernel::NodalKernel(), NodalVariableValue::NodalVariableValue(), NumDOFs::NumDOFs(), NumNonlinearIterations::NumNonlinearIterations(), XDA::output(), VTKOutput::output(), AdvancedOutput::outputElementalVariables(), AdvancedOutput::outputInput(), AdvancedOutput::outputNodalVariables(), AdvancedOutput::outputPostprocessors(), AdvancedOutput::outputScalarVariables(), AdvancedOutput::outputSystemInformation(), Console::outputVectorPostprocessors(), AdvancedOutput::outputVectorPostprocessors(), PiecewiseBilinear::parse(), ParsedAddSideset::ParsedAddSideset(), ParsedAux::ParsedAux(), ParsedODEKernel::ParsedODEKernel(), ParsedSubdomainMeshModifier::ParsedSubdomainMeshModifier(), PatternedMesh::PatternedMesh(), PhysicsBasedPreconditioner::PhysicsBasedPreconditioner(), Piecewise::Piecewise(), PiecewiseBilinear::PiecewiseBilinear(), PiecewiseLinearInterpolationMaterial::PiecewiseLinearInterpolationMaterial(), PiecewiseMultilinear::PiecewiseMultilinear(), SolutionUserObject::pointValueGradientWrapper(), SolutionUserObject::pointValueWrapper(), LStableDirk2::postStep(), LStableDirk3::postStep(), ImplicitMidpoint::postStep(), ExplicitTVDRK2::postStep(), AStableDirk4::postStep(), LStableDirk4::postStep(), ExplicitRK2::postStep(), Predictor::Predictor(), SolutionUserObject::readExodusII(), SolutionUserObject::readXda(), RelativeSolutionDifferenceNorm::RelativeSolutionDifferenceNorm(), RenameBlock::RenameBlock(), ScalarComponentIC::ScalarComponentIC(), BicubicSplineFunction::secondDerivative(), FEProblemBase::setCoordSystem(), Piecewise::setData(), EigenProblem::setEigenproblemType(), Sampler::setNumberOfRequiedRandomSeeds(), Split::setup(), TransientMultiApp::setupApp(), TimeSequenceStepperBase::setupSequence(), Transient::setupTimeIntegrator(), SideSetsFromNormals::SideSetsFromNormals(), SideSetsFromPoints::SideSetsFromPoints(), SolutionUserObject::SolutionUserObject(), FullSolveMultiApp::solveStep(), UserObject::spatialValue(), SphericalAverage::SphericalAverage(), StitchedMesh::StitchedMesh(), NodalUserObject::subdomainSetup(), GeneralUserObject::subdomainSetup(), Constraint::subdomainSetup(), Console::systemInfoFlags(), Terminator::Terminator(), TestSetupPostprocessorDataActionFunction::TestSetupPostprocessorDataActionFunction(), DiscreteElementUserObject::threadJoin(), GeneralUserObject::threadJoin(), Function::timeDerivative(), TimeExtremeValue::TimeExtremeValue(), TimePeriod::TimePeriod(), MultiAppCopyTransfer::transfer(), MultiAppMeshFunctionTransfer::transferVariable(), Transient::Transient(), TransientMultiApp::TransientMultiApp(), EqualValueBoundaryConstraint::updateConstrainedNodes(), SolutionUserObject::updateExodusBracketingTimeIndices(), Axisymmetric2D3DSolutionFunction::value(), ValueRangeMarker::ValueRangeMarker(), ValueThresholdMarker::ValueThresholdMarker(), MultiAppTransfer::variableIntegrityCheck(), VariableResidual::VariableResidual(), VariableTimeIntegrationAux::VariableTimeIntegrationAux(), VectorOfPostprocessors::VectorOfPostprocessors(), VectorPostprocessorFunction::VectorPostprocessorFunction(), MooseParsedGradFunction::vectorValue(), MooseParsedFunction::vectorValue(), and VolumeHistogram::VolumeHistogram().

81  {
82  std::ostringstream oss;
83  moose::internal::mooseStreamAll(oss, std::forward<Args>(args)...);
84  std::string msg = oss.str();
85  callMooseErrorRaw(msg, &_app);
86  }
void mooseStreamAll(std::ostringstream &ss)
Definition: MooseError.C:78
void callMooseErrorRaw(std::string &msg, MooseApp *app)
Definition: MooseObject.C:45
MooseApp & _app
The MooseApp this object is associated with.
Definition: MooseObject.h:108
template<typename... Args>
void MooseObject::mooseInfo ( Args &&...  args) const
inlineinherited

Definition at line 101 of file MooseObject.h.

102  {
103  moose::internal::mooseInfoStream(_console, std::forward<Args>(args)...);
104  }
void mooseInfoStream(S &oss, Args &&...args)
Definition: MooseError.h:145
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
template<typename... Args>
void MooseObject::mooseWarning ( Args &&...  args) const
inlineinherited
const std::string& MooseObject::name ( ) const
inlineinherited

Get the name of the object.

Returns
The name of the object

Definition at line 47 of file MooseObject.h.

Referenced by FEProblemBase::addDistribution(), FEProblemBase::addFunction(), FEProblemBase::addIndicator(), FEProblemBase::addInitialCondition(), FEProblemBase::addMarker(), FEProblemBase::addMaterial(), MooseMesh::addMortarInterface(), FEProblemBase::addMultiApp(), FEProblemBase::addPredictor(), FEProblemBase::addSampler(), FEProblemBase::addTransfer(), FEProblemBase::addUserObject(), Output::advancedExecuteOn(), MultiApp::appPostprocessorValue(), MultiApp::appProblem(), MultiApp::appProblemBase(), MultiApp::appUserObjectBase(), AStableDirk4::AStableDirk4(), Function::average(), FEProblemBase::checkDependMaterialsHelper(), Damper::checkMinDamping(), Material::checkStatefulSanity(), CompositeFunction::CompositeFunction(), Material::computeSubdomainProperties(), AuxKernel::coupledCallback(), AuxKernel::coupledDot(), AuxKernel::coupledDotDu(), MultiApp::createApp(), DGKernel::DGKernel(), AB2PredictorCorrector::estimateTimeError(), SolutionUserObject::evalMeshFunction(), SolutionUserObject::evalMeshFunctionGradient(), SolutionUserObject::evalMultiValuedMeshFunction(), SolutionUserObject::evalMultiValuedMeshFunctionGradient(), MultiAppPostprocessorTransfer::execute(), MultiAppPostprocessorInterpolationTransfer::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), MultiAppNearestNodeTransfer::execute(), PointValue::execute(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), MultiAppVariableValueSampleTransfer::execute(), MultiAppMeshFunctionTransfer::execute(), MultiAppInterpolationTransfer::execute(), MultiAppUserObjectTransfer::execute(), MultiAppProjectionTransfer::execute(), MultiAppCopyTransfer::execute(), FileOutput::FileOutput(), MultiApp::fillPositions(), PointSamplerBase::finalize(), GeneralUserObject::GeneralUserObject(), MultiApp::getBoundingBox(), Control::getControllableParameterHelper(), Control::getControllableValue(), AuxKernel::getDependObjects(), MultiApp::getExecutioner(), OutputWarehouse::getFileNumbers(), SolutionUserObject::getLocalVarIndex(), AuxKernel::getMaterialProperty(), SubProblem::getMaterialPropertyBlockNames(), SubProblem::getMaterialPropertyBoundaryNames(), AuxKernel::getMaterialPropertyOld(), AuxKernel::getMaterialPropertyOlder(), OutputWarehouse::getOutput(), Transient::getTimeStepperName(), InitialCondition::getUserObject(), AuxKernel::getUserObject(), InitialCondition::getUserObjectByName(), AuxKernel::getUserObjectByName(), AdvancedOutput::hasOutputHelper(), FEProblemBase::init(), CSVReader::initialize(), MultiAppProjectionTransfer::initialSetup(), InitialCondition::initialSetup(), SolutionUserObject::initialSetup(), AdvancedOutput::initOutputList(), AdvancedOutput::initPostprocessorOrVectorPostprocessorLists(), Material::initStatefulProperties(), Function::integral(), IntegratedBC::IntegratedBC(), InterfaceKernel::InterfaceKernel(), KernelBase::KernelBase(), LinearCombinationFunction::LinearCombinationFunction(), Marker::Marker(), MaterialDerivativeTestKernelBase< T >::MaterialDerivativeTestKernelBase(), MaterialVectorPostprocessor::MaterialVectorPostprocessor(), ElementDeleterBase::modify(), NodalBC::NodalBC(), NodalEqualValueConstraint::NodalEqualValueConstraint(), NodalKernel::NodalKernel(), NodalValueSampler::NodalValueSampler(), NodalVariableValue::NodalVariableValue(), DOFMapOutput::output(), AdvancedOutput::outputElementalVariables(), AdvancedOutput::outputInput(), AdvancedOutput::outputNodalVariables(), ConsoleUtils::outputOutputInformation(), Nemesis::outputPostprocessors(), Exodus::outputPostprocessors(), AdvancedOutput::outputPostprocessors(), AdvancedOutput::outputScalarVariables(), AdvancedOutput::outputSystemInformation(), AdvancedOutput::outputVectorPostprocessors(), MooseObject::parameters(), Executioner::parentOutputPositionChanged(), ParsedAddSideset::ParsedAddSideset(), ParsedAux::ParsedAux(), ParsedODEKernel::ParsedODEKernel(), ParsedSubdomainMeshModifier::ParsedSubdomainMeshModifier(), PointSamplerBase::PointSamplerBase(), SubProblem::registerRecoverableData(), SubProblem::registerRestartableData(), Material::resetQpProperties(), Sampler::Sampler(), ScalarComponentIC::ScalarComponentIC(), MooseMesh::setBoundaryName(), Control::setControllableValue(), OutputWarehouse::setFileNumbers(), MooseMesh::setSubdomainName(), Split::setup(), TransientMultiApp::setupApp(), SideValueSampler::SideValueSampler(), TransientMultiApp::solveStep(), UserObject::spatialValue(), SphericalAverage::SphericalAverage(), StitchedMesh::StitchedMesh(), Function::timeDerivative(), TransientMultiApp::TransientMultiApp(), MultiAppTransfer::variableIntegrityCheck(), VariableResidual::VariableResidual(), and AdvancedOutput::wantOutput().

47 { return _name; }
const std::string & _name
The name of this object, reference to value stored in InputParameters.
Definition: MooseObject.h:114
const InputParameters& MooseObject::parameters ( ) const
inlineinherited
Real ImageSampler::sample ( const Point &  p)
virtualinherited

Return the pixel value for the given point.

Parameters
pThe point at which to extract pixel data

Definition at line 219 of file ImageSampler.C.

Referenced by modify(), and ImageFunction::value().

220 {
221 #ifdef LIBMESH_HAVE_VTK
222 
223  // Do nothing if the point is outside of the image domain
224  if (!_bounding_box.contains_point(p))
225  return 0.0;
226 
227  // Determine pixel coordinates
228  std::vector<int> x(3, 0);
229  for (int i = 0; i < LIBMESH_DIM; ++i)
230  {
231  // Compute position, only if voxel size is greater than zero
232  if (_voxel[i] == 0)
233  x[i] = 0;
234 
235  else
236  {
237  x[i] = std::floor((p(i) - _origin(i)) / _voxel[i]);
238 
239  // If the point falls on the mesh extents the index needs to be decreased by one
240  if (x[i] == _dims[i])
241  x[i]--;
242  }
243  }
244 
245  // Return the image data at the given point
246  return _data->GetScalarComponentAsDouble(x[0], x[1], x[2], _component);
247 
248 #else
249  libmesh_ignore(p); // avoid un-used parameter warnings
250  return 0.0;
251 #endif
252 }
unsigned int _component
Component to extract.
Definition: ImageSampler.h:157
static PetscErrorCode Vec x
BoundingBox _bounding_box
Bounding box for testing points.
Definition: ImageSampler.h:161
vtkImageData * _data
Complete image data.
Definition: ImageSampler.h:113
std::vector< double > _voxel
Physical pixel size.
Definition: ImageSampler.h:153
Point _origin
Origin of image.
Definition: ImageSampler.h:144
std::vector< int > _dims
Pixel dimension of image.
Definition: ImageSampler.h:147
void ImageSampler::setupImageSampler ( MooseMesh mesh)
virtualinherited

Perform initialization of image data.

Definition at line 80 of file ImageSampler.C.

Referenced by ImageFunction::initialSetup(), and modify().

81 {
82  // Don't warn that mesh or _is_pars are unused when VTK is not enabled.
83  libmesh_ignore(mesh);
84  libmesh_ignore(_is_pars);
85 
86 #ifdef LIBMESH_HAVE_VTK
87  // Get access to the Mesh object
88  BoundingBox bbox = MeshTools::create_bounding_box(mesh.getMesh());
89 
90  // Set the dimensions from the Mesh if not set by the User
91  if (_is_pars.isParamValid("dimensions"))
92  _physical_dims = _is_pars.get<Point>("dimensions");
93 
94  else
95  {
96  _physical_dims(0) = bbox.max()(0) - bbox.min()(0);
97 #if LIBMESH_DIM > 1
98  _physical_dims(1) = bbox.max()(1) - bbox.min()(1);
99 #endif
100 #if LIBMESH_DIM > 2
101  _physical_dims(2) = bbox.max()(2) - bbox.min()(2);
102 #endif
103  }
104 
105  // Set the origin from the Mesh if not set in the input file
106  if (_is_pars.isParamValid("origin"))
107  _origin = _is_pars.get<Point>("origin");
108  else
109  {
110  _origin(0) = bbox.min()(0);
111 #if LIBMESH_DIM > 1
112  _origin(1) = bbox.min()(1);
113 #endif
114 #if LIBMESH_DIM > 2
115  _origin(2) = bbox.min()(2);
116 #endif
117  }
118 
119  // An array of filenames, to be filled in
120  std::vector<std::string> filenames;
121 
122  // The file suffix, to be determined
123  std::string file_suffix;
124 
125  // Try to parse our own file range parameters. If that fails, then
126  // see if the associated Mesh is an ImageMesh and use its. If that
127  // also fails, then we have to throw an error...
128  //
129  // The parseFileRange method sets parameters, thus a writable reference to the InputParameters
130  // object must be obtained from the warehouse. Generally, this should be avoided, but
131  // this is a special case.
132  if (_status != 0)
133  {
134  // We don't have parameters, so see if we can get them from ImageMesh
135  ImageMesh * image_mesh = dynamic_cast<ImageMesh *>(&mesh);
136  if (!image_mesh)
137  mooseError("No file range parameters were provided and the Mesh is not an ImageMesh.");
138 
139  // Get the ImageMesh's parameters. This should work, otherwise
140  // errors would already have been thrown...
141  filenames = image_mesh->filenames();
142  file_suffix = image_mesh->fileSuffix();
143  }
144  else
145  {
146  // Use our own parameters (using 'this' b/c of conflicts with filenames the local variable)
147  filenames = this->filenames();
148  file_suffix = fileSuffix();
149  }
150 
151  // Storage for the file names
152  _files = vtkSmartPointer<vtkStringArray>::New();
153 
154  for (const auto & filename : filenames)
155  _files->InsertNextValue(filename);
156 
157  // Error if no files where located
158  if (_files->GetNumberOfValues() == 0)
159  mooseError("No image file(s) located");
160 
161  // Read the image stack. Hurray for VTK not using polymorphism in a
162  // smart way... we actually have to explicitly create the type of
163  // reader based on the file extension, using an if-statement...
164  if (file_suffix == "png")
165  _image = vtkSmartPointer<vtkPNGReader>::New();
166  else if (file_suffix == "tiff" || file_suffix == "tif")
167  _image = vtkSmartPointer<vtkTIFFReader>::New();
168  else
169  mooseError("Un-supported file type '", file_suffix, "'");
170 
171  // Now that _image is set up, actually read the images
172  // Indicate that data read has started
173  _is_console << "Reading image(s)..." << std::endl;
174 
175  // Extract the data
176  _image->SetFileNames(_files);
177  _image->Update();
178  _data = _image->GetOutput();
179  _algorithm = _image->GetOutputPort();
180 
181  // Set the image dimensions and voxel size member variable
182  int * dims = _data->GetDimensions();
183  for (unsigned int i = 0; i < 3; ++i)
184  {
185  _dims.push_back(dims[i]);
186  _voxel.push_back(_physical_dims(i) / _dims[i]);
187  }
188 
189  // Set the dimensions of the image and bounding box
190  _data->SetSpacing(_voxel[0], _voxel[1], _voxel[2]);
191  _data->SetOrigin(_origin(0), _origin(1), _origin(2));
192  _bounding_box.min() = _origin;
194 
195  // Indicate data read is completed
196  _is_console << " ...image read finished" << std::endl;
197 
198  // Set the component parameter
199  // If the parameter is not set then vtkMagnitude() will applied
200  if (_is_pars.isParamValid("component"))
201  {
202  unsigned int n = _data->GetNumberOfScalarComponents();
203  _component = _is_pars.get<unsigned int>("component");
204  if (_component >= n)
205  mooseError("'component' parameter must be empty or have a value of 0 to ", n - 1);
206  }
207  else
208  _component = 0;
209 
210  // Apply filters, the toggling on and off of each filter is handled internally
211  vtkMagnitude();
213  vtkThreshold();
214  vtkFlip();
215 #endif
216 }
unsigned int _component
Component to extract.
Definition: ImageSampler.h:157
vtkAlgorithmOutput * _algorithm
VTK-6 seems to work better in terms of "algorithm outputs" rather than vtkImageData pointers...
Definition: ImageSampler.h:116
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
const std::vector< std::string > & filenames()
vtkSmartPointer< vtkImageReader2 > _image
Complete image data.
Definition: ImageSampler.h:119
ConsoleStream _is_console
Create a console stream object for this helper class.
Definition: ImageSampler.h:167
BoundingBox _bounding_box
Bounding box for testing points.
Definition: ImageSampler.h:161
vtkImageData * _data
Complete image data.
Definition: ImageSampler.h:113
std::vector< double > _voxel
Physical pixel size.
Definition: ImageSampler.h:153
std::string fileSuffix()
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2355
void vtkShiftAndScale()
Apply image re-scaling using the vtkImageShiftAndRescale object.
Definition: ImageSampler.C:274
Point _origin
Origin of image.
Definition: ImageSampler.h:144
const InputParameters & _is_pars
Parameters for interface.
Definition: ImageSampler.h:164
void vtkThreshold()
Perform thresholding.
Definition: ImageSampler.C:301
vtkSmartPointer< vtkStringArray > _files
List of file names to extract data.
Definition: ImageSampler.h:110
Point _physical_dims
Physical dimensions of image.
Definition: ImageSampler.h:150
std::vector< int > _dims
Pixel dimension of image.
Definition: ImageSampler.h:147
void vtkFlip()
Perform image flipping.
Definition: ImageSampler.C:337
PetscInt n
void vtkMagnitude()
Convert the image to greyscale.
Definition: ImageSampler.C:255
A 2D GeneratedMesh where xmin, xmax, etc.
Definition: ImageMesh.h:29
void ImageSampler::vtkFlip ( )
protectedinherited

Perform image flipping.

Flip the image along the x, y, and/or z axis. If multiple flips occur, they happen in order.

Definition at line 337 of file ImageSampler.C.

Referenced by ImageSampler::setupImageSampler().

338 {
339 #ifdef LIBMESH_HAVE_VTK
340  // Convert boolean values into an integer array, then loop over it
341  int mask[3] = {
342  _is_pars.get<bool>("flip_x"), _is_pars.get<bool>("flip_y"), _is_pars.get<bool>("flip_z")};
343 
344  for (int dim = 0; dim < 3; ++dim)
345  {
346  if (mask[dim])
347  {
348  _flip_filter = imageFlip(dim);
349 
350  // Update pointers
351  _data = _flip_filter->GetOutput();
352  _algorithm = _flip_filter->GetOutputPort();
353  }
354  }
355 #endif
356 }
vtkAlgorithmOutput * _algorithm
VTK-6 seems to work better in terms of "algorithm outputs" rather than vtkImageData pointers...
Definition: ImageSampler.h:116
vtkSmartPointer< vtkImageFlip > _flip_filter
Pointers to image flipping filter. May be used for x, y, or z.
Definition: ImageSampler.h:131
vtkImageData * _data
Complete image data.
Definition: ImageSampler.h:113
const InputParameters & _is_pars
Parameters for interface.
Definition: ImageSampler.h:164
vtkSmartPointer< vtkImageFlip > imageFlip(const int &axis)
Helper method for flipping image.
Definition: ImageSampler.C:360
void ImageSampler::vtkMagnitude ( )
protectedinherited

Convert the image to greyscale.

By leaving the 'component' input parameter empty, this is called automatically.

Definition at line 255 of file ImageSampler.C.

Referenced by ImageSampler::setupImageSampler().

256 {
257 #ifdef LIBMESH_HAVE_VTK
258  // Do nothing if 'component' is set
259  if (_is_pars.isParamValid("component"))
260  return;
261 
262  // Apply the greyscale filtering
263  _magnitude_filter = vtkSmartPointer<vtkImageMagnitude>::New();
264  _magnitude_filter->SetInputConnection(_algorithm);
265  _magnitude_filter->Update();
266 
267  // Update the pointers
268  _data = _magnitude_filter->GetOutput();
269  _algorithm = _magnitude_filter->GetOutputPort();
270 #endif
271 }
vtkAlgorithmOutput * _algorithm
VTK-6 seems to work better in terms of "algorithm outputs" rather than vtkImageData pointers...
Definition: ImageSampler.h:116
vtkImageData * _data
Complete image data.
Definition: ImageSampler.h:113
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
vtkSmartPointer< vtkImageMagnitude > _magnitude_filter
Pointer to the magnitude filter.
Definition: ImageSampler.h:128
const InputParameters & _is_pars
Parameters for interface.
Definition: ImageSampler.h:164
void ImageSampler::vtkShiftAndScale ( )
protectedinherited

Apply image re-scaling using the vtkImageShiftAndRescale object.

Definition at line 274 of file ImageSampler.C.

Referenced by ImageSampler::setupImageSampler().

275 {
276 #ifdef LIBMESH_HAVE_VTK
277  // Capture the parameters
278  double shift = _is_pars.get<double>("shift");
279  double scale = _is_pars.get<double>("scale");
280 
281  // Do nothing if shift and scale are not set
282  if (shift == 0 && scale == 1)
283  return;
284 
285  // Perform the scaling and offset actions
286  _shift_scale_filter = vtkSmartPointer<vtkImageShiftScale>::New();
287  _shift_scale_filter->SetOutputScalarTypeToDouble();
288 
289  _shift_scale_filter->SetInputConnection(_algorithm);
290  _shift_scale_filter->SetShift(shift);
291  _shift_scale_filter->SetScale(scale);
292  _shift_scale_filter->Update();
293 
294  // Update the pointers
295  _data = _shift_scale_filter->GetOutput();
296  _algorithm = _shift_scale_filter->GetOutputPort();
297 #endif
298 }
vtkAlgorithmOutput * _algorithm
VTK-6 seems to work better in terms of "algorithm outputs" rather than vtkImageData pointers...
Definition: ImageSampler.h:116
vtkImageData * _data
Complete image data.
Definition: ImageSampler.h:113
vtkSmartPointer< vtkImageShiftScale > _shift_scale_filter
Pointer to the shift and scaling filter.
Definition: ImageSampler.h:125
const InputParameters & _is_pars
Parameters for interface.
Definition: ImageSampler.h:164
void ImageSampler::vtkThreshold ( )
protectedinherited

Perform thresholding.

Definition at line 301 of file ImageSampler.C.

Referenced by ImageSampler::setupImageSampler().

302 {
303 #ifdef LIBMESH_HAVE_VTK
304  // Do nothing if threshold not set
305  if (!_is_pars.isParamValid("threshold"))
306  return;
307 
308  // Error if both upper and lower are not set
309  if (!_is_pars.isParamValid("upper_value") || !_is_pars.isParamValid("lower_value"))
310  mooseError("When thresholding is applied, both the upper_value and lower_value parameters must "
311  "be set");
312 
313  // Create the thresholding object
314  _image_threshold = vtkSmartPointer<vtkImageThreshold>::New();
315 
316  // Set the data source
317  _image_threshold->SetInputConnection(_algorithm);
318 
319  // Setup the thresholding options
320  _image_threshold->ThresholdByUpper(_is_pars.get<Real>("threshold"));
321  _image_threshold->ReplaceInOn();
322  _image_threshold->SetInValue(_is_pars.get<Real>("upper_value"));
323  _image_threshold->ReplaceOutOn();
324  _image_threshold->SetOutValue(_is_pars.get<Real>("lower_value"));
325  _image_threshold->SetOutputScalarTypeToDouble();
326 
327  // Perform the thresholding
328  _image_threshold->Update();
329 
330  // Update the pointers
331  _data = _image_threshold->GetOutput();
332  _algorithm = _image_threshold->GetOutputPort();
333 #endif
334 }
vtkAlgorithmOutput * _algorithm
VTK-6 seems to work better in terms of "algorithm outputs" rather than vtkImageData pointers...
Definition: ImageSampler.h:116
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182
vtkImageData * _data
Complete image data.
Definition: ImageSampler.h:113
bool isParamValid(const std::string &name) const
This method returns parameters that have been initialized in one fashion or another, i.e.
const InputParameters & _is_pars
Parameters for interface.
Definition: ImageSampler.h:164
vtkSmartPointer< vtkImageThreshold > _image_threshold
Pointer to thresholding filter.
Definition: ImageSampler.h:122

Member Data Documentation

MooseApp& MooseObject::_app
protectedinherited

The MooseApp this object is associated with.

Definition at line 108 of file MooseObject.h.

Referenced by AB2PredictorCorrector::AB2PredictorCorrector(), Executioner::addAttributeReporter(), FEProblemBase::addMaterial(), FEProblemBase::addMultiApp(), FEProblemBase::allowOutput(), AStableDirk4::AStableDirk4(), FileMesh::buildMesh(), FEProblemBase::checkNonlinearConvergence(), OversampleOutput::cloneMesh(), FEProblemBase::computeJacobian(), FEProblemBase::computeResidualType(), Console::Console(), TimeStepper::constrainStep(), MultiApp::createApp(), EigenExecutionerBase::EigenExecutionerBase(), EigenKernel::EigenKernel(), InversePowerMethod::execute(), NonlinearEigen::execute(), Transient::execute(), Steady::execute(), FileOutput::FileOutput(), FEProblemBase::forceOutput(), MooseObject::getMooseApp(), InversePowerMethod::init(), NonlinearEigen::init(), Transient::init(), Steady::init(), MooseMesh::init(), NumPicardIterations::initialize(), TimePeriod::initialSetup(), Console::initialSetup(), MultiApp::initialSetup(), FEProblemBase::initialSetup(), AdvancedOutput::initOutputList(), FEProblemBase::initPetscOutput(), AdvancedOutput::initPostprocessorOrVectorPostprocessorLists(), InversePowerMethod::InversePowerMethod(), MooseObject::mooseError(), MooseMesh::MooseMesh(), NonlinearEigen::NonlinearEigen(), Tecplot::output(), Exodus::output(), Nemesis::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Exodus::outputEmptyTimestep(), Console::outputInput(), Exodus::outputInput(), Exodus::outputNodalVariables(), OversampleOutput::outputStep(), Output::outputStep(), FEProblemBase::outputStep(), Console::outputSystemInformation(), MultiApp::parentOutputPositionChanged(), PerformanceData::PerformanceData(), PetscOutput::petscLinearOutput(), PetscOutput::petscNonlinearOutput(), SubProblem::registerRecoverableData(), SubProblem::registerRestartableData(), FEProblemBase::setRestartFile(), TransientMultiApp::setupApp(), TimeSequenceStepperBase::setupSequence(), Transient::setupTimeIntegrator(), TransientMultiApp::solveStep(), FEProblemBase::subdomainSetup(), TimeExtremeValue::TimeExtremeValue(), TimePeriod::TimePeriod(), FEProblemBase::timestepSetup(), Transient::Transient(), and Console::write().

const ConsoleStream ConsoleStreamInterface::_console
inherited

An instance of helper class to write streams to the Console objects.

Definition at line 37 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), CreateProblemAction::act(), SetupRecoverFileBaseAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), FEProblemBase::advanceMultiApps(), SimplePredictor::apply(), FEProblemBase::backupMultiApps(), FEProblemBase::checkProblemIntegrity(), IterationAdaptiveDT::computeAdaptiveDT(), Transient::computeConstrainedDT(), NonlinearSystemBase::computeDamping(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInterpolationDT(), FEProblemBase::computeResidualType(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), AB2PredictorCorrector::converged(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MultiAppPostprocessorTransfer::execute(), MultiAppPostprocessorInterpolationTransfer::execute(), MultiAppVariableValueSamplePostprocessorTransfer::execute(), MultiAppNearestNodeTransfer::execute(), MultiAppPostprocessorToAuxScalarTransfer::execute(), MultiAppScalarToAuxScalarTransfer::execute(), MultiAppVariableValueSampleTransfer::execute(), MultiAppUserObjectTransfer::execute(), MultiAppInterpolationTransfer::execute(), MultiAppMeshFunctionTransfer::execute(), MultiAppProjectionTransfer::execute(), MultiAppCopyTransfer::execute(), Steady::execute(), MultiAppDTKUserObjectTransfer::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), MultiApp::globalAppToLocal(), InversePowerMethod::init(), NonlinearEigen::init(), Steady::init(), FEProblemBase::initialAdaptMesh(), FEProblemBase::initialSetup(), EigenExecutionerBase::inversePowerIteration(), Transient::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseObject::mooseDeprecated(), MooseObject::mooseInfo(), MooseObject::mooseWarning(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), ActionWarehouse::printActionDependencySets(), EigenExecutionerBase::printEigenvalue(), MaterialPropertyDebugOutput::printMaterialMap(), SolutionTimeAdaptiveDT::rejectStep(), DT2::rejectStep(), FEProblemBase::restoreMultiApps(), SimplePredictor::shouldApply(), NonlinearSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), Transient::solveStep(), DT2::step(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), FEProblemBase::useFECache(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

const bool& MooseObject::_enabled
protectedinherited

Reference to the "enable" InputParaemters, used by Controls for toggling on/off MooseObjects.

Definition at line 117 of file MooseObject.h.

Referenced by MooseObject::enabled().

std::string FileRangeBuilder::_file_suffix
protectedinherited
std::vector<std::string> FileRangeBuilder::_filenames
protectedinherited
MooseMesh* MeshModifier::_mesh_ptr
protectedinherited
const std::string& MooseObject::_name
protectedinherited
const InputParameters& MooseObject::_pars
protectedinherited
int FileRangeBuilder::_status
protectedinherited

The documentation for this class was generated from the following files: