13 #include "libmesh/elem.h"    24   params.
addClassDescription(
"Samples an image at the coordinates of each element centroid, using "    25                              "the resulting pixel color value as each element's subdomain ID");
    28   params.
addRequiredParam<MeshGeneratorName>(
"input", 
"The mesh we want to modify");
    38 std::unique_ptr<MeshBase>
    41   std::unique_ptr<MeshBase> 
mesh = std::move(
_input);
    48   for (
auto & elem : 
mesh->active_element_ptr_range())
    51     elem->subdomain_id() = id;
 virtual libMesh::Real sample(const libMesh::Point &p)
Return the pixel value for the given point. 
virtual void setupImageSampler(libMesh::MeshBase &mesh)
Perform initialization of image data. 
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103. 
registerMooseObject("MooseApp", ImageSubdomainGenerator)
static InputParameters validParams()
static InputParameters validParams()
Constructor. 
ImageSubdomainGenerator(const InputParameters ¶meters)
static InputParameters validParams()
A helper class for reading and sampling images using VTK, but with a Meshbase object. 
std::unique_ptr< MeshBase > & _input
the mesh to modify 
MeshGenerator for defining a subdomain based on image data. 
MeshGenerators are objects that can modify or add to an existing mesh. 
std::unique_ptr< MeshBase > generate() override
Generate / modify the mesh.