18 #include <type_traits>
64 template<
unsigned int TCheckIndex>
67 return IsDimensionDynamicImpl<TCheckIndex, 0>();
75 template<
class TIndexType =
unsigned int>
88 template<
class TIndexType =
unsigned int>
103 template<
class TIndexType =
unsigned int>
106 TIndexType* pShapeBegin,
107 TIndexType* pShapeEnd)
110 <<
"Invalid dimensions given to fill for primitive data type [ Expected dimension == 0, provided shape = "
111 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
125 template<
class TIndexType =
unsigned int>
128 const std::vector<TIndexType>& rShape)
130 return Reshape(rValue, rShape.data(), rShape.data() + rShape.size());
144 template<
class TIndexType =
unsigned int>
147 TIndexType
const * pShapeBegin,
148 TIndexType
const * pShapeEnd)
151 <<
"Invalid shape/dimension given for primitive data type [ Expected shape = [], provided shape = "
152 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
194 *pContiguousDataBegin = rValue;
212 rValue = *pContiguousDataBegin;
221 template<
unsigned int TCheckIndex,
unsigned int TCurrentIndex = 0>
222 static constexpr
bool IsDimensionDynamicImpl()
224 if constexpr(TCheckIndex == 0) {
227 static_assert(TCheckIndex != TCheckIndex,
"Invalid dimension index.");
261 static constexpr
bool IsDynamic = ValueTraits::IsDynamic;
267 static constexpr
unsigned int Dimension = ValueTraits::Dimension + 1;
283 template<
unsigned int TCheckIndex>
286 return IsDimensionDynamicImpl<TCheckIndex, 0>();
298 template<
class TIndexType =
unsigned int>
301 if constexpr(TSize == 0) {
304 return TSize * ValueTraits::template Size<TIndexType>(rContainer[0]);
317 template<
class TIndexType =
unsigned int>
320 std::vector<TIndexType> shape(
Dimension);
334 template<
class TIndexType =
unsigned int>
337 TIndexType* pShapeBegin,
338 TIndexType* pShapeEnd)
341 <<
"Invalid dimensions given to fill for primitive data type [ Expected dimension >= 1, provided shape = "
342 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
344 if constexpr(TSize > 0) {
345 ValueTraits::Shape(rContainer[0], pShapeBegin + 1, pShapeEnd);
347 ValueTraits::Shape(
ValueType{}, pShapeBegin + 1, pShapeEnd);
349 pShapeBegin[0] = TSize;
368 template<
class TIndexType =
unsigned int>
371 const std::vector<TIndexType>& rShape)
373 return Reshape(rContainer, rShape.
data(), rShape.data() + rShape.size());
393 template<
class TIndexType =
unsigned int>
396 TIndexType
const * pShapeBegin,
397 TIndexType
const * pShapeEnd)
399 KRATOS_ERROR_IF_NOT(std::distance(pShapeBegin, pShapeEnd) >= 1 && *pShapeBegin ==
static_cast<TIndexType
>(TSize))
400 <<
"Invalid shape/dimension given for array_1d data type [ Expected shape = " <<
Shape(rContainer) <<
", provided shape = "
401 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
403 bool is_reshaped =
false;
405 if constexpr(ValueTraits::IsDynamic) {
406 std::for_each(rContainer.
begin(), rContainer.
end(), [&is_reshaped, pShapeBegin, pShapeEnd](
auto& rValue) {
407 is_reshaped = ValueTraits::Reshape(rValue, pShapeBegin + 1, pShapeEnd) || is_reshaped;
427 if constexpr(std::is_same_v<PrimitiveType, ValueType>) {
428 return rValue.
data().data();
433 if constexpr(TSize > 0) {
442 static_assert(!std::is_same_v<TDataType, TDataType>,
"This should be only called if the rValue is contiguous only.");
459 if constexpr(std::is_same_v<PrimitiveType, ValueType>) {
460 return rValue.
data().data();
465 if constexpr(TSize > 0) {
474 static_assert(!std::is_same_v<TDataType, TDataType>,
"This should be only called if the rValue is contiguous only.");
495 for (
unsigned int i = 0;
i < TSize; ++
i) {
496 ValueTraits::CopyToContiguousData(pContiguousDataBegin +
i * stride, rContainer[
i]);
517 for (
unsigned int i = 0;
i < TSize; ++
i) {
518 ValueTraits::CopyFromContiguousData(rContainer[
i], pContiguousDataBegin +
i * stride);
528 template<
unsigned int TCheckIndex,
unsigned int TCurrentIndex>
529 static constexpr
bool IsDimensionDynamicImpl()
531 if constexpr(TCheckIndex == TCurrentIndex) {
534 return ValueTraits::template IsDimensionDynamicImpl<TCheckIndex, TCurrentIndex + 1>();
573 static constexpr
unsigned int Dimension = ValueTraits::Dimension + 1;
589 template<
unsigned int TCheckIndex>
592 return IsDimensionDynamicImpl<TCheckIndex, 0>();
604 template<
class TIndexType =
unsigned int>
607 return (rValue.empty() ? 0 : rValue.size() * ValueTraits::template Size<TIndexType>(rValue[0]));
619 template<
class TIndexType =
unsigned int>
622 std::vector<TIndexType> shape(
Dimension);
636 template<
class TIndexType =
unsigned int>
639 TIndexType* pShapeBegin,
640 TIndexType* pShapeEnd)
643 <<
"Invalid dimensions given to fill for primitive data type [ Expected dimension >= 1, provided shape = "
644 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
646 if (rContainer.empty()) {
647 ValueTraits::Shape(
ValueType{}, pShapeBegin + 1, pShapeEnd);
649 ValueTraits::Shape(rContainer[0], pShapeBegin + 1, pShapeEnd);
651 pShapeBegin[0] = rContainer.size();
670 template<
class TIndexType =
unsigned int>
673 const std::vector<TIndexType>& rShape)
675 return Reshape(rContainer, rShape.data(), rShape.data() + rShape.size());
695 template<
class TIndexType =
unsigned int>
698 TIndexType
const * pShapeBegin,
699 TIndexType
const * pShapeEnd)
702 <<
"Invalid shape/dimension given for DenseVector data type [ Expected = " <<
Shape(rContainer) <<
", provided = "
703 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
705 bool is_reshaped =
false;
707 if (rContainer.size() != *pShapeBegin) {
708 rContainer.
resize(*pShapeBegin,
false);
712 if constexpr(ValueTraits::IsDynamic) {
713 std::for_each(rContainer.
begin(), rContainer.
end(), [&is_reshaped, pShapeBegin, pShapeEnd](
auto& rValue) {
714 is_reshaped = ValueTraits::Reshape(rValue, pShapeBegin + 1, pShapeEnd) || is_reshaped;
734 if constexpr(std::is_same_v<PrimitiveType, ValueType>) {
735 return rValue.data().
begin();
740 if (rValue.size() > 0) {
749 static_assert(!std::is_same_v<TDataType, TDataType>,
"GetContiguousData should only be called if rValue is contiguous.");
766 if constexpr(std::is_same_v<PrimitiveType, ValueType>) {
767 return rValue.data().
begin();
772 if (rValue.size() > 0) {
781 static_assert(!std::is_same_v<TDataType, TDataType>,
"GetContiguousData should only be called if rValue is contiguous.");
801 if (rContainer.size() != 0) {
803 for (
unsigned int i = 0;
i < rContainer.size(); ++
i) {
804 ValueTraits::CopyToContiguousData(pContiguousDataBegin +
i * stride, rContainer[
i]);
825 if (rContainer.size() != 0) {
827 for (
unsigned int i = 0;
i < rContainer.size(); ++
i) {
828 ValueTraits::CopyFromContiguousData(rContainer[
i], pContiguousDataBegin +
i * stride);
839 template<
unsigned int TCheckIndex,
unsigned int TCurrentIndex>
840 static constexpr
bool IsDimensionDynamicImpl()
842 if constexpr(TCheckIndex == TCurrentIndex) {
845 return ValueTraits::template IsDimensionDynamicImpl<TCheckIndex, TCurrentIndex + 1>();
879 static constexpr
unsigned int Dimension = ValueTraits::Dimension + 2;
895 template<
unsigned int TCheckIndex>
898 return IsDimensionDynamicImpl<TCheckIndex, 0>();
910 template<
class TIndexType =
unsigned int>
913 return (rValue.size1() == 0 || rValue.size2() == 0 ? 0 : rValue.size1() * rValue.size2() * ValueTraits::template Size<TIndexType>(rValue.data()[0]));
925 template<
class TIndexType =
unsigned int>
928 std::vector<TIndexType> shape(
Dimension);
942 template<
class TIndexType =
unsigned int>
945 TIndexType* pShapeBegin,
946 TIndexType* pShapeEnd)
949 <<
"Invalid dimensions given to fill for primitive data type [ Expected dimension >= 2, provided shape = "
950 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
952 if (rContainer.size1() > 0 && rContainer.size2() > 0) {
953 ValueTraits::Shape(rContainer(0, 0), pShapeBegin + 2, pShapeEnd);
955 ValueTraits::Shape(
ValueType{}, pShapeBegin + 2, pShapeEnd);
957 pShapeBegin[0] = rContainer.size1();
958 pShapeBegin[1] = rContainer.size2();
977 template<
class TIndexType =
unsigned int>
980 const std::vector<TIndexType>& rShape)
982 return Reshape(rContainer, rShape.data(), rShape.data() + rShape.size());
1002 template<
class TIndexType =
unsigned int>
1005 TIndexType
const * pShapeBegin,
1006 TIndexType
const * pShapeEnd)
1009 <<
"Invalid shape/dimension given for DenseMatrix data type [ Expected = " <<
Shape(rContainer) <<
", provided = "
1010 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
1012 bool is_reshaped =
false;
1014 if (rContainer.size1() != pShapeBegin[0] || rContainer.size2() != pShapeBegin[1]) {
1015 rContainer.
resize(pShapeBegin[0], pShapeBegin[1],
false);
1019 if constexpr(ValueTraits::IsDynamic) {
1020 std::for_each(rContainer.data().
begin(), rContainer.data().
end(), [&is_reshaped, pShapeBegin, pShapeEnd](
auto& rValue) {
1021 is_reshaped = ValueTraits::Reshape(rValue, pShapeBegin + 2, pShapeEnd) || is_reshaped;
1041 if constexpr(std::is_same_v<PrimitiveType, ValueType>) {
1042 return rValue.data().
begin();
1047 if (rValue.size1() > 0 && rValue.size2() > 0) {
1056 static_assert(!std::is_same_v<TDataType, TDataType>,
"GetContiguousData should only be called if rValue is contiguous.");
1073 if constexpr(std::is_same_v<PrimitiveType, ValueType>) {
1074 return rValue.data().
begin();
1079 if (rValue.size1() > 0 && rValue.size2() > 0) {
1088 static_assert(!std::is_same_v<TDataType, TDataType>,
"GetContiguousData should only be called if rValue is contiguous.");
1108 if (rContainer.size1() != 0 && rContainer.size2() != 0) {
1110 for (
unsigned int i = 0;
i < rContainer.size1() * rContainer.size2(); ++
i) {
1111 ValueTraits::CopyToContiguousData(pContiguousDataBegin +
i * stride, rContainer.data()[
i]);
1132 if (rContainer.size1() != 0 && rContainer.size2() != 0) {
1134 for (
unsigned int i = 0;
i < rContainer.size1() * rContainer.size2(); ++
i) {
1135 ValueTraits::CopyFromContiguousData(rContainer.data()[
i], pContiguousDataBegin +
i * stride);
1146 template<
unsigned int TCheckIndex,
unsigned int TCurrentIndex>
1147 static constexpr
bool IsDimensionDynamicImpl()
1149 if constexpr(TCheckIndex == TCurrentIndex || TCheckIndex == TCurrentIndex + 1) {
1152 return ValueTraits::template IsDimensionDynamicImpl<TCheckIndex, TCurrentIndex + 2>();
1198 template<
unsigned int TCheckIndex>
1201 return IsDimensionDynamicImpl<TCheckIndex, 0>();
1213 template<
class TIndexType =
unsigned int>
1216 return rValue.size();
1228 template<
class TIndexType =
unsigned int>
1231 std::vector<TIndexType> shape(
Dimension);
1245 template<
class TIndexType =
unsigned int>
1248 TIndexType* pShapeBegin,
1249 TIndexType* pShapeEnd)
1252 <<
"Invalid dimensions given to fill for std::string data type [ Expected dimension == 1, provided shape = "
1253 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
1254 pShapeBegin[0] = rContainer.size();
1273 template<
class TIndexType =
unsigned int>
1276 const std::vector<TIndexType>& rShape)
1278 return Reshape(rContainer, rShape.data(), rShape.data() + rShape.size());
1298 template<
class TIndexType =
unsigned int>
1301 TIndexType
const * pShapeBegin,
1302 TIndexType
const * pShapeEnd)
1305 <<
"Invalid shape/dimension given for std::string data type [ Expected = "
1306 <<
Shape(rContainer) <<
", provided = "
1307 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
1309 bool is_reshaped =
false;
1311 if (rContainer.size() != pShapeBegin[0]) {
1312 rContainer.resize(pShapeBegin[0],
false);
1331 return rValue.data();
1346 return rValue.data();
1365 std::copy(rContainer.begin(), rContainer.end(), pContiguousDataBegin);
1384 std::copy(pContiguousDataBegin, pContiguousDataBegin + rContainer.size(), rContainer.begin());
1393 template<
unsigned int TCheckIndex,
unsigned int TCurrentIndex>
1394 static constexpr
bool IsDimensionDynamicImpl()
1396 if constexpr(TCheckIndex == TCurrentIndex) {
1399 static_assert(TCheckIndex != TCheckIndex,
"Invalid dimension index.");
1427 static constexpr
bool IsContiguous = std::is_same_v<PrimitiveType, ValueType>;
1431 static constexpr
unsigned int Dimension = ValueTraits::Dimension + 1;
1447 template<
unsigned int TCheckIndex>
1450 return IsDimensionDynamicImpl<TCheckIndex, 0>();
1462 template<
class TIndexType =
unsigned int>
1465 return (rValue.empty() ? 0 : rValue.size() * ValueTraits::template Size<TIndexType>(rValue[0]));
1477 template<
class TIndexType =
unsigned int>
1480 std::vector<TIndexType> shape(
Dimension);
1494 template<
class TIndexType =
unsigned int>
1497 TIndexType* pShapeBegin,
1498 TIndexType* pShapeEnd)
1501 <<
"Invalid dimensions given to fill for primitive data type [ Expected dimension >= 1, provided shape = "
1502 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
1504 if (rContainer.empty()) {
1505 ValueTraits::Shape(
ValueType{}, pShapeBegin + 1, pShapeEnd);
1507 ValueTraits::Shape(rContainer[0], pShapeBegin + 1, pShapeEnd);
1509 pShapeBegin[0] = rContainer.size();
1528 template<
class TIndexType =
unsigned int>
1531 const std::vector<TIndexType>& rShape)
1533 return Reshape(rContainer, rShape.data(), rShape.data() + rShape.size());
1553 template<
class TIndexType =
unsigned int>
1556 TIndexType
const * pShapeBegin,
1557 TIndexType
const * pShapeEnd)
1560 <<
"Invalid shape/dimension given for std::vector data type [ Expected = " <<
Shape(rContainer) <<
", provided = "
1561 << std::vector<TIndexType>(pShapeBegin, pShapeEnd) <<
" ].\n";
1563 bool is_reshaped =
false;
1565 if (rContainer.size() != pShapeBegin[0]) {
1566 rContainer.resize(pShapeBegin[0]);
1570 if constexpr(ValueTraits::IsDynamic) {
1571 std::for_each(rContainer.begin(), rContainer.end(), [&is_reshaped, pShapeBegin, pShapeEnd](
auto& rValue) {
1572 is_reshaped = ValueTraits::Reshape(rValue, pShapeBegin + 1, pShapeEnd) || is_reshaped;
1592 return rValue.data();
1594 static_assert(!std::is_same_v<TDataType, TDataType>,
"GetContiguousData should only be called if rValue is contiguous.");
1611 return rValue.data();
1613 static_assert(!std::is_same_v<TDataType, TDataType>,
"GetContiguousData should only be called if rValue is contiguous.");
1633 if (rContainer.size() != 0) {
1635 for (
unsigned int i = 0;
i < rContainer.size(); ++
i) {
1636 ValueTraits::CopyToContiguousData(pContiguousDataBegin +
i * stride, rContainer[
i]);
1657 if (rContainer.size() != 0) {
1659 for (
unsigned int i = 0;
i < rContainer.size(); ++
i) {
1660 ValueTraits::CopyFromContiguousData(rContainer[
i], pContiguousDataBegin +
i * stride);
1671 template<
unsigned int TCheckIndex,
unsigned int TCurrentIndex>
1672 static constexpr
bool IsDimensionDynamicImpl()
1674 if constexpr(TCheckIndex == TCurrentIndex) {
1677 return ValueTraits::template IsDimensionDynamicImpl<TCheckIndex, TCurrentIndex + 1>();
static std::vector< TIndexType > Shape(const ContainerType &rContainer)
Get the shape of the rContainer.
Definition: data_type_traits.h:926
static PrimitiveType const * GetContiguousData(const ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:1038
typename ValueTraits::PrimitiveType PrimitiveType
Definition: data_type_traits.h:871
static bool Reshape(ContainerType &rContainer, TIndexType const *pShapeBegin, TIndexType const *pShapeEnd)
Reshapes the given value to given shape.
Definition: data_type_traits.h:1003
static void CopyFromContiguousData(ContainerType &rContainer, PrimitiveType const *pContiguousDataBegin)
Copies contiguous values to the container.
Definition: data_type_traits.h:1128
static bool Reshape(ContainerType &rContainer, const std::vector< TIndexType > &rShape)
Reshapes the given value to given shape.
Definition: data_type_traits.h:978
static void Shape(const ContainerType &rContainer, TIndexType *pShapeBegin, TIndexType *pShapeEnd)
Fills the given array with the shape values in each dimension.
Definition: data_type_traits.h:943
static PrimitiveType * GetContiguousData(ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:1070
static void CopyToContiguousData(PrimitiveType *pContiguousDataBegin, const ContainerType &rContainer)
Copies the given container element value to contiguous array.
Definition: data_type_traits.h:1104
static TIndexType Size(const ContainerType &rValue)
Gets the size of underlying rContainer.
Definition: data_type_traits.h:911
TDataType ValueType
Definition: data_type_traits.h:867
static constexpr bool IsDimensionDynamic()
Returns whther the given TCheckIndex is dynamic.
Definition: data_type_traits.h:896
static PrimitiveType * GetContiguousData(ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:763
static PrimitiveType const * GetContiguousData(const ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:731
static void CopyFromContiguousData(ContainerType &rContainer, PrimitiveType const *pContiguousDataBegin)
Copies contiguous values to the container.
Definition: data_type_traits.h:821
static constexpr bool IsDimensionDynamic()
Returns whther the given TCheckIndex is dynamic.
Definition: data_type_traits.h:590
static bool Reshape(ContainerType &rContainer, TIndexType const *pShapeBegin, TIndexType const *pShapeEnd)
Reshapes the given value to given shape.
Definition: data_type_traits.h:696
typename ValueTraits::PrimitiveType PrimitiveType
Definition: data_type_traits.h:565
static void CopyToContiguousData(PrimitiveType *pContiguousDataBegin, const ContainerType &rContainer)
Copies the given container element value to contiguous array.
Definition: data_type_traits.h:797
static void Shape(const ContainerType &rContainer, TIndexType *pShapeBegin, TIndexType *pShapeEnd)
Fills the given array with the shape values in each dimension.
Definition: data_type_traits.h:637
TDataType ValueType
Definition: data_type_traits.h:561
static std::vector< TIndexType > Shape(const ContainerType &rContainer)
Get the shape of the rContainer.
Definition: data_type_traits.h:620
static TIndexType Size(const ContainerType &rValue)
Gets the size of underlying rContainer.
Definition: data_type_traits.h:605
static bool Reshape(ContainerType &rContainer, const std::vector< TIndexType > &rShape)
Reshapes the given value to given shape.
Definition: data_type_traits.h:671
static void CopyToContiguousData(PrimitiveType *pContiguousDataBegin, const ContainerType &rContainer)
Copies the given container element value to contiguous array.
Definition: data_type_traits.h:490
static bool Reshape(ContainerType &rContainer, const std::vector< TIndexType > &rShape)
Reshapes the given value to given shape.
Definition: data_type_traits.h:369
static std::vector< TIndexType > Shape(const ContainerType &rContainer)
Get the shape of the rContainer.
Definition: data_type_traits.h:318
static PrimitiveType * GetContiguousData(ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:456
static PrimitiveType const * GetContiguousData(const ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:424
static bool Reshape(ContainerType &rContainer, TIndexType const *pShapeBegin, TIndexType const *pShapeEnd)
Reshapes the given value to given shape.
Definition: data_type_traits.h:394
typename ValueTraits::PrimitiveType PrimitiveType
Definition: data_type_traits.h:259
static void CopyFromContiguousData(ContainerType &rContainer, PrimitiveType const *pContiguousDataBegin)
Copies contiguous values to the container.
Definition: data_type_traits.h:512
static void Shape(const ContainerType &rContainer, TIndexType *pShapeBegin, TIndexType *pShapeEnd)
Fills the given array with the shape values in each dimension.
Definition: data_type_traits.h:335
static TIndexType Size(const ContainerType &rContainer)
Gets the size of underlying rContainer.
Definition: data_type_traits.h:299
static constexpr bool IsDimensionDynamic()
Returns whther the given TCheckIndex is dynamic.
Definition: data_type_traits.h:284
TDataType ValueType
Definition: data_type_traits.h:255
static void Shape(const ContainerType &rContainer, TIndexType *pShapeBegin, TIndexType *pShapeEnd)
Fills the given array with the shape values in each dimension.
Definition: data_type_traits.h:1246
char PrimitiveType
Definition: data_type_traits.h:1176
char ValueType
Definition: data_type_traits.h:1174
static bool Reshape(ContainerType &rContainer, TIndexType const *pShapeBegin, TIndexType const *pShapeEnd)
Reshapes the given value to given shape.
Definition: data_type_traits.h:1299
static PrimitiveType const * GetContiguousData(const ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:1329
static TIndexType Size(const ContainerType &rValue)
Gets the size of underlying rContainer.
Definition: data_type_traits.h:1214
std::string ContainerType
Definition: data_type_traits.h:1172
static void CopyToContiguousData(PrimitiveType *pContiguousDataBegin, const ContainerType &rContainer)
Copies the given container element value to contiguous array.
Definition: data_type_traits.h:1361
static constexpr bool IsDimensionDynamic()
Returns whther the given TCheckIndex is dynamic.
Definition: data_type_traits.h:1199
static bool Reshape(ContainerType &rContainer, const std::vector< TIndexType > &rShape)
Reshapes the given value to given shape.
Definition: data_type_traits.h:1274
static std::vector< TIndexType > Shape(const ContainerType &rContainer)
Get the shape of the rContainer.
Definition: data_type_traits.h:1229
static PrimitiveType * GetContiguousData(ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:1344
static void CopyFromContiguousData(ContainerType &rContainer, PrimitiveType const *pContiguousDataBegin)
Copies contiguous values to the container.
Definition: data_type_traits.h:1380
static bool Reshape(ContainerType &rContainer, const std::vector< TIndexType > &rShape)
Reshapes the given value to given shape.
Definition: data_type_traits.h:1529
static PrimitiveType const * GetContiguousData(const ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:1589
typename ValueTraits::PrimitiveType PrimitiveType
Definition: data_type_traits.h:1425
static PrimitiveType * GetContiguousData(ContainerType &rValue)
Get the Contiguous data pointer of the given container.
Definition: data_type_traits.h:1608
static void CopyToContiguousData(PrimitiveType *pContiguousDataBegin, const ContainerType &rContainer)
Copies the given container element value to contiguous array.
Definition: data_type_traits.h:1629
static TIndexType Size(const ContainerType &rValue)
Gets the size of underlying rContainer.
Definition: data_type_traits.h:1463
static bool Reshape(ContainerType &rContainer, TIndexType const *pShapeBegin, TIndexType const *pShapeEnd)
Reshapes the given value to given shape.
Definition: data_type_traits.h:1554
TDataType ValueType
Definition: data_type_traits.h:1421
std::vector< TDataType > ContainerType
Definition: data_type_traits.h:1419
static constexpr bool IsDimensionDynamic()
Returns whther the given TCheckIndex is dynamic.
Definition: data_type_traits.h:1448
static std::vector< TIndexType > Shape(const ContainerType &rContainer)
Get the shape of the rContainer.
Definition: data_type_traits.h:1478
static void CopyFromContiguousData(ContainerType &rContainer, PrimitiveType const *pContiguousDataBegin)
Copies contiguous values to the container.
Definition: data_type_traits.h:1653
static void Shape(const ContainerType &rContainer, TIndexType *pShapeBegin, TIndexType *pShapeEnd)
Fills the given array with the shape values in each dimension.
Definition: data_type_traits.h:1495
Generic data type traits class for arithmetic types.
Definition: data_type_traits.h:33
TDataType ContainerType
Definition: data_type_traits.h:38
static constexpr bool IsDynamic
Definition: data_type_traits.h:46
static void Shape(const ContainerType &, TIndexType *pShapeBegin, TIndexType *pShapeEnd)
Fills the given array with the shape values in each dimension.
Definition: data_type_traits.h:104
static std::vector< TIndexType > Shape(const ContainerType &)
Returns a vector with the shape of the value.
Definition: data_type_traits.h:89
static constexpr bool IsDimensionDynamic()
Returns whther the given TCheckIndex is dynamic.
Definition: data_type_traits.h:65
static bool Reshape(ContainerType &, TIndexType const *pShapeBegin, TIndexType const *pShapeEnd)
Reshapes the value.
Definition: data_type_traits.h:145
static PrimitiveType const * GetContiguousData(const ContainerType &rValue)
Get the contiguous data pointer.
Definition: data_type_traits.h:162
static TIndexType Size(const ContainerType &)
Returns the size of the value.
Definition: data_type_traits.h:76
TDataType ValueType
Definition: data_type_traits.h:40
static PrimitiveType * GetContiguousData(ContainerType &rValue)
Get the contiguous data pointer.
Definition: data_type_traits.h:173
static void CopyFromContiguousData(ContainerType &rValue, PrimitiveType const *pContiguousDataBegin)
Copies data from contiguous array to rValue.
Definition: data_type_traits.h:208
static void CopyToContiguousData(PrimitiveType *pContiguousDataBegin, const ContainerType &rValue)
Copies the given Value to contiguous array.
Definition: data_type_traits.h:190
static constexpr bool IsContiguous
Definition: data_type_traits.h:44
static constexpr unsigned int Dimension
Definition: data_type_traits.h:48
TDataType PrimitiveType
Definition: data_type_traits.h:42
static bool Reshape(ContainerType &rValue, const std::vector< TIndexType > &rShape)
Reshapes the value.
Definition: data_type_traits.h:126
Definition: amatrix_interface.h:41
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
iterator end()
Definition: amatrix_interface.h:243
iterator begin()
Definition: amatrix_interface.h:241
Short class definition.
Definition: array_1d.h:61
BOOST_UBLAS_INLINE const array_type & data() const
Definition: array_1d.h:383
BOOST_UBLAS_INLINE const_iterator end() const
Definition: array_1d.h:611
BOOST_UBLAS_INLINE const_iterator begin() const
Definition: array_1d.h:606
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
tuple const
Definition: ode_solve.py:403
namespace
Definition: array_1d.h:793
integer i
Definition: TensorModule.f:17