20 "The PropertyReadFile "
21 "GeneralUserObject to read element "
22 "specific property values from file");
24 "column_number",
"The column number (0-indexing) for the desired data in the CSV");
30 "Organization of data in the CSV file: "
33 "voronoi:nearest neighbor / voronoi tesselation structure "
34 "block:by mesh block");
37 params.
set<
unsigned short>(
"ghost_layers") = 1;
45 _read_prop_user_object(nullptr),
46 _column_number(getParam<unsigned
int>(
"column_number")),
48 _tid(isParamValid(
"_tid") ? getParam<
THREAD_ID>(
"_tid") : 0)
53 "The column requested in the function is likely to just be containing point coordinates");
68 paramError(
"read_type",
"The PropertyReadFile UO should have the same read_type parameter.");
72 " greater than total number of properties " +
93 const Elem *
const current_elem = assembly.
elem();
94 if (!current_elem || current_elem->subdomain_id() != current_subdomain)
102 std::set<const Elem *> candidate_elements;
103 (*_point_locator)(p, candidate_elements);
106 const Elem * min_id_elem =
nullptr;
107 for (
const auto & elem : candidate_elements)
108 if (!min_id_elem || elem->id() < min_id_elem->id())
111 mooseError(
"No element located at ", p,
" to search in element or block sorted CSV values");
112 if (candidate_elements.size() > 1)
113 mooseWarning(
"Multiple elements have been found for Point ",
115 ". Lowest ID element will be used for reading CSV data.");
127 mooseError(
"No node was found at", p,
" for retrieving nodal data from CSV.");
135 mooseError(
"This should not be reachable. Implementation error somewhere");
subdomain_id_type SubdomainID
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
registerMooseObject("MooseApp", PiecewiseConstantFromCSV)
void ErrorVector unsigned int
Keeps track of stuff related to assembling.
const Elem *const & elem() const
Return the current element.
const SubdomainID & currentSubdomainID() const
Return the current subdomain ID.
virtual MooseMesh & mesh() override
virtual Assembly & assembly(const THREAD_ID tid, const unsigned int sys_num) override
Base class for function objects.
static InputParameters validParams()
Class constructor.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
virtual std::unique_ptr< libMesh::PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default),...
Function which provides a piecewise constant, in space, field from a CSV file.
const THREAD_ID _tid
Thread id, used to query the current element/subdomain for block-sorted data.
const PropertyReadFile::ReadTypeEnum _read_type
Type of read - element, grain, or block.
const unsigned int _column_number
The column number of interest in the CSV file.
const PropertyReadFile * _read_prop_user_object
A user object that takes care of reading the CSV file.
PiecewiseConstantFromCSV(const InputParameters ¶meters)
void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
std::unique_ptr< libMesh::PointLocatorBase > _point_locator
The point locator is used when values are sorted by elements or blocks in the CSV.
virtual Real value(Real t, const Point &pt) const override
Get the value of the function based on the data in the CSV file.
static InputParameters validParams()
Read properties from file - grain, element, node or block Input file syntax: prop1 prop2 etc.
Real getData(const Elem *const elem, const unsigned int prop_num) const
This function retrieves property data for elements.
unsigned int getNumProperties() const
Returns the number of properties (columns) read in the file.
ReadTypeEnum getReadType() const
Returns the ordering of data expected in the CSV file.
Real getVoronoiData(const Point &point, const unsigned int prop_num) const
This function retrieves properties for elements from a file with nearest neighbor / grain based prope...
Real getNodeData(const Node *const node, const unsigned int prop_num) const
This function retrieves properties for nodes, from a file that has node-based data.
Real getBlockData(const Elem *const elem, const unsigned int prop_num) const
This function retrieves properties for elements, from a file that has block-based data.
FEProblemBase & _ti_feproblem