BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
15 #ifndef CORE_DIFFUSION_DIFFUSION_GRID_H_
16 #define CORE_DIFFUSION_DIFFUSION_GRID_H_
95 real_t mu,
int resolution = 10);
159 bool scale_with_resolution =
false);
164 bool scale_with_resolution =
false);
171 const Real3& position)
const {
209 bool normalize =
true)
const;
218 size_t GetBoxIndex(
const std::array<uint32_t, 3>& box_coord)
const;
234 size_t index,
const std::array<uint32_t, 3>& box_coord)
const;
261 std::array<size_t, 3> ret;
276 [[deprecated(
"Use GetContinuumName() instead.")]]
const std::string&
286 std::array<int32_t, 6> ret;
297 std::array<int32_t, 3> ret;
310 template <
typename F>
317 return (
mu_ == 0 &&
dc_[1] == 0 &&
dc_[2] == 0 &&
dc_[3] == 0 &&
318 dc_[4] == 0 &&
dc_[5] == 0 &&
dc_[6] == 0);
337 void PrintInfo(std::ostream& out = std::cout);
372 size_t old_resolution);
392 std::array<real_t, 7>
dc_ = {{0}};
432 #endif // CORE_DIFFUSION_DIFFUSION_GRID_H_
ParallelResizeVector< Real3 > gradients_
The array of gradients (x, y, z)
std::unique_ptr< BoundaryCondition > boundary_condition_
Object that implements the boundary conditions.
real_t GetConcentration(const Real3 &position) const
bool precompute_gradients_
const std::string & GetSubstanceName() const
void SetUpperThreshold(real_t t)
void PrintInfo(std::ostream &out=std::cout)
Print information about the Diffusion Grid.
BoundaryCondition * GetBoundaryCondition() const
Returns the boundary condition. Does not transfer ownership.
void AddInitializer(F function)
std::array< int32_t, 2 > grid_dimensions_
The grid dimensions of the diffusion grid (cubic shaped)
real_t GetBoxLength() const
real_t GetValue(const Real3 &position) const override
Get the value of the scalar field at specified position.
size_t GetBoxIndex(const std::array< uint32_t, 3 > &box_coord) const
Calculates the box index at specified box coordinates.
bool parity_
If false, grid dimensions are even; if true, they are odd.
BoundaryCondition()=default
size_t GetNumBoxes() const
bool print_info_with_initialization_
real_t lower_threshold_
The minimum concentration value that a box can have.
real_t mu_
The decay constant.
real_t GetLastTimestep() const
Return the last timestep dt that was used to run Diffuse(dt)
ParallelResizeVector< Spinlock > locks_
real_t GetBoxVolume() const
BDM_CLASS_DEF_OVERRIDE(DiffusionGrid, 1)
virtual void DiffuseWithOpenEdge(real_t dt)=0
real_t GetDecayConstant() const
ParallelResizeVector< real_t > c1_
The array of concentration values.
real_t box_volume_
the volume of each box
std::array< uint32_t, 3 > GetBoxCoordinates(const Real3 &position) const
Get the coordinates of the box at the specified position.
void SetBoundaryConditionType(BoundaryConditionType bc_type)
Sets boundary condition type.
void ParametersCheck(real_t dt)
size_t total_num_boxes_
The total number of boxes in the diffusion grid.
real_t GetUpperThreshold() const
void CopyOldData(const ParallelResizeVector< real_t > &old_c1, const ParallelResizeVector< Real3 > &old_gradients, size_t old_resolution)
std::array< int32_t, 3 > GetGridSize() const
BoundaryCondition(const TRootIOCtor *)
BoundaryConditionType
Available boundary conditions.
int GetSubstanceId() const
const std::string & GetContinuumName() const
Returns the name of the continuum.
virtual void DiffuseWithPeriodic(real_t dt)=0
virtual real_t Evaluate(real_t x, real_t y, real_t z, real_t time) const =0
Boundary condition for Neumann and Dirichlet boundary conditions.
DiffusionGrid(const TRootIOCtor *)
virtual void DiffuseWithClosedEdge(real_t dt)=0
real_t Evaluate(real_t x, real_t y, real_t z, real_t time) const final
see BoundaryCondition::Evaluate()
BoundaryConditionType GetBoundaryConditionType() const
Returns the BoundaryConditionType, see BoundaryConditionType
ConstantBoundaryCondition(real_t value)
Constructor for a constant boundary condition.
~DiffusionGrid() override=default
This class implements the boundary conditions. It is integrated into the diffusion grid as a smart po...
std::vector< std::function< real_t(real_t, real_t, real_t)> > initializers_
bool initialized_
Flag to indicate if the grid is initialized.
int GetContinuumId() const
Returns the ID of the continuum.
Continuum model for the 3D diffusion equation with exponential decay and substance depletion .
void Initialize() override
real_t GetLowerThreshold() const
void Step(real_t dt) override
std::array< size_t, 6 > GetNeighboringBoxes(size_t index) const
real_t box_length_
The side length of each box.
void PrintInfoWithInitialization()
Print the information after initialization.
std::array< size_t, 3 > GetNumBoxesArray() const
const std::array< real_t, 7 > & GetDiffusionCoefficients() const
Interface for scalar fields. See Continuum for more information.
virtual ~BoundaryCondition()=default
real_t last_dt_
The last timestep dt used for the diffusion grid update Diffuse(dt)
BDM_CLASS_DEF_OVERRIDE(ConstantBoundaryCondition, 1)
std::array< int32_t, 6 > GetDimensions() const
BoundaryConditionType bc_type_
Type of boundary conditions.
const real_t * GetAllConcentrations() const
void TurnOffGradientCalculation()
void SetDecayConstant(real_t mu)
void SetLowerThreshold(real_t t)
virtual void DiffuseWithDirichlet(real_t dt)=0
virtual void DiffuseWithNeumann(real_t dt)=0
const int32_t * GetDimensionsPtr() const
BDM_CLASS_DEF(BoundaryCondition, 1)
real_t upper_threshold_
The maximum concentration value that a box can have.
bool IsInitialized() const
Returns if the grid has been initialized.
void ChangeConcentrationBy(const Real3 &position, real_t amount, InteractionMode mode=InteractionMode::kAdditive, bool scale_with_resolution=false)
void SetBoundaryCondition(std::unique_ptr< BoundaryCondition > bc)
Set the boundary condition, takes ownership of the object.
DiffusionGrid & operator=(const DiffusionGrid &)=delete
Real3 GetGradient(const Real3 &position) const override
This class implements constant boundary conditions (Dirichlet and Neumann). The value of the boundary...
std::array< real_t, 7 > dc_
The diffusion coefficients [cc, cw, ce, cs, cn, cb, ct].
const real_t * GetAllGradients() const
ParallelResizeVector< real_t > c2_
An extra concentration data buffer for faster value updating.
size_t GetResolution() const
uint64_t num_boxes_axis_
The number of boxes at each axis [x, y, z] (same along each axis)
real_t value_
Constant value of the boundary condition for all positions and times.
bool IsFixedSubstance()
Return if a substance is stationary, e.g. (mu == 0 && dc == 0)
Continuum model for the 3D heat equation with exponential decay .