SimiLie
Loading...
Searching...
No Matches
codifferential.hpp
1// SPDX-FileCopyrightText: 2024 Baptiste Legouix
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4#pragma once
5
6#include <array>
7#include <optional>
8#include <utility>
9
10#include <ddc/ddc.hpp>
11
12#include <similie/exterior/coboundary/coboundary.hpp>
13#include <similie/exterior/cochain.hpp>
14#include <similie/exterior/concepts.hpp>
15#include <similie/exterior/continuous_hodge_star/continuous_hodge_star.hpp>
16#include <similie/exterior/cosimplex.hpp>
17#include <similie/exterior/stencil.hpp>
18#include <similie/misc/domain_contains.hpp>
19#include <similie/misc/macros.hpp>
20#include <similie/misc/specialization.hpp>
21#include <similie/misc/type_seq_ext.hpp>
22#include <similie/tensor/tensor_impl.hpp>
23#include <similie/tensor/tensor_indices/character.hpp>
24
25#include <Kokkos_StdAlgorithms.hpp>
26
27
28namespace sil {
29
30namespace exterior {
31
32namespace detail {
33
34template <class T>
35struct CodifferentialType;
36
37template <
38 std::size_t K,
39 class... Tag,
40 class ElementType,
41 class LayoutStridedPolicy1,
42 class LayoutStridedPolicy2,
43 class ExecSpace>
44struct CodifferentialType<
45 Cochain<Chain<Simplex<K, Tag...>, LayoutStridedPolicy1, ExecSpace>,
46 ElementType,
47 LayoutStridedPolicy2>>
48{
49 using type = Cosimplex<Simplex<K - 1, Tag...>, ElementType>;
50};
51
52} // namespace detail
53
54template <misc::Specialization<Cochain> CochainType>
55using codifferential_t = typename detail::CodifferentialType<CochainType>::type;
56
57namespace detail {
58
59template <class TagToRemoveFromCochain, class CochainTag>
60struct CodifferentialIndex;
61
62template <tensor::TensorNatIndex TagToRemoveFromCochain, tensor::TensorNatIndex CochainTag>
63 requires(CochainTag::rank() == 1 && std::is_same_v<TagToRemoveFromCochain, CochainTag>)
64struct CodifferentialIndex<TagToRemoveFromCochain, CochainTag>
65{
67};
68
69template <tensor::TensorNatIndex TagToRemoveFromCochain, tensor::TensorNatIndex Tag>
70struct CodifferentialIndex<
71 TagToRemoveFromCochain,
72 tensor::TensorAntisymmetricIndex<TagToRemoveFromCochain, Tag>>
73{
74 using type = Tag;
75};
76
77template <tensor::TensorNatIndex TagToRemoveFromCochain, tensor::TensorNatIndex... Tag>
78 requires(sizeof...(Tag) > 1)
79struct CodifferentialIndex<
80 TagToRemoveFromCochain,
82{
83 using type = tensor::TensorAntisymmetricIndex<Tag...>;
84};
85
86} // namespace detail
87
88template <class TagToRemoveFromCochain, class CochainTag>
90 typename detail::CodifferentialIndex<TagToRemoveFromCochain, CochainTag>::type;
91
92namespace detail {
93
94template <
95 tensor::TensorNatIndex TagToRemoveFromCochain,
96 tensor::TensorIndex CochainIndex,
97 CochainType TensorType>
98struct CodifferentialTensorType
99{
101 typename TensorType::element_type,
102 ddc::replace_dim_of_t<
103 typename TensorType::discrete_domain_type,
104 CochainIndex,
106 typename TensorType::layout_type,
107 typename TensorType::memory_space>>;
108};
109
110} // namespace detail
111
112template <
113 tensor::TensorNatIndex TagToRemoveFromCochain,
114 tensor::TensorIndex CochainTag,
115 CochainType TensorType>
116using codifferential_tensor_t = typename detail::
117 CodifferentialTensorType<TagToRemoveFromCochain, CochainTag, TensorType>::type;
118
119
120template <class... Args>
122
131template <tensor::TensorNatIndex TagToRemoveFromCochain, tensor::TensorIndex CochainTag>
132struct Codifferential<TagToRemoveFromCochain, CochainTag>
133{
134 template <
135 CochainType Output,
136 class DualEvaluator,
137 class InverseHodge,
138 class Chain,
139 class LowerChain,
140 class Element>
141 KOKKOS_FUNCTION static void operator()(
142 Output output,
143 DualEvaluator const& evaluate_dual,
144 InverseHodge const& inverse_hodge,
145 Chain const& chain,
146 LowerChain const& lower_chain,
147 Element elem)
148 {
149 using DualIndices = codifferential_hodge_output_indices_t<
150 TagToRemoveFromCochain::size() - CochainTag::rank(),
151 TagToRemoveFromCochain>;
152 using DualIndex
154 using TargetIndex = misc::convert_type_seq_to_t<
156 ddc::type_seq_merge_t<ddc::TypeSeq<TagToRemoveFromCochain>, DualIndices>>;
157 auto dual = detail::make_stencil<typename Output::memory_space, TargetIndex>(
158 ddc::DiscreteElement<>());
160 ::sil::exterior::Cochain(tensor::Tensor(dual.span_view())),
161 evaluate_dual,
162 chain,
163 lower_chain,
164 elem);
165 inverse_hodge(output, ::sil::exterior::Cochain(tensor::Tensor(dual.span_view())), elem);
166 if constexpr ((TagToRemoveFromCochain::size() * (CochainTag::rank() + 1) + 1) % 2 == 1)
167 output *= -1;
168 }
169
173 template <class Geometry, CochainType Field, class Element, class Rules>
174 requires requires(Geometry const& geometry) {
175 geometry.forward;
176 geometry.inverse;
177 }
178 KOKKOS_FORCEINLINE_FUNCTION static auto value(
179 Geometry const& geometry,
180 Field const& input,
181 Element element,
182 Rules const& rules)
183 {
184 using Memory = typename Field::memory_space;
185 using Domain = typename Field::non_indices_domain_t;
186 using DualIndex = typename Geometry::DualIndex;
187 return detail::operator_stencil<
188 TagToRemoveFromCochain,
189 CochainTag,
191 1>(input.non_indices_domain(), element, [&](auto evaluate) {
192 auto evaluate_dual = [&](auto sample, auto component) {
193 auto primal = detail::make_stencil<Memory, CochainTag>(ddc::DiscreteElement<>());
194 auto dual = detail::make_stencil<Memory, DualIndex>(ddc::DiscreteElement<>());
195 ddc::device_for_each(primal.domain(), [&](auto source) {
196 primal.mem(source) = evaluate(sample, source);
197 });
198 geometry.forward(
199 ::sil::exterior::Cochain(tensor::Tensor(dual.span_view())),
200 ::sil::exterior::Cochain(tensor::Tensor(primal.span_view())),
201 geometry.metric,
202 geometry.position,
203 sample);
204 return dual.mem(component);
205 };
206 detail::StencilField<DualIndex, Domain, Memory, decltype(evaluate_dual)> const
207 dual(input.non_indices_domain(), evaluate_dual);
208 auto const boundary = [&] {
210 return rules;
211 else
212 return tensor::make_extrapolation_rules(dual, rules);
213 }();
214 auto output = detail::make_stencil<
215 Memory,
217 ddc::DiscreteElement<>());
218 operator()(
219 ::sil::exterior::Cochain(tensor::Tensor(output.span_view())),
220 [&](auto sample, auto component) {
221 return boundary(dual, sample).mem(component);
222 },
223 [&](auto result, auto derivative, auto sample) {
224 geometry.inverse(
225 result,
226 derivative,
227 geometry.metric,
228 geometry.position,
229 sample);
230 },
231 geometry.chain,
232 geometry.lower,
233 element);
234 return output;
235 });
236 }
237
242 template <class DualField, class InverseHodge, class Element>
243 requires(CochainTag::rank() == 1)
244 KOKKOS_FUNCTION static auto value(
245 DualField const&,
246 InverseHodge const& inverse_hodge,
247 Element elem)
248 {
249 using DualIndex = misc::convert_type_seq_to_t<
252 TagToRemoveFromCochain::size() - 1,
253 TagToRemoveFromCochain>>;
254 using TopIndex = misc::convert_type_seq_to_t<
256 ddc::type_seq_merge_t<
257 ddc::TypeSeq<TagToRemoveFromCochain>,
259 TagToRemoveFromCochain::size() - 1,
260 TagToRemoveFromCochain>>>;
261 using ChainDomain = typename detail::NonSpectatorDimension<
262 TagToRemoveFromCochain,
263 typename DualField::non_indices_domain_t>::type;
264 auto const chain = tangent_basis<
265 TagToRemoveFromCochain::size(),
266 ChainDomain,
267 typename DualField::memory_space>(typename ChainDomain::discrete_element_type {});
268 auto const lower = tangent_basis<
269 TagToRemoveFromCochain::size() - 1,
270 ChainDomain,
271 typename DualField::memory_space>(typename ChainDomain::discrete_element_type {});
272 // Build incidence at a positive local origin, independently of physical
273 // coordinates, so a domain's first node never wraps the stencil front.
274 Element origin = elem;
275 for (std::size_t axis = 0; axis < TagToRemoveFromCochain::size(); ++axis) {
276 ddc::detail::array(origin)[axis] = 2;
277 }
279 value(chain,
280 lower,
281 origin,
284 ddc::DiscreteElement<TopIndex>(0))));
285 auto unit = detail::make_stencil<typename DualField::memory_space, TopIndex>(
286 ddc::DiscreteElement<>());
287 unit.mem(ddc::DiscreteElement<TopIndex>(0)) = 1.0;
288 double const scale = -inverse_hodge.inverse_zero_form(
289 ::sil::exterior::Cochain(tensor::Tensor(unit.span_view())),
290 elem);
291 auto result = detail::make_stencil<typename DualField::memory_space, DualIndex>(Element {});
292 for (std::size_t i = 0; i < result.storage().size(); ++i)
293 result.storage()[i] = scale * incidence.storage()[i];
294 return result;
295 }
296
297 template <class DualField, class DualRules, class InverseHodge, class Element>
298 requires requires { typename DualField::non_indices_domain_t; }
299 KOKKOS_FUNCTION static auto value(
300 DualField const& dual_field,
301 DualRules const& dual_rules,
302 InverseHodge const& inverse_hodge,
303 Element elem)
304 {
305 auto const rules = [&] {
307 return dual_rules;
308 else
309 return tensor::make_extrapolation_rules(dual_field, dual_rules);
310 }();
311 using ChainDomain = typename detail::NonSpectatorDimension<
312 TagToRemoveFromCochain,
313 typename DualField::non_indices_domain_t>::type;
314 auto const chain = tangent_basis<
315 TagToRemoveFromCochain::size() - CochainTag::rank() + 1,
316 ChainDomain,
317 typename DualField::memory_space>(typename ChainDomain::discrete_element_type {});
318 auto const lower = tangent_basis<
319 TagToRemoveFromCochain::size() - CochainTag::rank(),
320 ChainDomain,
321 typename DualField::memory_space>(typename ChainDomain::discrete_element_type {});
322 auto output = detail::make_stencil<
323 typename DualField::memory_space,
325 ddc::DiscreteElement<>());
326 operator()(
327 ::sil::exterior::Cochain(tensor::Tensor(output.span_view())),
328 [&](auto sample, auto component) {
329 return rules(dual_field, sample).mem(component);
330 },
331 inverse_hodge,
332 chain,
333 lower,
334 elem);
335 return output;
336 }
337};
338
339namespace detail {
340template <
341 class Index,
342 class Cochain,
343 class Tensor,
344 class Metric,
345 class Position,
346 template <CellComplex, class, class, class, class, class> class Hodge = DiscreteHodgeStar>
347struct CodifferentialGeometry;
348} // namespace detail
349
350template <
351 tensor::TensorIndex MetricIndex,
352 tensor::TensorNatIndex TagToRemoveFromCochain,
353 tensor::TensorIndex CochainTag,
354 CochainType TensorType,
355 misc::Specialization<tensor::Tensor> MetricType,
356 misc::Specialization<tensor::Tensor> PositionType>
358 MetricIndex,
359 TagToRemoveFromCochain,
360 CochainTag,
361 TensorType,
362 MetricType,
363 PositionType>
364{
365 using staged_storage_type = detail::LinearSpatialOperatorStorage<
367 TagToRemoveFromCochain,
368 CochainTag,
370 1,
371 TensorType>;
372
373 template <class Exec>
374 static auto geometry(Exec const& exec, MetricType const& metric, PositionType const& position)
375 {
376 return detail::CodifferentialGeometry<
377 TagToRemoveFromCochain,
378 CochainTag,
379 TensorType,
380 MetricType,
381 PositionType>(exec, metric, position);
382 }
383
384 template <class Geometry, class Element, class Rules>
385 KOKKOS_FUNCTION static auto value(
386 Geometry const& geometry,
387 TensorType const& input,
388 Element element,
389 Rules const& rules)
390 {
392 value(geometry, input, element, rules);
393 }
394
395 template <class ChainType, class LowerChainType, class NaturalElem>
396 KOKKOS_FUNCTION static auto value(
397 TensorType const& tensor,
398 MetricType const& metric,
399 PositionType const& position,
400 ChainType const& chain,
401 LowerChainType const& lower_chain,
402 typename TensorType::non_indices_domain_t::discrete_element_type elem,
403 NaturalElem natural_elem)
404 {
405 auto stencil = detail::make_stencil<typename TensorType::memory_space, CochainTag>(
406 detail::backward_stencil_front(elem, tensor.non_indices_domain()));
407 ddc::device_for_each(stencil.domain(), [&](auto stencil_elem) {
408 auto basis_stencil
409 = detail::make_stencil<typename TensorType::memory_space, CochainTag>(
410 stencil.non_indices_domain().front());
411 basis_stencil.mem(stencil_elem) = 1.0;
412
413 [[maybe_unused]] tensor::TensorAccessor<
414 codifferential_index_t<TagToRemoveFromCochain, CochainTag>>
415 codifferential_accessor;
416 std::array<
417 double,
418 codifferential_index_t<TagToRemoveFromCochain, CochainTag>::mem_size()>
419 codifferential_alloc {};
420 ddc::ChunkSpan<
421 double,
423 Kokkos::layout_right,
424 typename TensorType::memory_space>
425 codifferential_span(
426 codifferential_alloc.data(),
427 codifferential_accessor.domain());
428 ::sil::exterior::Cochain codifferential_tensor {
429 sil::tensor::Tensor(codifferential_span)};
430
431 operator()(
432 codifferential_tensor,
433 ::sil::exterior::Cochain(tensor::Tensor(basis_stencil.span_view())),
434 metric,
435 position,
436 chain,
437 lower_chain,
438 elem);
439 stencil.mem(stencil_elem) = codifferential_tensor(natural_elem);
440 });
441 return stencil;
442 }
443
444 KOKKOS_FUNCTION static void operator()(
445 CochainType auto codifferential_tensor,
446 TensorType const& tensor,
447 MetricType const& metric,
448 PositionType const& position,
449 auto const& chain,
450 auto const& lower_chain,
451 typename TensorType::non_indices_domain_t::discrete_element_type elem)
452 {
453 using source_hodge_input_indices
455 using source_hodge_output_indices = codifferential_hodge_output_indices_t<
456 TagToRemoveFromCochain::size() - CochainTag::rank(),
457 TagToRemoveFromCochain>;
458 using target_hodge_input_indices = ddc::
459 type_seq_merge_t<ddc::TypeSeq<TagToRemoveFromCochain>, source_hodge_output_indices>;
460 using dual_tensor_index = misc::convert_type_seq_to_t<
462 source_hodge_output_indices>;
463 auto dual_evaluator = [&](auto sampled_elem, auto dual_elem) {
464 if (!misc::domain_contains(tensor.non_indices_domain(), sampled_elem)
465 || !misc::domain_contains(metric.non_indices_domain(), sampled_elem)
466 || !misc::domain_contains(position.non_indices_domain(), sampled_elem)) {
467 return 0.0;
468 }
469 [[maybe_unused]] tensor::TensorAccessor<dual_tensor_index> dual_tensor_accessor;
470 std::array<double, dual_tensor_index::mem_size()> dual_tensor_alloc {};
471 ddc::ChunkSpan<
472 double,
473 ddc::DiscreteDomain<dual_tensor_index>,
474 Kokkos::layout_right,
475 typename TensorType::memory_space>
476 dual_tensor_span(dual_tensor_alloc.data(), dual_tensor_accessor.domain());
477 ::sil::exterior::Cochain dual_tensor {sil::tensor::Tensor(dual_tensor_span)};
478
481 source_hodge_input_indices,
482 source_hodge_output_indices,
483 MetricType,
484 PositionType,
485 typename TensorType::non_indices_domain_t::discrete_element_type> {}
486 .operator()(dual_tensor, tensor[sampled_elem], metric, position, sampled_elem);
487 return dual_tensor.mem(dual_elem);
488 };
489
491 codifferential_tensor,
492 dual_evaluator,
493 [&](auto output, auto dual, auto sample) {
497 ddc::type_seq_remove_t<
499 ddc::TypeSeq<TagToRemoveFromCochain>>,
500 MetricType,
501 PositionType,
502 typename TensorType::non_indices_domain_t::discrete_element_type> {}
503 .operator()(output, dual, metric, position, sample);
504 },
505 chain,
506 lower_chain,
507 elem);
508 }
509};
510
511namespace detail {
512
513template <
514 class Index,
515 class Cochain,
516 class Tensor,
517 class Metric,
518 class Position,
519 template <CellComplex, class, class, class, class, class> class Hodge>
520struct CodifferentialGeometry
521{
523 using DualIndices
524 = codifferential_hodge_output_indices_t<Index::size() - Cochain::rank(), Index>;
525 using InverseSourceIndices = ddc::type_seq_merge_t<ddc::TypeSeq<Index>, DualIndices>;
526 using InverseTargetIndices
527 = ddc::type_seq_remove_t<tensor::lower_t<SourceIndices>, ddc::TypeSeq<Index>>;
529 using Element = typename Tensor::non_indices_domain_t::discrete_element_type;
530 using ChainDomain =
531 typename NonSpectatorDimension<Index, typename Tensor::non_indices_domain_t>::type;
532 Metric metric;
533 Position position;
534 StagedOperator<
535 Hodge<CellComplex::Primal, SourceIndices, DualIndices, Metric, Position, Element>>
536 forward;
537 StagedOperator<
538 Hodge<CellComplex::Primal,
540 InverseTargetIndices,
541 Metric,
542 Position,
543 Element>>
544 inverse;
545 StencilChain<DualIndex::rank() + 1, ChainDomain, typename Tensor::memory_space> chain;
546 StencilChain<DualIndex::rank(), ChainDomain, typename Tensor::memory_space> lower;
547 template <class Exec>
548 CodifferentialGeometry(Exec const& exec, Metric const& metric_, Position const& position_)
549 : metric(metric_)
550 , position(position_)
551 , forward(exec, metric, position)
552 , inverse(exec, metric, position)
553 {
554 }
555};
556
557} // namespace detail
558
567template <
568 tensor::TensorIndex MetricIndex,
569 tensor::TensorNatIndex TagToRemoveFromCochain,
570 tensor::TensorIndex CochainTag,
571 class ExecSpace,
572 CochainType TensorType,
573 misc::Specialization<tensor::Tensor> MetricType,
574 misc::Specialization<tensor::Tensor> PositionType,
575 class Rules = tensor::ZeroExtrapolationRule>
576StagedOperator<
577 Codifferential<
578 MetricIndex,
579 TagToRemoveFromCochain,
580 CochainTag,
581 TensorType,
582 MetricType,
583 PositionType>,
584 typename Codifferential<
585 MetricIndex,
586 TagToRemoveFromCochain,
587 CochainTag,
588 TensorType,
589 MetricType,
590 PositionType>::staged_storage_type::template rebind<ExecSpace>>
592 ExecSpace const& exec_space,
593 TensorType const& tensor,
594 MetricType const& metric,
595 PositionType const& position,
596 Rules const& rules = {})
597{
598 return StagedOperator<
599 Codifferential<
600 MetricIndex,
601 TagToRemoveFromCochain,
602 CochainTag,
603 TensorType,
604 MetricType,
605 PositionType>,
606 typename Codifferential<
607 MetricIndex,
608 TagToRemoveFromCochain,
609 CochainTag,
610 TensorType,
611 MetricType,
612 PositionType>::staged_storage_type::
613 template rebind<ExecSpace>>(exec_space, tensor, metric, position, rules);
614}
615
616template <
617 tensor::TensorIndex MetricIndex,
618 tensor::TensorNatIndex TagToRemoveFromCochain,
619 tensor::TensorIndex CochainTag,
620 CochainType DualTensorType,
621 CochainType TensorType,
622 misc::Specialization<tensor::Tensor> HodgeStarType,
623 misc::Specialization<tensor::Tensor> DualHodgeStarType,
624 class ExecSpace,
625 class DualExtrapolationRule = tensor::ZeroExtrapolationRule>
626 requires(
627 misc::NotSpecialization<DualExtrapolationRule, tensor::Tensor>
628 && !ExteriorFieldType<DualExtrapolationRule>)
630 ExecSpace const& exec_space,
632 codifferential_tensor,
633 TensorType const& tensor,
634 HodgeStarType const& hodge_star,
635 DualHodgeStarType const& dual_hodge_star,
636 DualTensorType const& dual_tensor_buffer,
637 DualExtrapolationRule const& dual_extrapolation = {})
638{
639 auto const dual_extrapolation_rules = [&]() {
641 return dual_extrapolation;
642 else
643 return tensor::make_extrapolation_rules(dual_tensor_buffer, dual_extrapolation);
644 }();
646 using source_hodge_output_indices = codifferential_hodge_output_indices_t<
647 TagToRemoveFromCochain::size() - CochainTag::rank(),
648 TagToRemoveFromCochain>;
649 using dual_tensor_index = misc::
650 convert_type_seq_to_t<tensor::TensorAntisymmetricIndex, source_hodge_output_indices>;
651 using non_spectator_dimensions = typename detail::NonSpectatorDimension<
652 TagToRemoveFromCochain,
653 typename TensorType::non_indices_domain_t>::type;
654 auto const chain
655 = tangent_basis<dual_tensor_index::rank() + 1, non_spectator_dimensions>(exec_space);
656 auto lower_chain
657 = tangent_basis<dual_tensor_index::rank(), non_spectator_dimensions>(exec_space);
658
659 SIMILIE_DEBUG_LOG("similie_apply_first_hodge_star_for_codifferential");
660 ddc::parallel_for_each(
661 "similie_apply_first_hodge_star_for_codifferential",
662 exec_space,
663 dual_tensor_buffer.non_indices_domain(),
664 KOKKOS_LAMBDA(typename TensorType::non_indices_domain_t::discrete_element_type elem) {
665 sil::tensor::tensor_prod(dual_tensor_buffer[elem], tensor[elem], hodge_star[elem]);
666 });
667
668 SIMILIE_DEBUG_LOG("similie_apply_second_hodge_star_for_codifferential");
669 ddc::parallel_for_each(
670 "similie_apply_second_hodge_star_for_codifferential",
671 exec_space,
672 codifferential_tensor.non_indices_domain(),
673 KOKKOS_LAMBDA(typename TensorType::non_indices_domain_t::discrete_element_type elem) {
674 Codifferential<TagToRemoveFromCochain, CochainTag>::operator()(
675 codifferential_tensor[elem],
676 [&](auto sampled_elem, auto dual_elem) {
677 return dual_extrapolation_rules(dual_tensor_buffer, sampled_elem)
678 .mem(dual_elem);
679 },
680 [&](auto output, auto dual, auto sample) {
681 sil::tensor::tensor_prod(output, dual, dual_hodge_star[sample]);
682 },
683 chain,
684 lower_chain,
685 elem);
686 });
687
688 return codifferential_tensor;
689}
690
691template <
692 tensor::TensorIndex MetricIndex,
693 tensor::TensorNatIndex TagToRemoveFromCochain,
694 tensor::TensorIndex CochainTag,
695 CochainType TensorType,
696 misc::Specialization<tensor::Tensor> MetricType,
697 misc::Specialization<tensor::Tensor> PositionType,
698 class ExecSpace,
699 class DualExtrapolationRule = tensor::ZeroExtrapolationRule>
700 requires(
701 misc::NotSpecialization<DualExtrapolationRule, tensor::Tensor>
702 && !ExteriorFieldType<DualExtrapolationRule>)
704 ExecSpace const& exec_space,
706 codifferential_tensor,
707 TensorType const& tensor,
708 MetricType const& metric,
709 PositionType const& position,
710 DualExtrapolationRule const& dual_extrapolation = {})
711{
713 return make_staged_codifferential<MetricIndex, TagToRemoveFromCochain, CochainTag>(
714 exec_space,
715 tensor,
716 metric,
717 position,
718 dual_extrapolation)(codifferential_tensor, tensor);
719}
720
721} // namespace exterior
722
723} // namespace sil
Chain class.
Definition chain.hpp:26
Cochain class.
Definition cochain.hpp:32
KOKKOS_FUNCTION chain_type const & chain() const noexcept
Definition cochain.hpp:134
static KOKKOS_FUNCTION constexpr discrete_domain_type domain()
Simplex(ddc::DiscreteElement< Tag... >, ddc::DiscreteVector< T... >) -> Simplex< sizeof...(T), Tag... >
StagedOperator< Codifferential< MetricIndex, TagToRemoveFromCochain, CochainTag, TensorType, MetricType, PositionType >, typename Codifferential< MetricIndex, TagToRemoveFromCochain, CochainTag, TensorType, MetricType, PositionType >::staged_storage_type::template rebind< ExecSpace > > make_staged_codifferential(ExecSpace const &exec_space, TensorType const &tensor, MetricType const &metric, PositionType const &position, Rules const &rules={})
Cache Codifferential::value() at every input node.
typename detail:: CodifferentialTensorType< TagToRemoveFromCochain, CochainTag, TensorType >::type codifferential_tensor_t
Chain(Head, Tail...) -> Chain< typename Head::value_type, typename Head::array_layout, typename Head::memory_space >
Cochain(Tensor const &) -> Cochain< Tensor >
KOKKOS_FUNCTION Chain< boundary_t< SimplexType >, typename AllocationType::array_layout, typename AllocationType::memory_space > boundary(AllocationType allocation, SimplexType const &simplex)
Definition boundary.hpp:170
codifferential_tensor_t< TagToRemoveFromCochain, CochainTag, TensorType > codifferential(ExecSpace const &exec_space, codifferential_tensor_t< TagToRemoveFromCochain, CochainTag, TensorType > const &codifferential_tensor, TensorType const &tensor, HodgeStarType const &hodge_star, DualHodgeStarType const &dual_hodge_star, DualTensorType const &dual_tensor_buffer, DualExtrapolationRule const &dual_extrapolation={})
typename detail::CodifferentialIndex< TagToRemoveFromCochain, CochainTag >::type codifferential_index_t
KOKKOS_FUNCTION constexpr auto tangent_basis(Elem elem)
typename detail::CodifferentialHodgeOutputIndexSeq< EndId, T >::type codifferential_hodge_output_indices_t
typename detail::CodifferentialType< CochainType >::type codifferential_t
KOKKOS_FUNCTION bool domain_contains(ddc::DiscreteDomain< DDim... > const &dom, ddc::DiscreteElement< ODDim... > elem)
typename detail::ConvertTypeSeqTo< T, Seq >::type convert_type_seq_to_t
Tensor(ddc::Chunk< ElementType, SupportType, Allocator >) -> Tensor< ElementType, SupportType, Kokkos::layout_right, typename Allocator::memory_space >
detail::Upper< T >::type upper_t
KOKKOS_FUNCTION auto make_extrapolation_rules(ExtrapolationRule rule)
Broadcast a rule to both sides of all N non-index dimensions.
Tensor< ElementType, ddc::DiscreteDomain< ProdDDim... >, LayoutStridedPolicy, MemorySpace > tensor_prod(Tensor< ElementType, ddc::DiscreteDomain< ProdDDim... >, LayoutStridedPolicy, MemorySpace > const &prod_tensor, Tensor< ElementType, ddc::DiscreteDomain< DDim1... >, LayoutStridedPolicy, MemorySpace > const &tensor1, Tensor< ElementType, ddc::DiscreteDomain< DDim2... >, LayoutStridedPolicy, MemorySpace > const &tensor2)
detail::Lower< T >::type lower_t
Definition character.hpp:79
bool constexpr is_covariant_v
The top-level namespace of SimiLie.
Definition csr.hpp:15
static KOKKOS_FUNCTION void operator()(CochainType auto codifferential_tensor, TensorType const &tensor, MetricType const &metric, PositionType const &position, auto const &chain, auto const &lower_chain, typename TensorType::non_indices_domain_t::discrete_element_type elem)
static auto geometry(Exec const &exec, MetricType const &metric, PositionType const &position)
detail::LinearSpatialOperatorStorage< Codifferential, TagToRemoveFromCochain, CochainTag, codifferential_index_t< TagToRemoveFromCochain, CochainTag >, 1, TensorType > staged_storage_type
static KOKKOS_FUNCTION auto value(TensorType const &tensor, MetricType const &metric, PositionType const &position, ChainType const &chain, LowerChainType const &lower_chain, typename TensorType::non_indices_domain_t::discrete_element_type elem, NaturalElem natural_elem)
static KOKKOS_FUNCTION auto value(Geometry const &geometry, TensorType const &input, Element element, Rules const &rules)
static KOKKOS_FUNCTION auto value(DualField const &dual_field, DualRules const &dual_rules, InverseHodge const &inverse_hodge, Element elem)
static KOKKOS_FORCEINLINE_FUNCTION auto value(Geometry const &geometry, Field const &input, Element element, Rules const &rules)
Complete cochain stencil, with geometry and closure supplied separately.
static KOKKOS_FUNCTION void operator()(Output output, DualEvaluator const &evaluate_dual, InverseHodge const &inverse_hodge, Chain const &chain, LowerChain const &lower_chain, Element elem)
static KOKKOS_FUNCTION auto value(DualField const &, InverseHodge const &inverse_hodge, Element elem)
Scalar codifferential coefficients on the incident dual faces.
Compose reconstruction, continuous Hodge star and reduction policies.