17#include <boost/preprocessor/cat.hpp>
18#include <boost/preprocessor/seq/for_each.hpp>
49template <
typename Spline>
65 typename Spline::template derived_self_type<
typename Spline::value_type,
70 template <
typename real_t>
72 typename Spline::template derived_self_type<real_t, Spline::geoDim()>;
75 std::tuple<boundary_spline_type, boundary_spline_type>
bdr_;
82 using eval_type = std::tuple<torch::Tensor, torch::Tensor>;
87 : bdr_({boundary_spline_type(options), boundary_spline_type(options)}) {}
97 : bdr_(clone ?
std::apply(
99 return std::make_tuple(
bspline.clone()...);
108 : bdr_({boundary_spline_type(std::array<int64_t, 0>{},
init, options),
109 boundary_spline_type(std::array<int64_t, 0>{},
init, options)}) {}
112 BoundaryCore(
const std::array<std::vector<typename Spline::value_type>, 1> &,
116 : bdr_({boundary_spline_type(std::array<int64_t, 0>{},
init, options),
117 boundary_spline_type(std::array<int64_t, 0>{},
init, options)}) {}
131 .reshape({-1, tensor.size(-1)}));
133 .reshape({-1, tensor.size(-1)}));
138 tensor_view.index({torch::indexing::Slice(), 0}).flatten());
140 tensor_view.index({torch::indexing::Slice(), -1}).flatten());
149 template <
short_t s>
inline constexpr auto &
side()
const {
150 static_assert(
s >
none &&
s <= nsides());
151 return std::get<
s - 1>(bdr_);
155 template <
short_t s>
inline constexpr auto &
side() {
156 static_assert(
s >
none &&
s <= nsides());
157 return std::get<
s - 1>(bdr_);
162 inline constexpr auto &
coeffs()
const {
return bdr_; }
166 inline constexpr auto &
coeffs() {
return bdr_; }
180 os << name() <<
"(\n"
186 inline nlohmann::json
to_json()
const override {
215template <
typename Spline>
231 typename Spline::template derived_self_type<
232 typename Spline::value_type, Spline::geoDim(), Spline::degree(1)>,
233 typename Spline::template derived_self_type<
234 typename Spline::value_type, Spline::geoDim(), Spline::degree(0)>>;
238 template <
typename real_t>
240 std::tuple<
typename Spline::template derived_self_type<
241 real_t, Spline::geoDim(), Spline::degree(1)>,
242 typename Spline::template derived_self_type<
243 real_t, Spline::geoDim(), Spline::degree(0)>>;
246 std::tuple<typename std::tuple_element_t<0, boundary_spline_type>,
247 typename std::tuple_element_t<0, boundary_spline_type>,
248 typename std::tuple_element_t<1, boundary_spline_type>,
249 typename std::tuple_element_t<1, boundary_spline_type>>
263 : bdr_({std::tuple_element_t<0, boundary_spline_type>(options),
264 std::tuple_element_t<0, boundary_spline_type>(options),
265 std::tuple_element_t<1, boundary_spline_type>(options),
266 std::tuple_element_t<1, boundary_spline_type>(options)}) {}
276 : bdr_(clone ?
std::apply(
278 return std::make_tuple(
bspline.clone()...);
288 : bdr_({std::tuple_element_t<0, boundary_spline_type>(
289 std::array<int64_t, 1>({ncoeffs[1]}),
init, options),
290 std::tuple_element_t<0, boundary_spline_type>(
291 std::array<int64_t, 1>({ncoeffs[1]}),
init, options),
292 std::tuple_element_t<1, boundary_spline_type>(
293 std::array<int64_t, 1>({ncoeffs[0]}),
init, options),
294 std::tuple_element_t<1, boundary_spline_type>(
295 std::array<int64_t, 1>({ncoeffs[0]}),
init, options)}) {}
299 const std::array<std::vector<typename Spline::value_type>, 2> &
kv,
303 : bdr_({std::tuple_element_t<0, boundary_spline_type>(
304 std::array<std::vector<typename Spline::value_type>, 1>(
307 std::tuple_element_t<0, boundary_spline_type>(
308 std::array<std::vector<typename Spline::value_type>, 1>(
311 std::tuple_element_t<1, boundary_spline_type>(
312 std::array<std::vector<typename Spline::value_type>, 1>(
315 std::tuple_element_t<1, boundary_spline_type>(
316 std::array<std::vector<typename Spline::value_type>, 1>(
335 .index({torch::indexing::Slice(), torch::indexing::Slice(), 0})
339 .index({torch::indexing::Slice(), torch::indexing::Slice(), -1})
343 .index({torch::indexing::Slice(), 0, torch::indexing::Slice()})
347 .index({torch::indexing::Slice(), -1, torch::indexing::Slice()})
355 .index({torch::indexing::Slice(), torch::indexing::Slice(), 0})
359 .index({torch::indexing::Slice(), torch::indexing::Slice(), -1})
363 .index({torch::indexing::Slice(), 0, torch::indexing::Slice()})
367 .index({torch::indexing::Slice(), -1, torch::indexing::Slice()})
377 template <
short_t s>
inline constexpr auto &
side()
const {
378 static_assert(
s >
none &&
s <= nsides());
379 return std::get<
s - 1>(bdr_);
383 template <
short_t s>
inline constexpr auto &
side() {
384 static_assert(
s >
none &&
s <= nsides());
385 return std::get<
s - 1>(bdr_);
390 inline constexpr auto &
coeffs()
const {
return bdr_; }
394 inline constexpr auto &
coeffs() {
return bdr_; }
410 os << name() <<
"(\n"
418 inline nlohmann::json
to_json()
const override {
454template <
typename Spline>
470 std::tuple<
typename Spline::template derived_self_type<
471 typename Spline::value_type, Spline::geoDim(),
472 Spline::degree(1), Spline::degree(2)>,
473 typename Spline::template derived_self_type<
474 typename Spline::value_type, Spline::geoDim(),
475 Spline::degree(0), Spline::degree(2)>,
476 typename Spline::template derived_self_type<
477 typename Spline::value_type, Spline::geoDim(),
478 Spline::degree(0), Spline::degree(1)>>;
482 template <
typename real_t>
484 typename Spline::template derived_self_type<
485 real_t, Spline::geoDim(), Spline::degree(1), Spline::degree(2)>,
486 typename Spline::template derived_self_type<
487 real_t, Spline::geoDim(), Spline::degree(0), Spline::degree(2)>,
488 typename Spline::template derived_self_type<
489 real_t, Spline::geoDim(), Spline::degree(0), Spline::degree(1)>>;
492 std::tuple<typename std::tuple_element_t<0, boundary_spline_type>,
493 typename std::tuple_element_t<0, boundary_spline_type>,
494 typename std::tuple_element_t<1, boundary_spline_type>,
495 typename std::tuple_element_t<1, boundary_spline_type>,
496 typename std::tuple_element_t<2, boundary_spline_type>,
497 typename std::tuple_element_t<2, boundary_spline_type>>
512 : bdr_({std::tuple_element_t<0, boundary_spline_type>(options),
513 std::tuple_element_t<0, boundary_spline_type>(options),
514 std::tuple_element_t<1, boundary_spline_type>(options),
515 std::tuple_element_t<1, boundary_spline_type>(options),
516 std::tuple_element_t<2, boundary_spline_type>(options),
517 std::tuple_element_t<2, boundary_spline_type>(options)}) {}
527 : bdr_(clone ?
std::apply(
529 return std::make_tuple(
bspline.clone()...);
539 : bdr_({std::tuple_element_t<0, boundary_spline_type>(
540 std::array<int64_t, 2>({ncoeffs[1], ncoeffs[2]}),
init,
542 std::tuple_element_t<0, boundary_spline_type>(
543 std::array<int64_t, 2>({ncoeffs[1], ncoeffs[2]}),
init,
545 std::tuple_element_t<1, boundary_spline_type>(
546 std::array<int64_t, 2>({ncoeffs[0], ncoeffs[2]}),
init,
548 std::tuple_element_t<1, boundary_spline_type>(
549 std::array<int64_t, 2>({ncoeffs[0], ncoeffs[2]}),
init,
551 std::tuple_element_t<2, boundary_spline_type>(
552 std::array<int64_t, 2>({ncoeffs[0], ncoeffs[1]}),
init,
554 std::tuple_element_t<2, boundary_spline_type>(
555 std::array<int64_t, 2>({ncoeffs[0], ncoeffs[1]}),
init,
560 const std::array<std::vector<typename Spline::value_type>, 3> &
kv,
564 : bdr_({std::tuple_element_t<0, boundary_spline_type>(
565 std::array<std::vector<typename Spline::value_type>, 2>(
568 std::tuple_element_t<0, boundary_spline_type>(
569 std::array<std::vector<typename Spline::value_type>, 2>(
572 std::tuple_element_t<1, boundary_spline_type>(
573 std::array<std::vector<typename Spline::value_type>, 2>(
576 std::tuple_element_t<1, boundary_spline_type>(
577 std::array<std::vector<typename Spline::value_type>, 2>(
580 std::tuple_element_t<2, boundary_spline_type>(
581 std::array<std::vector<typename Spline::value_type>, 2>(
584 std::tuple_element_t<2, boundary_spline_type>(
585 std::array<std::vector<typename Spline::value_type>, 2>(
604 .index({torch::indexing::Slice(), torch::indexing::Slice(),
605 torch::indexing::Slice(), 0})
609 .index({torch::indexing::Slice(), torch::indexing::Slice(),
610 torch::indexing::Slice(), -1})
614 .index({torch::indexing::Slice(), torch::indexing::Slice(), 0,
615 torch::indexing::Slice()})
619 .index({torch::indexing::Slice(), torch::indexing::Slice(), -1,
620 torch::indexing::Slice()})
624 .index({torch::indexing::Slice(), 0, torch::indexing::Slice(),
625 torch::indexing::Slice()})
629 .index({torch::indexing::Slice(), -1, torch::indexing::Slice(),
630 torch::indexing::Slice()})
639 .index({torch::indexing::Slice(), torch::indexing::Slice(),
640 torch::indexing::Slice(), 0})
644 .index({torch::indexing::Slice(), torch::indexing::Slice(),
645 torch::indexing::Slice(), -1})
650 .index({torch::indexing::Slice(), torch::indexing::Slice(), 0,
651 torch::indexing::Slice()})
655 .index({torch::indexing::Slice(), torch::indexing::Slice(), -1,
656 torch::indexing::Slice()})
661 .index({torch::indexing::Slice(), 0, torch::indexing::Slice(),
662 torch::indexing::Slice()})
666 .index({torch::indexing::Slice(), -1, torch::indexing::Slice(),
667 torch::indexing::Slice()})
677 template <
short_t s>
inline constexpr auto &
side()
const {
678 static_assert(
s >
none &&
s <= nsides());
679 return std::get<
s - 1>(bdr_);
683 template <
short_t s>
inline constexpr auto &
side() {
684 static_assert(
s >
none &&
s <= nsides());
685 return std::get<
s - 1>(bdr_);
690 inline constexpr auto &
coeffs()
const {
return bdr_; }
694 inline constexpr auto &
coeffs() {
return bdr_; }
712 os << name() <<
"(\n"
722 inline nlohmann::json
to_json()
const override {
765template <
typename Spline>
781 std::tuple<
typename Spline::template derived_self_type<
782 typename Spline::value_type, Spline::geoDim(),
783 Spline::degree(1), Spline::degree(2), Spline::degree(3)>,
784 typename Spline::template derived_self_type<
785 typename Spline::value_type, Spline::geoDim(),
786 Spline::degree(0), Spline::degree(2), Spline::degree(3)>,
787 typename Spline::template derived_self_type<
788 typename Spline::value_type, Spline::geoDim(),
789 Spline::degree(0), Spline::degree(1), Spline::degree(3)>,
790 typename Spline::template derived_self_type<
791 typename Spline::value_type, Spline::geoDim(),
792 Spline::degree(0), Spline::degree(1), Spline::degree(2)>>;
796 template <
typename real_t>
798 std::tuple<
typename Spline::template derived_self_type<
799 real_t, Spline::geoDim(), Spline::degree(1),
800 Spline::degree(2), Spline::degree(3)>,
801 typename Spline::template derived_self_type<
802 real_t, Spline::geoDim(), Spline::degree(0),
803 Spline::degree(2), Spline::degree(3)>,
804 typename Spline::template derived_self_type<
805 real_t, Spline::geoDim(), Spline::degree(0),
806 Spline::degree(1), Spline::degree(3)>,
807 typename Spline::template derived_self_type<
808 real_t, Spline::geoDim(), Spline::degree(0),
809 Spline::degree(1), Spline::degree(2)>>;
812 std::tuple<typename std::tuple_element_t<0, boundary_spline_type>,
813 typename std::tuple_element_t<0, boundary_spline_type>,
814 typename std::tuple_element_t<1, boundary_spline_type>,
815 typename std::tuple_element_t<1, boundary_spline_type>,
816 typename std::tuple_element_t<2, boundary_spline_type>,
817 typename std::tuple_element_t<2, boundary_spline_type>,
818 typename std::tuple_element_t<3, boundary_spline_type>,
819 typename std::tuple_element_t<3, boundary_spline_type>>
835 : bdr_({std::tuple_element_t<0, boundary_spline_type>(options),
836 std::tuple_element_t<0, boundary_spline_type>(options),
837 std::tuple_element_t<1, boundary_spline_type>(options),
838 std::tuple_element_t<1, boundary_spline_type>(options),
839 std::tuple_element_t<2, boundary_spline_type>(options),
840 std::tuple_element_t<2, boundary_spline_type>(options),
841 std::tuple_element_t<3, boundary_spline_type>(options),
842 std::tuple_element_t<3, boundary_spline_type>(options)}) {}
852 : bdr_(clone ?
std::apply(
854 return std::make_tuple(
bspline.clone()...);
864 : bdr_({std::tuple_element_t<0, boundary_spline_type>(
865 std::array<int64_t, 3>({ncoeffs[1], ncoeffs[2], ncoeffs[3]}),
867 std::tuple_element_t<0, boundary_spline_type>(
868 std::array<int64_t, 3>({ncoeffs[1], ncoeffs[2], ncoeffs[3]}),
870 std::tuple_element_t<1, boundary_spline_type>(
871 std::array<int64_t, 3>({ncoeffs[0], ncoeffs[2], ncoeffs[3]}),
873 std::tuple_element_t<1, boundary_spline_type>(
874 std::array<int64_t, 3>({ncoeffs[0], ncoeffs[2], ncoeffs[3]}),
876 std::tuple_element_t<2, boundary_spline_type>(
877 std::array<int64_t, 3>({ncoeffs[0], ncoeffs[1], ncoeffs[3]}),
879 std::tuple_element_t<2, boundary_spline_type>(
880 std::array<int64_t, 3>({ncoeffs[0], ncoeffs[1], ncoeffs[3]}),
882 std::tuple_element_t<3, boundary_spline_type>(
883 std::array<int64_t, 3>({ncoeffs[0], ncoeffs[1], ncoeffs[2]}),
885 std::tuple_element_t<3, boundary_spline_type>(
886 std::array<int64_t, 3>({ncoeffs[0], ncoeffs[1], ncoeffs[2]}),
891 const std::array<std::vector<typename Spline::value_type>, 4> &
kv,
895 : bdr_({std::tuple_element_t<0, boundary_spline_type>(
896 std::array<std::vector<typename Spline::value_type>, 3>(
899 std::tuple_element_t<0, boundary_spline_type>(
900 std::array<std::vector<typename Spline::value_type>, 3>(
903 std::tuple_element_t<1, boundary_spline_type>(
904 std::array<std::vector<typename Spline::value_type>, 3>(
907 std::tuple_element_t<1, boundary_spline_type>(
908 std::array<std::vector<typename Spline::value_type>, 3>(
911 std::tuple_element_t<2, boundary_spline_type>(
912 std::array<std::vector<typename Spline::value_type>, 3>(
915 std::tuple_element_t<2, boundary_spline_type>(
916 std::array<std::vector<typename Spline::value_type>, 3>(
919 std::tuple_element_t<3, boundary_spline_type>(
920 std::array<std::vector<typename Spline::value_type>, 3>(
923 std::tuple_element_t<3, boundary_spline_type>(
924 std::array<std::vector<typename Spline::value_type>, 3>(
943 .index({torch::indexing::Slice(), torch::indexing::Slice(),
944 torch::indexing::Slice(), torch::indexing::Slice(), 0})
948 .index({torch::indexing::Slice(), torch::indexing::Slice(),
949 torch::indexing::Slice(), torch::indexing::Slice(), -1})
953 .index({torch::indexing::Slice(), torch::indexing::Slice(),
954 torch::indexing::Slice(), 0, torch::indexing::Slice()})
958 .index({torch::indexing::Slice(), torch::indexing::Slice(),
959 torch::indexing::Slice(), -1, torch::indexing::Slice()})
963 .index({torch::indexing::Slice(), torch::indexing::Slice(), 0,
964 torch::indexing::Slice(), torch::indexing::Slice()})
968 .index({torch::indexing::Slice(), torch::indexing::Slice(), -1,
969 torch::indexing::Slice(), torch::indexing::Slice()})
973 .index({torch::indexing::Slice(), 0, torch::indexing::Slice(),
974 torch::indexing::Slice(), torch::indexing::Slice()})
978 .index({torch::indexing::Slice(), -1, torch::indexing::Slice(),
979 torch::indexing::Slice(), torch::indexing::Slice()})
988 .index({torch::indexing::Slice(), torch::indexing::Slice(),
989 torch::indexing::Slice(), torch::indexing::Slice(), 0})
993 .index({torch::indexing::Slice(), torch::indexing::Slice(),
994 torch::indexing::Slice(), torch::indexing::Slice(), -1})
999 .index({torch::indexing::Slice(), torch::indexing::Slice(),
1000 torch::indexing::Slice(), 0, torch::indexing::Slice()})
1004 .index({torch::indexing::Slice(), torch::indexing::Slice(),
1005 torch::indexing::Slice(), -1, torch::indexing::Slice()})
1010 .index({torch::indexing::Slice(), torch::indexing::Slice(), 0,
1011 torch::indexing::Slice(), torch::indexing::Slice()})
1015 .index({torch::indexing::Slice(), torch::indexing::Slice(), -1,
1016 torch::indexing::Slice(), torch::indexing::Slice()})
1021 .index({torch::indexing::Slice(), 0, torch::indexing::Slice(),
1022 torch::indexing::Slice(), torch::indexing::Slice()})
1026 .index({torch::indexing::Slice(), -1, torch::indexing::Slice(),
1027 torch::indexing::Slice(), torch::indexing::Slice()})
1037 template <
short_t s>
inline constexpr auto &
side()
const {
1038 static_assert(
s >
none &&
s <= nsides());
1039 return std::get<
s - 1>(bdr_);
1043 template <
short_t s>
inline constexpr auto &
side() {
1044 static_assert(
s >
none &&
s <= nsides());
1045 return std::get<
s - 1>(bdr_);
1050 inline constexpr auto &
coeffs()
const {
return bdr_; }
1054 inline constexpr auto &
coeffs() {
return bdr_; }
1074 os << name() <<
"(\n"
1087 nlohmann::json
json;
1131template <
typename... T>
1133 std::conjunction<std::is_base_of<detail::BoundaryType, T>...>;
1136template <
typename... T>
1140template <
typename BoundaryCore>
1144 using BoundaryCore::BoundaryCore;
1154 template <std::size_t...
Is>
1155 inline torch::Tensor
as_tensor_(std::index_sequence<Is...>)
const {
1156 return torch::cat({std::get<Is>(BoundaryCore::bdr_).as_tensor()...});
1165 return as_tensor_(std::make_index_sequence<BoundaryCore::nsides()>{});
1173 template <std::size_t...
Is>
1176 [](
auto... size) {
return (size + ...); },
1177 std::make_tuple(std::get<Is>(BoundaryCore::bdr_).
as_tensor_size()...));
1186 return as_tensor_size_(std::make_index_sequence<BoundaryCore::nsides()>{});
1196 template <std::size_t...
Is>
1198 const torch::Tensor &
tensor) {
1200 std::size_t
start(0);
1203 (std::get<Is>(BoundaryCore::bdr_)
1204 .from_tensor(
tensor.index({torch::indexing::Slice(
1205 start, end(std::get<Is>(BoundaryCore::bdr_).ncumcoeffs() *
1206 std::get<Is>(BoundaryCore::bdr_).geoDim()))})),
1220 return from_tensor_(std::make_index_sequence<BoundaryCore::nsides()>{},
1228 size_t...
Is,
typename...
Xi>
1229 inline auto eval_(std::index_sequence<Is...>,
1230 const std::tuple<Xi...> &
xi)
const {
1232 std::get<Is>(BoundaryCore::bdr_)
1237 size_t...
Is,
typename...
Xi,
typename...
Indices>
1238 inline auto eval_(std::index_sequence<Is...>,
const std::tuple<Xi...> &
xi,
1239 const std::tuple<Indices...> &
indices)
const {
1240 return std::tuple(std::get<Is>(BoundaryCore::bdr_)
1242 std::get<Is>(
xi), std::get<Is>(
indices))...);
1246 size_t...
Is,
typename...
Xi,
typename...
Indices,
1248 inline auto eval_(std::index_sequence<Is...>,
const std::tuple<Xi...> &
xi,
1249 const std::tuple<Indices...> &
indices,
1251 return std::tuple(std::get<Is>(BoundaryCore::bdr_)
1253 std::get<Is>(
xi), std::get<Is>(
indices),
1263 inline auto eval(
const std::tuple<Xi...> &
xi)
const {
1265 std::make_index_sequence<BoundaryCore::nsides()>{},
xi);
1270 inline auto eval(
const std::tuple<Xi...> &
xi,
1271 const std::tuple<Indices...> &
indices)
const {
1272 static_assert(
sizeof...(Xi) ==
sizeof...(
Indices));
1274 std::make_index_sequence<BoundaryCore::nsides()>{},
xi,
indices);
1279 inline auto eval(
const std::tuple<Xi...> &
xi,
1280 const std::tuple<Indices...> &
indices,
1282 static_assert(
sizeof...(Xi) ==
sizeof...(
Indices) &&
1285 std::make_index_sequence<BoundaryCore::nsides()>{},
xi,
indices,
1297 const std::tuple<Basfunc...> &
basfunc,
1299 const std::tuple<Numeval...> &
numeval,
1300 const std::tuple<Sizes...> &
sizes)
const {
1301 return std::tuple(std::get<Is>(BoundaryCore::bdr_)
1305 std::get<Is>(
sizes))...);
1312 const std::tuple<Basfunc...> &
basfunc,
1314 const std::tuple<Xi...> &
xi)
const {
1316 std::get<Is>(BoundaryCore::bdr_)
1331 const std::tuple<Numeval...> &
numeval,
1332 const std::tuple<Sizes...> &
sizes)
const {
1333 static_assert(
sizeof...(Basfunc) ==
sizeof...(
Coeff_Indices) &&
1334 sizeof...(Basfunc) ==
sizeof...(
Numeval) &&
1335 sizeof...(Basfunc) ==
sizeof...(
Sizes));
1337 std::make_index_sequence<BoundaryCore::nsides()>{},
basfunc,
1345 const std::tuple<Xi...> &
xi)
const {
1346 static_assert(
sizeof...(Basfunc) ==
sizeof...(
Coeff_Indices) &&
1347 sizeof...(Basfunc) ==
sizeof...(
Xi));
1349 std::make_index_sequence<BoundaryCore::nsides()>{},
basfunc,
1357 template <
size_t...
Is,
typename...
Xi>
1359 const std::tuple<Xi...> &
xi)
const {
1360 return std::tuple(std::get<Is>(BoundaryCore::bdr_)
1366 template <
typename...
Xi>
1369 std::make_index_sequence<BoundaryCore::nsides()>{},
xi);
1377 size_t...
Is,
typename...
Xi>
1379 const std::tuple<Xi...> &
xi)
const {
1380 return std::tuple(std::get<Is>(BoundaryCore::bdr_)
1382 std::get<Is>(
xi))...);
1386 size_t...
Is,
typename...
Xi,
typename...
Indices>
1388 const std::tuple<Xi...> &
xi,
1389 const std::tuple<Indices...> &
indices)
const {
1390 return std::tuple(std::get<Is>(BoundaryCore::bdr_)
1392 std::get<Is>(
xi), std::get<Is>(
indices))...);
1403 std::make_index_sequence<BoundaryCore::nsides()>{},
xi);
1409 const std::tuple<Indices...> &
indices)
const {
1410 static_assert(
sizeof...(Xi) ==
sizeof...(
Indices));
1412 std::make_index_sequence<BoundaryCore::nsides()>{},
xi,
indices);
1421 const std::tuple<Indices...> &
indices)
const {
1422 return std::tuple(std::get<Is>(BoundaryCore::bdr_)
1433 std::make_index_sequence<BoundaryCore::nsides()>{},
indices);
1439 template <
size_t...
Is>
1442 (std::get<Is>(BoundaryCore::bdr_).uniform_refine(
numRefine, dim), ...);
1451 if constexpr (BoundaryCore::spline_type::parDim() > 1)
1454 }
else if (dim == 0) {
1455 if constexpr (BoundaryCore::nsides() == 2) {
1457 }
else if constexpr (BoundaryCore::nsides() == 4) {
1462 }
else if constexpr (BoundaryCore::nsides() == 6) {
1471 }
else if constexpr (BoundaryCore::nsides() == 8) {
1485 throw std::runtime_error(
"Invalid dimension");
1486 }
else if (dim == 1) {
1487 if constexpr (BoundaryCore::nsides() == 4) {
1492 }
else if constexpr (BoundaryCore::nsides() == 6) {
1502 }
else if constexpr (BoundaryCore::nsides() == 8) {
1516 throw std::runtime_error(
"Invalid dimension");
1517 }
else if (dim == 2) {
1518 if constexpr (BoundaryCore::nsides() == 6) {
1527 }
else if constexpr (BoundaryCore::nsides() == 8) {
1541 throw std::runtime_error(
"Invalid dimension");
1542 }
else if (dim == 3) {
1543 if constexpr (BoundaryCore::nsides() == 8) {
1557 throw std::runtime_error(
"Invalid dimension");
1559 throw std::runtime_error(
"Invalid dimension");
1566 template <
size_t...
Is>
1567 inline torch::serialize::OutputArchive &
1569 const std::string &
key =
"boundary")
const {
1570 (std::get<Is>(BoundaryCore::bdr_)
1571 .write(
archive,
key +
".bdr[" + std::to_string(
Is) +
"]"),
1579 const std::string &
key =
"boundary")
const {
1580 torch::serialize::OutputArchive
archive;
1586 inline torch::serialize::OutputArchive &
1588 const std::string &
key =
"boundary")
const {
1596 template <
size_t...
Is>
1597 inline torch::serialize::InputArchive &
1599 const std::string &
key =
"boundary") {
1600 (std::get<Is>(BoundaryCore::bdr_)
1601 .read(
archive,
key +
".bdr[" + std::to_string(
Is) +
"]"),
1609 const std::string &
key =
"boundary") {
1610 torch::serialize::InputArchive
archive;
1617 inline torch::serialize::InputArchive &
1619 const std::string &
key =
"boundary") {
1620 read_(std::make_index_sequence<BoundaryCore::nsides()>{},
archive,
key);
1626 int index = -1)
const {
1627 pugi::xml_document
doc;
1628 pugi::xml_node
root =
doc.append_child(
"xml");
1636 std::string
label =
"",
int index = -1)
const {
1638 pugi::xml_node
bdr =
root.append_child(
"Boundary");
1641 bdr.append_attribute(
"id") =
id;
1644 bdr.append_attribute(
"index") = index;
1647 bdr.append_attribute(
"label") =
label.c_str();
1654 BoundaryCore::bdr_);
1661 std::string
label =
"",
int index = -1) {
1667 std::string
label =
"",
int index = -1) {
1670 for (pugi::xml_node
bdr :
root.children(
"Boundary")) {
1673 if ((
id >= 0 ?
bdr.attribute(
"id").as_int() ==
id :
true) &&
1674 (index >= 0 ?
bdr.attribute(
"index").as_int() == index :
true) &&
1675 (!
label.empty() ?
bdr.attribute(
"label").value() ==
label :
true)) {
1682 BoundaryCore::bdr_);
1689 throw std::runtime_error(
"XML object does not provide geometry with given "
1690 "id, index, and/or label");
1701 (std::get<Is>(BoundaryCore::bdr_) == std::get<Is>(
other.coeffs())) &&
1707 template <
typename BoundaryCore_>
1709 return isequal_(std::make_index_sequence<BoundaryCore::nsides()>{},
other);
1713 template <
typename BoundaryCore_>
1727 typename BoundaryCore::spline_type::value_type
rtol,
1728 typename BoundaryCore::spline_type::value_type
atol)
const {
1729 return ((std::get<Is>(BoundaryCore::bdr_)
1737 template <
typename BoundaryCore_>
1740 typename BoundaryCore::spline_type::value_type
rtol =
1741 typename BoundaryCore::spline_type::value_type{1
e-5},
1742 typename BoundaryCore::spline_type::value_type
atol =
1743 typename BoundaryCore::spline_type::value_type{1
e-8})
const {
1744 return isclose_(std::make_index_sequence<BoundaryCore::nsides()>{},
other,
1748#define GENERATE_EXPR_MACRO(r, data, name) \
1750 template <bool memory_optimized = false, size_t... Is, typename... Xi> \
1751 inline auto BOOST_PP_CAT(name, _)(std::index_sequence<Is...>, \
1752 const std::tuple<Xi...> &xi) const { \
1753 return std::tuple( \
1754 std::get<Is>(BoundaryCore::bdr_) \
1755 .template name<memory_optimized>(std::get<Is>(xi))...); \
1758 template <bool memory_optimized = false, size_t... Is, typename... Xi, \
1759 typename... Indices> \
1760 inline auto BOOST_PP_CAT(name, _)(std::index_sequence<Is...>, \
1761 const std::tuple<Xi...> &xi, \
1762 const std::tuple<Indices...> &indices) \
1764 return std::tuple(std::get<Is>(BoundaryCore::bdr_) \
1765 .template name<memory_optimized>( \
1766 std::get<Is>(xi), std::get<Is>(indices))...); \
1769 template <bool memory_optimized = false, size_t... Is, typename... Xi, \
1770 typename... Indices, typename... Coeff_Indices> \
1771 inline auto BOOST_PP_CAT(name, _)( \
1772 std::index_sequence<Is...>, const std::tuple<Xi...> &xi, \
1773 const std::tuple<Indices...> &indices, \
1774 const std::tuple<Coeff_Indices...> &coeff_indices) const { \
1775 return std::tuple(std::get<Is>(BoundaryCore::bdr_) \
1776 .template name<memory_optimized>( \
1777 std::get<Is>(xi), std::get<Is>(indices), \
1778 std::get<Is>(coeff_indices))...); \
1782 template <bool memory_optimized = false, typename... Args> \
1783 inline auto name(const Args &...args) const { \
1784 return BOOST_PP_CAT(name, _)<memory_optimized>( \
1785 std::make_index_sequence<BoundaryCore::nsides()>{}, args...); \
1792#undef GENERATE_EXPR_MACRO
1794#define GENERATE_IEXPR_MACRO(r, data, name) \
1796 template <bool memory_optimized = false, size_t... Is, typename... Geometry, \
1798 inline auto BOOST_PP_CAT(name, _)(std::index_sequence<Is...>, \
1799 const std::tuple<Geometry...> &G, \
1800 const std::tuple<Xi...> &xi) const { \
1801 return std::tuple(std::get<Is>(BoundaryCore::bdr_) \
1802 .template name<memory_optimized>( \
1803 std::get<Is>(G), std::get<Is>(xi))...); \
1806 template <bool memory_optimized = false, size_t... Is, typename... Geometry, \
1807 typename... Xi, typename... Indices> \
1808 inline auto BOOST_PP_CAT(name, _)( \
1809 std::index_sequence<Is...>, const std::tuple<Geometry...> &G, \
1810 const std::tuple<Xi...> &xi, const std::tuple<Indices...> &indices) \
1812 return std::tuple( \
1813 std::get<Is>(BoundaryCore::bdr_) \
1814 .template name<memory_optimized>( \
1815 std::get<Is>(G), std::get<Is>(xi), std::get<Is>(indices))...); \
1818 template <bool memory_optimized = false, size_t... Is, typename... Geometry, \
1819 typename... Xi, typename... Indices, typename... Coeff_Indices> \
1820 inline auto BOOST_PP_CAT(name, _)( \
1821 std::index_sequence<Is...>, const std::tuple<Geometry...> &G, \
1822 const std::tuple<Xi...> &xi, const std::tuple<Indices...> &indices, \
1823 const std::tuple<Coeff_Indices...> &coeff_indices) const { \
1824 return std::tuple(std::get<Is>(BoundaryCore::bdr_) \
1825 .template name<memory_optimized>( \
1826 std::get<Is>(G), std::get<Is>(xi), \
1827 std::get<Is>(indices), \
1828 std::get<Is>(coeff_indices))...); \
1832 template <bool memory_optimized = false, typename... Args> \
1833 inline auto name(const Args &...args) const { \
1834 return BOOST_PP_CAT(name, _)<memory_optimized>( \
1835 std::make_index_sequence<BoundaryCore::nsides()>{}, args...); \
1842#undef GENERATE_IEXPR_MACRO
1848 return std::make_tuple(
bspline.device()...);
1850 BoundaryCore::bdr_);
1857 return std::make_tuple(
bspline.device_index()...);
1859 BoundaryCore::bdr_);
1866 return std::make_tuple(
bspline.dtype()...);
1868 BoundaryCore::bdr_);
1875 return std::make_tuple(
bspline.layout()...);
1877 BoundaryCore::bdr_);
1884 return std::make_tuple(
bspline.requires_grad()...);
1886 BoundaryCore::bdr_);
1893 return std::make_tuple(
bspline.pinned_memory()...);
1895 BoundaryCore::bdr_);
1902 return std::make_tuple(
bspline.is_sparse()...);
1904 BoundaryCore::bdr_);
1911 return std::make_tuple(
bspline.is_uniform()...);
1913 BoundaryCore::bdr_);
1920 return std::make_tuple(
bspline.is_nonuniform()...);
1922 BoundaryCore::bdr_);
1931 BoundaryCore::bdr_);
1939 decltype(
typename BoundaryCore::spline_type{}.to(options)),
1940 BoundaryCore::spline_type::parDim()>>;
1942 return boundary_type(std::apply(
1943 [&options](
const auto &...
bspline) {
1944 return std::make_tuple(
bspline.to(options)...);
1946 BoundaryCore::bdr_));
1955 BoundaryCore::bdr_));
1959 template <
typename real_t>
inline auto to()
const {
1961 decltype(
typename BoundaryCore::spline_type{}.template
to<real_t>()),
1962 BoundaryCore::spline_type::parDim()>>;
1964 return boundary_type(std::apply(
1968 BoundaryCore::bdr_));
1973template <
typename Spline>
1977template <
typename Spline>
1979 obj.pretty_print(
os);
#define GENERATE_IEXPR_MACRO(r, data, name)
Auto-generated functions.
Definition boundary.hpp:1794
#define GENERATE_EXPR_MACRO(r, data, name)
Definition boundary.hpp:1748
#define GENERATE_EXPR_SEQ
Sequence of expression (parametric coordinates)
Definition bspline.hpp:41
#define GENERATE_IEXPR_SEQ
Sequence of expression (physical coordinates)
Definition bspline.hpp:47
Boundary (common high-level functionality)
Definition boundary.hpp:1141
auto find_knot_indices(const std::tuple< Xi... > &xi) const
Returns the knot indicies of knot spans containing xi
Definition boundary.hpp:1367
auto to(torch::Device device) const
Returns a copy of the boundary object with settings from device.
Definition boundary.hpp:1950
auto dtype() const noexcept
Returns the dtype property of all splines.
Definition boundary.hpp:1863
auto eval_from_precomputed(const std::tuple< Basfunc... > &basfunc, const std::tuple< Coeff_Indices... > &coeff_indices, const std::tuple< Numeval... > &numeval, const std::tuple< Sizes... > &sizes) const
Returns the value of the spline objects from precomputed basis function.
Definition boundary.hpp:1329
auto pinned_memory() const noexcept
Returns the pinned_memory property of all splines.
Definition boundary.hpp:1890
bool isequal_(std::index_sequence< Is... >, const BoundaryCommon< BoundaryCore_ > &other) const
Returns true if both boundary spline objects are the same.
Definition boundary.hpp:1698
auto eval_basfunc(const std::tuple< Xi... > &xi) const
Returns the values of the spline objects' basis functions in the points xi
Definition boundary.hpp:1401
torch::serialize::InputArchive & read(torch::serialize::InputArchive &archive, const std::string &key="boundary")
Loads the boundary spline object from a torch::serialize::InputArchive object.
Definition boundary.hpp:1618
auto eval(const std::tuple< Xi... > &xi) const
Returns the values of the spline objects in the points xi
Definition boundary.hpp:1263
auto eval_from_precomputed_(std::index_sequence< Is... >, const std::tuple< Basfunc... > &basfunc, const std::tuple< Coeff_Indices... > &coeff_indices, const std::tuple< Numeval... > &numeval, const std::tuple< Sizes... > &sizes) const
Returns the value of the boundary spline objects from precomputed basis function.
Definition boundary.hpp:1296
auto to() const
Returns a copy of the boundary object with real_t type.
Definition boundary.hpp:1959
bool isclose_(std::index_sequence< Is... >, const BoundaryCommon< BoundaryCore_ > &other, typename BoundaryCore::spline_type::value_type rtol, typename BoundaryCore::spline_type::value_type atol) const
Returns true if both boundary spline objects are close up to the given tolerances.
Definition boundary.hpp:1725
auto to(Options< real_t > options) const
Returns a copy of the boundary object with settings from options.
Definition boundary.hpp:1937
auto device_index() const noexcept
Returns the device_index property of all splines.
Definition boundary.hpp:1854
auto is_uniform() const noexcept
Returns true if the B-spline is uniform of all splines.
Definition boundary.hpp:1908
BoundaryCommon & from_xml(const pugi::xml_document &doc, int id=0, std::string label="", int index=-1)
Updates the boundary object from XML object.
Definition boundary.hpp:1660
torch::Tensor as_tensor_(std::index_sequence< Is... >) const
Returns all coefficients of all spline objects as a single tensor.
Definition boundary.hpp:1155
int64_t as_tensor_size_(std::index_sequence< Is... >) const
Returns the size of the single tensor representation of all spline objects.
Definition boundary.hpp:1174
auto eval_basfunc_(std::index_sequence< Is... >, const std::tuple< Xi... > &xi) const
Returns the values of the boundary spline spline object's basis functions in the points xi
Definition boundary.hpp:1378
auto find_knot_indices_(std::index_sequence< Is... >, const std::tuple< Xi... > &xi) const
Returns the knot indicies of boundary spline object's knot spans containing xi
Definition boundary.hpp:1358
auto & uniform_refine_(std::index_sequence< Is... >, int numRefine=1, int dim=-1)
Returns the boundary spline object with uniformly refined knot and coefficient vectors.
Definition boundary.hpp:1440
torch::serialize::OutputArchive & write_(std::index_sequence< Is... >, torch::serialize::OutputArchive &archive, const std::string &key="boundary") const
Writes the boundary spline object into a torch::serialize::OutputArchive object.
Definition boundary.hpp:1568
pugi::xml_document to_xml(int id=0, std::string label="", int index=-1) const
Returns the boundary object as XML object.
Definition boundary.hpp:1625
auto is_nonuniform() const noexcept
Returns true if the B-spline is non-uniform if all splines.
Definition boundary.hpp:1917
BoundaryCommon & from_xml(const pugi::xml_node &root, int id=0, std::string label="", int index=-1)
Updates the boundary object from XML node.
Definition boundary.hpp:1666
auto eval_(std::index_sequence< Is... >, const std::tuple< Xi... > &xi, const std::tuple< Indices... > &indices, const std::tuple< Coeff_Indices... > &coeff_indices) const
Returns the values of the boundary spline objects in the points xi
Definition boundary.hpp:1248
auto find_coeff_indices(const std::tuple< Indices... > &indices) const
Returns the indices of the spline objects' coefficients corresponding to the knot indices indices
Definition boundary.hpp:1431
auto requires_grad() const noexcept
Returns the requires_grad property of all splines.
Definition boundary.hpp:1881
auto eval(const std::tuple< Xi... > &xi, const std::tuple< Indices... > &indices) const
Returns the values of the spline objects in the points xi
Definition boundary.hpp:1270
BoundaryCommon clone() const
Returns a clone of the boundary object.
Definition boundary.hpp:1147
auto eval_basfunc(const std::tuple< Xi... > &xi, const std::tuple< Indices... > &indices) const
Returns the values of the spline objects' basis functions in the points xi
Definition boundary.hpp:1408
auto & from_tensor(const torch::Tensor &tensor)
Sets the coefficients of all spline objects from a single tensor.
Definition boundary.hpp:1219
auto & from_tensor_(std::index_sequence< Is... >, const torch::Tensor &tensor)
Sets the coefficients of all spline objects from a single tensor.
Definition boundary.hpp:1197
auto eval(const std::tuple< Xi... > &xi, const std::tuple< Indices... > &indices, const std::tuple< Coeff_Indices... > &coeff_indices) const
Returns the values of the spline objects in the points xi
Definition boundary.hpp:1279
void load(const std::string &filename, const std::string &key="boundary")
Loads the boundary spline object from file.
Definition boundary.hpp:1608
torch::Tensor as_tensor() const
Returns all coefficients of all spline objects as a single tensor.
Definition boundary.hpp:1164
auto eval_basfunc_(std::index_sequence< Is... >, const std::tuple< Xi... > &xi, const std::tuple< Indices... > &indices) const
Returns the values of the boundary spline spline object's basis functions in the points xi
Definition boundary.hpp:1387
BoundaryCommon & set_requires_grad(bool requires_grad)
Sets the boundary object's requires_grad property.
Definition boundary.hpp:1926
auto eval_(std::index_sequence< Is... >, const std::tuple< Xi... > &xi) const
Returns the values of the boundary spline objects in the points xi
Definition boundary.hpp:1229
pugi::xml_node & to_xml(pugi::xml_node &root, int id=0, std::string label="", int index=-1) const
Returns the boundary object as XML node.
Definition boundary.hpp:1635
bool isclose(const BoundaryCommon< BoundaryCore_ > &other, typename BoundaryCore::spline_type::value_type rtol=typename BoundaryCore::spline_type::value_type{1e-5}, typename BoundaryCore::spline_type::value_type atol=typename BoundaryCore::spline_type::value_type{1e-8}) const
Returns true if both boundary objects are close up to the given tolerances.
Definition boundary.hpp:1739
auto & uniform_refine(int numRefine=1, int dim=-1)
Returns the spline objects with uniformly refined knot and coefficient vectors.
Definition boundary.hpp:1449
auto eval_from_precomputed_(std::index_sequence< Is... >, const std::tuple< Basfunc... > &basfunc, const std::tuple< Coeff_Indices... > &coeff_indices, const std::tuple< Xi... > &xi) const
Returns the value of the boundary spline objects from precomputed basis function.
Definition boundary.hpp:1311
int64_t as_tensor_size() const
Returns the size of the single tensor representation of all spline objects.
Definition boundary.hpp:1185
auto eval_from_precomputed(const std::tuple< Basfunc... > &basfunc, const std::tuple< Coeff_Indices... > &coeff_indices, const std::tuple< Xi... > &xi) const
Returns the value of the spline objects from precomputed basis function.
Definition boundary.hpp:1343
bool operator==(const BoundaryCommon< BoundaryCore_ > &other) const
Returns true if both boundary objects are the same.
Definition boundary.hpp:1708
auto find_coeff_indices_(std::index_sequence< Is... >, const std::tuple< Indices... > &indices) const
Returns the indices of the boundary spline object's coefficients corresponding to the knot indices in...
Definition boundary.hpp:1420
auto layout() const noexcept
Returns the layout property of all splines.
Definition boundary.hpp:1872
torch::serialize::OutputArchive & write(torch::serialize::OutputArchive &archive, const std::string &key="boundary") const
Writes the boundary spline object into a torch::serialize::OutputArchive object.
Definition boundary.hpp:1587
torch::serialize::InputArchive & read_(std::index_sequence< Is... >, torch::serialize::InputArchive &archive, const std::string &key="boundary")
Loads the function space object from a torch::serialize::InputArchive object.
Definition boundary.hpp:1598
auto eval_(std::index_sequence< Is... >, const std::tuple< Xi... > &xi, const std::tuple< Indices... > &indices) const
Returns the values of the boundary spline objects in the points xi
Definition boundary.hpp:1238
void save(const std::string &filename, const std::string &key="boundary") const
Saves the boundary spline to file.
Definition boundary.hpp:1578
auto device() const noexcept
Auto-generated functions.
Definition boundary.hpp:1845
bool operator!=(const BoundaryCommon< BoundaryCore_ > &other) const
Returns true if both boundary objects are different.
Definition boundary.hpp:1714
auto is_sparse() const noexcept
Returns if the layout is sparse of all splines.
Definition boundary.hpp:1899
constexpr auto & side() const
Returns constant reference to side-th Spline.
Definition boundary.hpp:149
BoundaryCore(const std::array< int64_t, 1 > &, enum init init=init::zeros, Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Constructor.
Definition boundary.hpp:105
std::tuple< boundary_spline_type, boundary_spline_type > bdr_
Tuple of splines.
Definition boundary.hpp:75
std::tuple< torch::Tensor, torch::Tensor > eval_type
Evaluation type.
Definition boundary.hpp:82
BoundaryCore(const BoundaryCore &other, bool clone)
Copy/clone constructor.
Definition boundary.hpp:96
BoundaryCore(const boundary_type &bdr_)
Copy constructor.
Definition boundary.hpp:90
BoundaryCore(const std::array< std::vector< typename Spline::value_type >, 1 > &, enum init init=init::zeros, Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Constructor.
Definition boundary.hpp:112
constexpr auto & coeffs() const
Returns a constant reference to the array of coefficients for all boundary segments.
Definition boundary.hpp:162
typename Spline::template derived_self_type< real_t, Spline::geoDim()> real_derived_boundary_spline_type
Deduces the derived boundary spline type when exposed to a different class template parameter real_t
Definition boundary.hpp:72
constexpr auto & coeffs()
Returns a non-constant reference to the array of coefficients for all boundary segments.
Definition boundary.hpp:166
static constexpr short_t nsides()
Returns the number of sides.
Definition boundary.hpp:146
BoundaryCore(Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Default constructor.
Definition boundary.hpp:85
int64_t ncumcoeffs() const
Returns the total number of coefficients.
Definition boundary.hpp:169
BoundaryCore & from_json(const nlohmann::json &json)
Updates the boundary object from JSON object.
Definition boundary.hpp:195
BoundaryCore(boundary_type &&bdr_)
Move constructor.
Definition boundary.hpp:93
constexpr auto & side()
Returns non-constant reference to side-th Spline.
Definition boundary.hpp:155
typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim()> boundary_spline_type
Boundary spline type.
Definition boundary.hpp:66
virtual void pretty_print(std::ostream &os=Log(log::info)) const noexcept override
Returns a string representation of the Boundary object.
Definition boundary.hpp:179
nlohmann::json to_json() const override
Returns the boundary object as JSON object.
Definition boundary.hpp:186
Spline spline_type
Spline type.
Definition boundary.hpp:61
decltype(bdr_) boundary_type
Boundary type.
Definition boundary.hpp:79
eval_type greville() const
Returns the Greville abscissae.
Definition boundary.hpp:203
auto & from_full_tensor(const torch::Tensor &tensor)
Sets the coefficients of all spline objects from a single tensor that holds both boundary and inner c...
Definition boundary.hpp:125
std::tuple< typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim(), Spline::degree(1)>, typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim(), Spline::degree(0)> > boundary_spline_type
Boundary spline type.
Definition boundary.hpp:234
constexpr auto & side()
Returns non-constant reference to the s-th side's spline.
Definition boundary.hpp:383
std::tuple< utils::TensorArray< 1 >, utils::TensorArray< 1 >, utils::TensorArray< 1 >, utils::TensorArray< 1 > > eval_type
Evaluation type.
Definition boundary.hpp:258
static constexpr short_t nsides()
Returns the number of sides.
Definition boundary.hpp:374
eval_type greville() const
Returns the Greville abscissae.
Definition boundary.hpp:439
BoundaryCore(const BoundaryCore &other, bool clone)
Copy/clone constructor.
Definition boundary.hpp:275
nlohmann::json to_json() const override
Returns the boundary object as JSON object.
Definition boundary.hpp:418
constexpr auto & coeffs()
Returns a non-constant reference to the array of coefficients for all boundary segments.
Definition boundary.hpp:394
constexpr auto & coeffs() const
Returns a constant reference to the array of coefficients for all boundary segments.
Definition boundary.hpp:390
BoundaryCore & from_json(const nlohmann::json &json)
Updates the boundary object from JSON object.
Definition boundary.hpp:429
Spline spline_type
Spline type.
Definition boundary.hpp:227
auto & from_full_tensor(const torch::Tensor &tensor)
Sets the coefficients of all spline objects from a single tensor that holds both boundary and inner c...
Definition boundary.hpp:326
virtual void pretty_print(std::ostream &os=Log(log::info)) const noexcept override
Returns a string representation of the Boundary object.
Definition boundary.hpp:409
decltype(bdr_) boundary_type
Boundary type.
Definition boundary.hpp:254
BoundaryCore(Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Default constructor.
Definition boundary.hpp:261
BoundaryCore(const boundary_type &bdr_)
Copy constructor.
Definition boundary.hpp:269
std::tuple< typename Spline::template derived_self_type< real_t, Spline::geoDim(), Spline::degree(1)>, typename Spline::template derived_self_type< real_t, Spline::geoDim(), Spline::degree(0)> > real_derived_boundary_spline_type
Deduces the derived boundary spline type when exposed to a different class template parameter real_t
Definition boundary.hpp:243
BoundaryCore(const std::array< int64_t, 2 > &ncoeffs, enum init init=init::zeros, Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Constructor.
Definition boundary.hpp:284
constexpr auto & side() const
Returns constant reference to the s-th side's spline.
Definition boundary.hpp:377
std::tuple< typename std::tuple_element_t< 0, boundary_spline_type >, typename std::tuple_element_t< 0, boundary_spline_type >, typename std::tuple_element_t< 1, boundary_spline_type >, typename std::tuple_element_t< 1, boundary_spline_type > > bdr_
Tuple of splines.
Definition boundary.hpp:250
int64_t ncumcoeffs() const
Returns the total number of coefficients.
Definition boundary.hpp:397
BoundaryCore(const std::array< std::vector< typename Spline::value_type >, 2 > &kv, enum init init=init::zeros, Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Constructor.
Definition boundary.hpp:298
BoundaryCore(boundary_type &&bdr_)
Move constructor.
Definition boundary.hpp:272
BoundaryCore & from_json(const nlohmann::json &json)
Updates the boundary object from JSON object.
Definition boundary.hpp:735
constexpr auto & side() const
Returns constant reference to side-th spline.
Definition boundary.hpp:677
constexpr auto & coeffs() const
Returns a constant reference to the array of coefficients for all boundary segments.
Definition boundary.hpp:690
BoundaryCore(const std::array< std::vector< typename Spline::value_type >, 3 > &kv, enum init init=init::zeros, Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Constructor.
Definition boundary.hpp:559
BoundaryCore(const boundary_type &bdr_)
Copy constructor.
Definition boundary.hpp:520
decltype(bdr_) boundary_type
Boundary type.
Definition boundary.hpp:502
BoundaryCore(const BoundaryCore &other, bool clone)
Copy/clone constructor.
Definition boundary.hpp:526
Spline spline_type
Spline type.
Definition boundary.hpp:466
std::tuple< typename std::tuple_element_t< 0, boundary_spline_type >, typename std::tuple_element_t< 0, boundary_spline_type >, typename std::tuple_element_t< 1, boundary_spline_type >, typename std::tuple_element_t< 1, boundary_spline_type >, typename std::tuple_element_t< 2, boundary_spline_type >, typename std::tuple_element_t< 2, boundary_spline_type > > bdr_
Tuple of splines.
Definition boundary.hpp:498
std::tuple< typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim(), Spline::degree(1), Spline::degree(2)>, typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim(), Spline::degree(0), Spline::degree(2)>, typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim(), Spline::degree(0), Spline::degree(1)> > boundary_spline_type
Boundary spline type.
Definition boundary.hpp:478
virtual void pretty_print(std::ostream &os=Log(log::info)) const noexcept override
Returns a string representation of the Boundary object.
Definition boundary.hpp:711
constexpr auto & coeffs()
Returns a non-constant reference to the array of coefficients for all boundary segments.
Definition boundary.hpp:694
BoundaryCore(boundary_type &&bdr_)
Move constructor.
Definition boundary.hpp:523
BoundaryCore(Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Default constructor.
Definition boundary.hpp:510
BoundaryCore(const std::array< int64_t, 3 > &ncoeffs, enum init init=init::zeros, Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Constructor.
Definition boundary.hpp:535
int64_t ncumcoeffs() const
Returns the total number of coefficients.
Definition boundary.hpp:697
auto & from_full_tensor(const torch::Tensor &tensor)
Sets the coefficients of all spline objects from a single tensor that holds both boundary and inner c...
Definition boundary.hpp:595
std::tuple< typename Spline::template derived_self_type< real_t, Spline::geoDim(), Spline::degree(1), Spline::degree(2)>, typename Spline::template derived_self_type< real_t, Spline::geoDim(), Spline::degree(0), Spline::degree(2)>, typename Spline::template derived_self_type< real_t, Spline::geoDim(), Spline::degree(0), Spline::degree(1)> > real_derived_boundary_spline_type
Deduces the derived boundary spline type when exposed to a different class template parameter real_t
Definition boundary.hpp:489
nlohmann::json to_json() const override
Returns the boundary object as JSON object.
Definition boundary.hpp:722
constexpr auto & side()
Returns non-constant reference to side-th spline.
Definition boundary.hpp:683
std::tuple< utils::TensorArray< 2 >, utils::TensorArray< 2 >, utils::TensorArray< 2 >, utils::TensorArray< 2 >, utils::TensorArray< 2 >, utils::TensorArray< 2 > > eval_type
Evaluation type.
Definition boundary.hpp:507
static constexpr short_t nsides()
Returns the number of sides.
Definition boundary.hpp:674
eval_type greville() const
Returns the Greville abscissae.
Definition boundary.hpp:747
BoundaryCore(const std::array< int64_t, 4 > &ncoeffs, enum init init=init::zeros, Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Constructor.
Definition boundary.hpp:860
constexpr auto & side()
Returns non-constant reference to side-th spline.
Definition boundary.hpp:1043
BoundaryCore & from_json(const nlohmann::json &json)
Updates the boundary object from JSON object.
Definition boundary.hpp:1101
auto & from_full_tensor(const torch::Tensor &tensor)
Sets the coefficients of all spline objects from a single tensor that holds both boundary and inner c...
Definition boundary.hpp:934
eval_type greville() const
Returns the Greville abscissae.
Definition boundary.hpp:1115
int64_t ncumcoeffs() const
Returns the total number of coefficients.
Definition boundary.hpp:1057
std::tuple< typename std::tuple_element_t< 0, boundary_spline_type >, typename std::tuple_element_t< 0, boundary_spline_type >, typename std::tuple_element_t< 1, boundary_spline_type >, typename std::tuple_element_t< 1, boundary_spline_type >, typename std::tuple_element_t< 2, boundary_spline_type >, typename std::tuple_element_t< 2, boundary_spline_type >, typename std::tuple_element_t< 3, boundary_spline_type >, typename std::tuple_element_t< 3, boundary_spline_type > > bdr_
Tuple of splines.
Definition boundary.hpp:820
BoundaryCore(boundary_type &&bdr_)
Move constructor.
Definition boundary.hpp:848
virtual void pretty_print(std::ostream &os=Log(log::info)) const noexcept override
Returns a string representation of the Boundary object.
Definition boundary.hpp:1073
static constexpr short_t nsides()
Returns the number of sides.
Definition boundary.hpp:1034
std::tuple< utils::TensorArray< 3 >, utils::TensorArray< 3 >, utils::TensorArray< 3 >, utils::TensorArray< 3 >, utils::TensorArray< 3 >, utils::TensorArray< 3 >, utils::TensorArray< 3 >, utils::TensorArray< 3 > > eval_type
Evaluation type.
Definition boundary.hpp:830
BoundaryCore(const BoundaryCore &other, bool clone)
Copy/clone constructor.
Definition boundary.hpp:851
constexpr auto & coeffs()
Returns a non-constant reference to the array of coefficients for all boundary segments.
Definition boundary.hpp:1054
Spline spline_type
Spline type.
Definition boundary.hpp:777
BoundaryCore(const boundary_type &bdr_)
Copy constructor.
Definition boundary.hpp:845
constexpr auto & side() const
Returns constant reference to side-th spline.
Definition boundary.hpp:1037
BoundaryCore(const std::array< std::vector< typename Spline::value_type >, 4 > &kv, enum init init=init::zeros, Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Constructor.
Definition boundary.hpp:890
std::tuple< typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim(), Spline::degree(1), Spline::degree(2), Spline::degree(3)>, typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim(), Spline::degree(0), Spline::degree(2), Spline::degree(3)>, typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim(), Spline::degree(0), Spline::degree(1), Spline::degree(3)>, typename Spline::template derived_self_type< typename Spline::value_type, Spline::geoDim(), Spline::degree(0), Spline::degree(1), Spline::degree(2)> > boundary_spline_type
Array storing the degrees.
Definition boundary.hpp:792
nlohmann::json to_json() const override
Returns the boundary object as JSON object.
Definition boundary.hpp:1086
BoundaryCore(Options< typename Spline::value_type > options=Options< typename Spline::value_type >{})
Default constructor.
Definition boundary.hpp:833
decltype(bdr_) boundary_type
Boundary type.
Definition boundary.hpp:824
std::tuple< typename Spline::template derived_self_type< real_t, Spline::geoDim(), Spline::degree(1), Spline::degree(2), Spline::degree(3)>, typename Spline::template derived_self_type< real_t, Spline::geoDim(), Spline::degree(0), Spline::degree(2), Spline::degree(3)>, typename Spline::template derived_self_type< real_t, Spline::geoDim(), Spline::degree(0), Spline::degree(1), Spline::degree(3)>, typename Spline::template derived_self_type< real_t, Spline::geoDim(), Spline::degree(0), Spline::degree(1), Spline::degree(2)> > real_derived_boundary_spline_type
Deduces the derived boundary spline type when exposed to a different class template parameter real_t
Definition boundary.hpp:809
constexpr auto & coeffs() const
Returns a constant reference to the array of coefficients for all boundary segments.
Definition boundary.hpp:1050
BoundaryCore.
Definition boundary.hpp:42
The Options class handles the automated determination of dtype from the template argument and the sel...
Definition options.hpp:90
Boundary type.
Definition boundary.hpp:1127
Full qualified name descriptor.
Definition fqn.hpp:26
std::array< torch::Tensor, N > TensorArray
Definition tensorarray.hpp:28
Definition boundary.hpp:22
deriv
Enumerator for specifying the derivative of B-spline evaluation.
Definition bspline.hpp:74
constexpr bool is_SplineType_v
Alias to the value of is_SplineType.
Definition bspline.hpp:3243
std::ostream & operator<<(std::ostream &os, const Boundary< Spline > &obj)
Print (as string) a Boundary object.
Definition boundary.hpp:1978
struct iganet::@0 Log
Logger.
init
Enumerator for specifying the initialization of B-spline coefficients.
Definition bspline.hpp:55
std::conjunction< std::is_base_of< detail::BoundaryType, T >... > is_BoundaryType
Type trait to check if T is a valid Boundary type.
Definition boundary.hpp:1133
constexpr bool is_BoundaryType_v
Alias to the value of is_BoundaryType.
Definition boundary.hpp:1137
side
Identifiers for topological sides.
Definition boundary.hpp:25
@ stime
Definition boundary.hpp:32
@ down
Definition boundary.hpp:36
@ right
Definition boundary.hpp:35
@ left
Definition boundary.hpp:34
@ back
Definition boundary.hpp:31
@ east
Definition boundary.hpp:27
@ etime
Definition boundary.hpp:33
@ front
Definition boundary.hpp:30
@ north
Definition boundary.hpp:29
@ south
Definition boundary.hpp:28
@ west
Definition boundary.hpp:26
@ up
Definition boundary.hpp:37
@ none
Definition boundary.hpp:38
short int short_t
Definition core.hpp:74
Serialization prototype.
Definition serialize.hpp:31