Peano
Loading...
Searching...
No Matches
Interpolation.h
Go to the documentation of this file.
1// This file is part of the Peano project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#pragma once
4
5#include <map>
6
9#include "peano4/utils/Loop.h"
11
188namespace toolbox {
189 namespace blockstructured {
300 int numberOfDoFsPerAxisInPatch,
301 int overlap,
302 int unknowns,
303 const double* __restrict__ normalInterpolationMatrix1d,
304 const double* __restrict__ tangentialInterpolationMatrix1d,
305 const double* __restrict__ coarseGridFaceValues,
306 double* __restrict__ fineGridFaceValues
307 );
308
309
312 int numberOfDoFsPerAxisInPatch,
313 int overlap,
314 int unknowns,
315 const double* __restrict__ normalInterpolationMatrix1d,
316 const double* __restrict__ tangentialInterpolationMatrix1d,
317 const double* __restrict__ coarseGridCellValues,
318 const double* __restrict__ coarseGridFaceValues,
319 double* __restrict__ fineGridFaceValues
320 );
321
324 int numberOfDoFsPerAxisInPatch,
325 int overlap,
326 int unknowns,
327 const double* __restrict__ interpolationData,
328 const int* __restrict__ columnIndices,
329 const int* __restrict__ rowIndices,
330 const double* __restrict__ coarseGridCellValues,
331 const double* __restrict__ coarseGridFaceValues,
332 double* __restrict__ fineGridFaceValues
333 );
334
337 int numberOfDoFsPerAxisInPatch,
338 int overlap,
339 int unknowns,
340 const double* __restrict__ coarseGridCellValues,
341 const double* __restrict__ coarseGridFaceValues,
342 double* __restrict__ fineGridFaceValues
343 );
344
345
348 int numberOfDoFsPerAxisInPatch,
349 int overlap,
350 int unknowns,
351 const double* __restrict__ coarseGridFaceValues,
352 double* __restrict__ fineGridFaceValues
353 );
354
357 int numberOfDoFsPerAxisInPatch,
358 int overlap,
359 int unknowns,
360 const double* __restrict__ coarseGridCellValues,
361 const double* __restrict__ coarseGridFaceValues,
362 double* __restrict__ fineGridFaceValues
363 );
364
365
368 int numberOfDoFsPerAxisInPatch,
369 int overlap,
370 int unknowns,
371 const double* __restrict__ coarseGridFaceValues,
372 double* __restrict__ fineGridFaceValues
373 );
374
375
378 int numberOfDoFsPerAxisInPatch,
379 int overlap,
380 int unknowns,
381 const double* __restrict__ interpolationData,
382 const int* __restrict__ columnIndices,
383 const int* __restrict__ rowIndices,
384 int dataStart,
385 int rowIndicesStart,
386 const double* __restrict__ coarseGridFaceValues,
387 double* __restrict__ fineGridFaceValues
388 );
389
392 int numberOfDoFsPerAxisInPatch,
393 int unknowns,
394 const double* __restrict__ interpolationMatrix1d,
395 const double* __restrict__ coarseGridCellValues,
396 double* __restrict__ fineGridCellValues
397 );
398
401 int numberOfDoFsPerAxisInPatch,
402 int unknowns,
403 const double* __restrict__ interpolationData,
404 const int* __restrict__ columnIndices,
405 const int* __restrict__ rowIndices,
406 const double* __restrict__ coarseGridCellValues,
407 double* __restrict__ fineGridCellValues
408 );
409
412 int numberOfDoFsPerAxisInPatch,
413 int unknowns,
414 const double* __restrict__ coarseGridCellValues,
415 double* __restrict__ fineGridCellValues
416 );
417
420 int numberOfDoFsPerAxisInPatch,
421 int unknowns,
422 const double* __restrict__ coarseGridCellValues,
423 double* __restrict__ fineGridCellValues
424 );
425
426
441 int numberOfDoFsPerAxisInPatch,
442 int overlap,
443 int unknowns,
444 const double* __restrict__ coarseGridFaceValues,
445 double* __restrict__ fineGridFaceValues
446 );
447
465 int numberOfDoFsPerAxisInPatch,
466 int overlap,
467 int unknowns,
468 const double* __restrict__ coarseGridCellValues,
469 const double* __restrict__ coarseGridFaceValues,
470 double* __restrict__ fineGridFaceValues
471 );
472
473
487 int numberOfDoFsPerAxisInPatch,
488 int unknowns,
489 const double* __restrict__ coarseGridCellValues,
490 double* __restrict__ fineGridCellValues
491 );
492
493
508 int numberOfDoFsPerAxisInPatch,
509 int overlap,
510 int unknowns,
511 const double* __restrict__ coarseGridFaceValues,
512 double* __restrict__ fineGridFaceValues
513 );
514
517 int numberOfDoFsPerAxisInPatch,
518 int overlap,
519 int unknowns,
520 const double* __restrict__ coarseGridCellValues,
521 const double* __restrict__ coarseGridFaceValues,
522 double* __restrict__ fineGridFaceValues
523 );
524
538 int numberOfDoFsPerAxisInPatch,
539 int unknowns,
540 const double* __restrict__ coarseGridCellValues,
541 double* __restrict__ fineGridCellValues
542 );
543
544
547 int numberOfDoFsPerAxisInPatch,
548 int overlap,
549 int unknowns,
550 const double* __restrict__ coarseGridFaceValues,
551 double* __restrict__ fineGridFaceValues
552 );
553
556 int numberOfDoFsPerAxisInPatch,
557 int overlap,
558 int unknowns,
559 const double* __restrict__ coarseGridCellValues,
560 const double* __restrict__ coarseGridFaceValues,
561 double* __restrict__ fineGridFaceValues
562 );
563
566 int numberOfDoFsPerAxisInPatch,
567 int unknowns,
568 const double* __restrict__ coarseGridCellValues,
569 double* __restrict__ fineGridCellValues
570 );
571
572
578 int numberOfDoFsPerAxisInPatch,
579 int overlap,
580 int unknowns,
581 const double* __restrict__ coarseGridFaceValues,
582 double* __restrict__ fineGridFaceValues
583 );
584
587 int numberOfDoFsPerAxisInPatch,
588 int overlap,
589 int unknowns,
590 const double* __restrict__ coarseGridCellValues,
591 const double* __restrict__ coarseGridFaceValues,
592 double* __restrict__ fineGridFaceValues
593 );
594
597 int numberOfDoFsPerAxisInPatch,
598 int unknowns,
599 const double* __restrict__ coarseGridCellValues,
600 double* __restrict__ fineGridCellValues
601 );
602
605 int numberOfDoFsPerAxisInPatch,
606 int overlap,
607 int unknowns,
608 const double* __restrict__ coarseGridFaceValues,
609 double* __restrict__ fineGridFaceValues
610 );
611
614 int numberOfDoFsPerAxisInPatch,
615 int overlap,
616 int unknowns,
617 const double* __restrict__ coarseGridCellValues,
618 const double* __restrict__ coarseGridFaceValues,
619 double* __restrict__ fineGridFaceValues
620 );
621
624 int numberOfDoFsPerAxisInPatch,
625 int unknowns,
626 const double* __restrict__ coarseGridCellValues,
627 double* __restrict__ fineGridCellValues
628 );
629
692 int numberOfDoFsPerAxisInSourcePatch,
693 int numberOfDoFsPerAxisInDestinationPatch,
694 int haloSourcePatch,
695 int haloDestinationPatch,
696 int unknowns,
697 const double* __restrict__ interpolationData,
698 const int* __restrict__ columnIndices,
699 const int* __restrict__ rowIndices,
700 const double* __restrict__ sourceValues,
701 double* __restrict__ destinationValues,
702 ::peano4::utils::LoopPlacement parallelisation
703 );
704
706 int numberOfDoFsPerAxisInSourcePatch,
707 int numberOfDoFsPerAxisInDestinationPatch,
708 int haloSourcePatch,
709 int haloDestinationPatch,
710 int unknowns,
711 const double* __restrict__ sourceValues,
712 double* __restrict__ destinationValues,
713 ::peano4::utils::LoopPlacement parallelisation
714 );
715
717 int numberOfDoFsPerAxisInSourcePatch,
718 int numberOfDoFsPerAxisInDestinationPatch,
719 int haloSourcePatch,
720 int haloDestinationPatch,
721 int unknowns,
722 const double* __restrict__ sourceValues,
723 double* __restrict__ destinationValues,
724 ::peano4::utils::LoopPlacement parallelisation
725 );
726
728 int numberOfDoFsPerAxisInSourcePatch,
729 int numberOfDoFsPerAxisInDestinationPatch,
730 int haloSourcePatch,
731 int haloDestinationPatch,
732 int unknowns,
733 const double* __restrict__ sourceValues,
734 double* __restrict__ destinationValues,
735 ::peano4::utils::LoopPlacement parallelisation
736 );
737
738 namespace internal {
750 int getCoarseLayerOfFineLayerInOverlap(int fineLayer, int overlap);
751
839 int numberOfDoFsPerAxisInPatch,
840 int normal,
841 bool extrapolateLinearly,
842 bool interpolateLinearlyAlongNormal
843 );
844
849 int numberOfDoFsPerAxisInPatch,
850 bool extrapolateLinearly
851 );
852
854 int numberOfDoFsPerAxisInInputPatch,
855 int numberOfDoFsPerAxisInOutputPatch,
856 bool extrapolateLinearly
857 );
858
937 int numberOfDoFsPerAxisInPatch,
938 int normal,
939 int overlap
940 );
941
950 int numberOfDoFsPerAxisInPatch
951 );
952
965 const tarch::la::DynamicMatrix& P1d,
966 int numberOfDoFsPerAxisInPatch,
967 int normal
968 );
969
983 const tarch::la::DynamicMatrix& P1d,
984 int numberOfDoFsPerAxisInPatch,
985 int normal
986 );
987
997 int numberOfDoFsPerAxisInPatch,
998 int overlap,
999 int unknowns,
1000 const double* __restrict__ fineGridCellValuesLeft,
1001 const double* __restrict__ fineGridCellValuesRight,
1002 double* fineGridFaceValues
1003 );
1004
1011 relativePositionWithinFatherCell,
1012 int numberOfDoFsPerAxisInPatch,
1013 int unknowns,
1014 const double* __restrict__ fineGridValues,
1015 double* __restrict__ coarseGridValues
1016 );
1017
1020 relativePositionWithinFatherCell,
1021 int numberOfDoFsPerAxisInPatch,
1022 int unknowns,
1023 const double* __restrict__ fineGridValues,
1024 double* __restrict__ coarseGridValues,
1025 bool extrapolateLinearly
1026 );
1027
1035
1037 int numberOfDoFsPerAxisInPatch_,
1038 int overlap_,
1039 int normal_
1040 ):
1041 numberOfDoFsPerAxisInPatch(numberOfDoFsPerAxisInPatch_),
1042 overlap(overlap_),
1043 normal(normal_) {}
1044
1045 inline bool operator<(const FaceInterpolationOperatorKey& otherKey
1046 ) const {
1047 return (this->numberOfDoFsPerAxisInPatch < otherKey.numberOfDoFsPerAxisInPatch)
1048 or (this->numberOfDoFsPerAxisInPatch == otherKey.numberOfDoFsPerAxisInPatch and this->overlap < otherKey.overlap)
1049 or (this->numberOfDoFsPerAxisInPatch == otherKey.numberOfDoFsPerAxisInPatch and this->overlap == otherKey.overlap and this->normal < otherKey.normal);
1050 }
1051 };
1052
1058
1059 inline CellInterpolationOperatorKey(int numberOfDoFsPerAxisInPatch_):
1060 numberOfDoFsPerAxisInPatch(numberOfDoFsPerAxisInPatch_) {}
1061
1062 inline bool operator<(const CellInterpolationOperatorKey& otherKey
1063 ) const {
1064 return this->numberOfDoFsPerAxisInPatch
1065 < otherKey.numberOfDoFsPerAxisInPatch;
1066 }
1067 };
1068
1069 typedef std::map<FaceInterpolationOperatorKey, tarch::la::DynamicMatrix*>
1071
1082 typedef std::map<CellInterpolationOperatorKey, tarch::la::DynamicMatrix*>
1084 } // namespace internal
1085 } // namespace blockstructured
1086} // namespace toolbox
My standard matrix is a matrix where the size is fixed at compile time.
LoopPlacement
Guide loop-level parallelism.
Definition Loop.h:72
int getCoarseLayerOfFineLayerInOverlap(int fineLayer, int overlap)
Coarse layer of a face overlap which contains a fine layer.
void interpolateCell_AoS_linear(const tarch::la::Vector< Dimensions, int > &relativePositionWithinFatherCell, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ fineGridValues, double *__restrict__ coarseGridValues, bool extrapolateLinearly)
tarch::la::DynamicMatrix * createInterpolationMatrixFrom1dTemplateByInsertingZeroColsAndRows(const tarch::la::DynamicMatrix &P1d, int numberOfDoFsPerAxisInPatch, int normal)
This routine accepts a matrix as input.
void interpolateCell_AoS_piecewise_constant(const tarch::la::Vector< Dimensions, int > &relativePositionWithinFatherCell, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ fineGridValues, double *__restrict__ coarseGridValues)
std::map< FaceInterpolationOperatorKey, tarch::la::DynamicMatrix * > FaceInterpolationMap
std::map< CellInterpolationOperatorKey, tarch::la::DynamicMatrix * > CellInterpolationMap
A cell interpolation is a huge matrix.
tarch::la::DynamicMatrix * createInterpolationMatrixFrom1dTemplateByLinearInterpolationAlongNormal(const tarch::la::DynamicMatrix &P1d, int numberOfDoFsPerAxisInPatch, int normal)
This is an extension of createInterpolationMatrixFrom1dTemplateByInsertingZeroColsAndRows().
void projectInterpolatedFineCellsOnHaloLayer_AoS(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ fineGridCellValuesLeft, const double *__restrict__ fineGridCellValuesRight, double *fineGridFaceValues)
This routine assumes that you have the whole patch data of hte left and right adjacent patch at hands...
tarch::la::DynamicMatrix * createPiecewiseConstantInterpolationMatrix(int numberOfDoFsPerAxisInPatch, int normal, int overlap)
Create piecewise constant interpolation matrix.
tarch::la::DynamicMatrix * createLinearInterpolationMatrix(int numberOfDoFsPerAxisInPatch, int normal, bool extrapolateLinearly, bool interpolateLinearlyAlongNormal)
The realisation relies on the following observations/follows these steps:
void interpolateHaloLayer_AoS_tensor_product(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
This is a wrapper around the toolbox routines.
void interpolateCell_AoS_matrix(const peano4::datamanagement::CellMarker &marker, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ coarseGridCellValues, double *__restrict__ fineGridCellValues)
void interpolateCellDataAssociatedToVolumesIntoOverlappingCell_linear(int numberOfDoFsPerAxisInSourcePatch, int numberOfDoFsPerAxisInDestinationPatch, int haloSourcePatch, int haloDestinationPatch, int unknowns, const double *__restrict__ sourceValues, double *__restrict__ destinationValues, ::peano4::utils::LoopPlacement parallelisation)
void interpolateHaloLayer_AoS_matrix(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridCellValues, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
void interpolateCell_AoS_linear_with_constant_extrapolation(const peano4::datamanagement::CellMarker &marker, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ coarseGridCellValues, double *__restrict__ fineGridCellValues)
Interpolate the patch of a coarse cell d-linearly into one of its 3^d children.
void interpolateCell_AoS_piecewise_constant(const peano4::datamanagement::CellMarker &marker, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ coarseGridCellValues, double *__restrict__ fineGridCellValues)
This routine is called if we create a new cell (dynamic AMR)
void interpolateCell_AoS_linear_with_linear_extrapolation(const peano4::datamanagement::CellMarker &marker, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ coarseGridCellValues, double *__restrict__ fineGridCellValues)
void interpolateCellDataAssociatedToVolumesIntoOverlappingCell_secondOrder(int numberOfDoFsPerAxisInSourcePatch, int numberOfDoFsPerAxisInDestinationPatch, int haloSourcePatch, int haloDestinationPatch, int unknowns, const double *__restrict__ sourceValues, double *__restrict__ destinationValues, ::peano4::utils::LoopPlacement parallelisation)
void interpolateCell_AoS_linear_with_linear_extrapolation_and_linear_normal_interpolation(const peano4::datamanagement::CellMarker &marker, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ coarseGridCellValues, double *__restrict__ fineGridCellValues)
void interpolateHaloLayer_AoS_linear_with_constant_extrapolation(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
Interpolate the overlap of a coarse face linearly onto a hanging face.
void interpolateHaloLayer_AoS_piecewise_constant(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
Interpolate the overlap of a coarse face onto a hanging face.
void interpolateCell_AoS_tensor_product(const peano4::datamanagement::CellMarker &marker, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ coarseGridCellValues, double *__restrict__ fineGridCellValues)
void interpolateHaloLayer_AoS_linear_with_linear_extrapolation_and_linear_normal_interpolation(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
void interpolateHaloLayer_AoS_third_order(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridCellValues, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
void interpolateHaloLayer_AoS_linear_with_linear_extrapolation(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
void interpolateCellDataAssociatedToVolumesIntoOverlappingCell_fourthOrder(int numberOfDoFsPerAxisInSourcePatch, int numberOfDoFsPerAxisInDestinationPatch, int haloSourcePatch, int haloDestinationPatch, int unknowns, const double *__restrict__ sourceValues, double *__restrict__ destinationValues, ::peano4::utils::LoopPlacement parallelisation)
void interpolateHaloLayer_AoS_second_order(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridCellValues, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
void interpolateHaloLayer_AoS_linear_with_constant_extrapolation_and_linear_normal_interpolation(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
void interpolateCell_AoS_third_order(const peano4::datamanagement::CellMarker &marker, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ coarseGridCellValues, double *__restrict__ fineGridCellValues)
void interpolateCell_AoS_linear_with_constant_extrapolation_and_linear_normal_interpolation(const peano4::datamanagement::CellMarker &marker, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ coarseGridCellValues, double *__restrict__ fineGridCellValues)
void interpolateCellDataAssociatedToVolumesIntoOverlappingCell_matrix(int numberOfDoFsPerAxisInSourcePatch, int numberOfDoFsPerAxisInDestinationPatch, int haloSourcePatch, int haloDestinationPatch, int unknowns, const double *__restrict__ interpolationData, const int *__restrict__ columnIndices, const int *__restrict__ rowIndices, const double *__restrict__ sourceValues, double *__restrict__ destinationValues, ::peano4::utils::LoopPlacement parallelisation)
This interpolation should be used if a cell hosts two sets of unknowns.
void interpolateCell_AoS_second_order(const peano4::datamanagement::CellMarker &marker, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ coarseGridCellValues, double *__restrict__ fineGridCellValues)
Provide information about selected face.
Definition FaceMarker.h:35
Simple vector class.
Definition Vector.h:159
bool operator<(const CellInterpolationOperatorKey &otherKey) const
bool operator<(const FaceInterpolationOperatorKey &otherKey) const
FaceInterpolationOperatorKey(int numberOfDoFsPerAxisInPatch_, int overlap_, int normal_)