16#include "arcane/utils/NotImplementedException.h"
17#include "arcane/utils/TraceInfo.h"
18#include "arcane/utils/NumericTypes.h"
20#include "arcane/MeshVariableScalarRef.h"
21#include "arcane/ArcaneException.h"
23#include "arcane/core/materials/IMeshMaterialMng.h"
24#include "arcane/core/materials/IMeshMaterial.h"
25#include "arcane/core/materials/MaterialVariableBuildInfo.h"
45template <
typename DataType> CellEnvironmentVariableScalarRef<DataType>::
58: m_private_part(rhs.m_private_part)
64 m_private_part->incrementReference();
75template <
typename DataType>
void
80 this->_setContainerView();
81 _internalInit(m_private_part->toMeshMaterialVariable());
88template <
typename DataType>
void
90refersTo(
const CellEnvironmentVariableScalarRef<DataType>& rhs)
92 if (rhs.m_private_part == m_private_part)
97 m_private_part = rhs.m_private_part;
99 m_container_value = {};
104 m_private_part->incrementReference();
111template <
typename DataType>
void
121template <
typename DataType> DataType
129 return this->operator[](ienvcell);
140template <
typename DataType>
void
142fill(
const DataType& value)
154template <
typename DataType>
void
158 m_private_part->fillPartialValues(value);
171 GlobalVariableRefType* rt = m_private_part->globalVariableReference();
184 GlobalVariableRefType* rt = m_private_part->globalVariableReference();
193template <
typename DataType>
void
197 if (m_private_part) {
198 m_container_value = m_private_part->_internalFullValuesView();
199 m_value = m_container_value.data();
202 m_container_value = {};
238: m_private_part(rhs.m_private_part)
244 m_private_part->incrementReference();
253template <
typename DataType>
void
257 if (m_private_part) {
259 _internalInit(m_private_part->toMeshMaterialVariable());
267template <
typename DataType>
void
269refersTo(
const CellEnvironmentVariableArrayRef<DataType>& rhs)
271 if (rhs.m_private_part == m_private_part)
276 m_private_part = rhs.m_private_part;
278 m_container_value = {};
283 m_private_part->incrementReference();
291template <
typename DataType>
void
305 GlobalVariableRefType* rt = m_private_part->globalVariableReference();
318 GlobalVariableRefType* rt = m_private_part->globalVariableReference();
327template <
typename DataType>
void
331 m_private_part->resize(dim2_size);
337template <
typename DataType>
void
341 if (m_private_part) {
342 m_container_value = m_private_part->_internalFullValuesView();
343 m_value = m_container_value.data();
346 m_container_value = {};
357#define ARCANE_INSTANTIATE_MAT(type) \
358 template class ARCANE_TEMPLATE_EXPORT CellEnvironmentVariableScalarRef<type>; \
359 template class ARCANE_TEMPLATE_EXPORT CellEnvironmentVariableArrayRef<type>
361ARCANE_INSTANTIATE_MAT(
Byte);
362ARCANE_INSTANTIATE_MAT(
Int8);
363ARCANE_INSTANTIATE_MAT(
Int16);
364ARCANE_INSTANTIATE_MAT(
Int32);
365ARCANE_INSTANTIATE_MAT(
Int64);
366ARCANE_INSTANTIATE_MAT(BFloat16);
367ARCANE_INSTANTIATE_MAT(
Float16);
368ARCANE_INSTANTIATE_MAT(
Float32);
369ARCANE_INSTANTIATE_MAT(
Real);
370ARCANE_INSTANTIATE_MAT(Real2);
371ARCANE_INSTANTIATE_MAT(Real3);
372ARCANE_INSTANTIATE_MAT(Real2x2);
373ARCANE_INSTANTIATE_MAT(Real3x3);
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Arcane cell with material and environment information.
Array variable on the cells of a mesh material. For now, this class is only instantiated for cells.
GlobalVariableRefType & globalVariable()
Global variable associated with this material variable.
virtual void refersTo(const ThatClass &rhs)
Positions the instance reference to the variable rhs.
CellEnvironmentVariableArrayRef()=delete
Default constructor (deleted).
void resize(Integer dim2_size)
Resizes the number of elements in the array.
Scalar variable on the cells of a mesh environment.
DataType envValue(AllEnvCell c, Int32 env_id) const
Value of the variable for the environment index env_id of cell or 0 if absent from the cell.
void fillPartialValues(const DataType &value)
Fills the partial values of the variable with the value value.
GlobalVariableRefType & globalVariable()
Global variable associated with this material variable.
virtual void refersTo(const ThatClass &rhs)
Positions the instance reference to the variable rhs.
CellEnvironmentVariableScalarRef()=delete
Default constructor (deleted).
void fill(const DataType &value)
Fills the partial and global values of the variable with the value value.
Arcane cell of an environment.
__host__ __device__ Int32 environmentId() const
Environment identifier.
void unregisterVariable()
Unregisters the variable (internal).
Array variable on a mesh entity type.
Scalar variable on a mesh entity type.
Always enables tracing in Arcane parts concerning materials.
MatVarSpace
Definition space for a material variable.
@ Environment
Variable having values only on environments.
std::int8_t Int8
Signed integer type of 8 bits.
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
@ Float16
Float16 data type.
std::int16_t Int16
Signed integer type of 16 bits.
double Real
Type representing a real number.
unsigned char Byte
Type of a byte.
float Float32
IEEE-753 single-precision floating-point type.
std::int32_t Int32
Signed integer type of 32 bits.