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
432 int numberOfDoFsPerAxisInPatch,
433 int overlap,
434 int unknowns,
435 const double* __restrict__ coarseGridFaceValues,
436 double* __restrict__ fineGridFaceValues
437 );
438
456 int numberOfDoFsPerAxisInPatch,
457 int overlap,
458 int unknowns,
459 const double* __restrict__ coarseGridCellValues,
460 const double* __restrict__ coarseGridFaceValues,
461 double* __restrict__ fineGridFaceValues
462 );
463
464
478 int numberOfDoFsPerAxisInPatch,
479 int unknowns,
480 const double* __restrict__ coarseGridCellValues,
481 double* __restrict__ fineGridCellValues
482 );
483
484
487 int numberOfDoFsPerAxisInPatch,
488 int overlap,
489 int unknowns,
490 const double* __restrict__ coarseGridFaceValues,
491 double* __restrict__ fineGridFaceValues
492 );
493
496 int numberOfDoFsPerAxisInPatch,
497 int overlap,
498 int unknowns,
499 const double* __restrict__ coarseGridCellValues,
500 const double* __restrict__ coarseGridFaceValues,
501 double* __restrict__ fineGridFaceValues
502 );
503
506 int numberOfDoFsPerAxisInPatch,
507 int unknowns,
508 const double* __restrict__ coarseGridCellValues,
509 double* __restrict__ fineGridCellValues
510 );
511
512
515 int numberOfDoFsPerAxisInPatch,
516 int overlap,
517 int unknowns,
518 const double* __restrict__ coarseGridFaceValues,
519 double* __restrict__ fineGridFaceValues
520 );
521
524 int numberOfDoFsPerAxisInPatch,
525 int overlap,
526 int unknowns,
527 const double* __restrict__ coarseGridCellValues,
528 const double* __restrict__ coarseGridFaceValues,
529 double* __restrict__ fineGridFaceValues
530 );
531
534 int numberOfDoFsPerAxisInPatch,
535 int unknowns,
536 const double* __restrict__ coarseGridCellValues,
537 double* __restrict__ fineGridCellValues
538 );
539
540
546 int numberOfDoFsPerAxisInPatch,
547 int overlap,
548 int unknowns,
549 const double* __restrict__ coarseGridFaceValues,
550 double* __restrict__ fineGridFaceValues
551 );
552
555 int numberOfDoFsPerAxisInPatch,
556 int overlap,
557 int unknowns,
558 const double* __restrict__ coarseGridCellValues,
559 const double* __restrict__ coarseGridFaceValues,
560 double* __restrict__ fineGridFaceValues
561 );
562
565 int numberOfDoFsPerAxisInPatch,
566 int unknowns,
567 const double* __restrict__ coarseGridCellValues,
568 double* __restrict__ fineGridCellValues
569 );
570
573 int numberOfDoFsPerAxisInPatch,
574 int overlap,
575 int unknowns,
576 const double* __restrict__ coarseGridFaceValues,
577 double* __restrict__ fineGridFaceValues
578 );
579
582 int numberOfDoFsPerAxisInPatch,
583 int overlap,
584 int unknowns,
585 const double* __restrict__ coarseGridCellValues,
586 const double* __restrict__ coarseGridFaceValues,
587 double* __restrict__ fineGridFaceValues
588 );
589
592 int numberOfDoFsPerAxisInPatch,
593 int unknowns,
594 const double* __restrict__ coarseGridCellValues,
595 double* __restrict__ fineGridCellValues
596 );
597
660 int numberOfDoFsPerAxisInSourcePatch,
661 int numberOfDoFsPerAxisInDestinationPatch,
662 int haloSourcePatch,
663 int haloDestinationPatch,
664 int unknowns,
665 const double* __restrict__ interpolationData,
666 const int* __restrict__ columnIndices,
667 const int* __restrict__ rowIndices,
668 const double* __restrict__ sourceValues,
669 double* __restrict__ destinationValues,
670 ::peano4::utils::LoopPlacement parallelisation
671 );
672
674 int numberOfDoFsPerAxisInSourcePatch,
675 int numberOfDoFsPerAxisInDestinationPatch,
676 int haloSourcePatch,
677 int haloDestinationPatch,
678 int unknowns,
679 const double* __restrict__ sourceValues,
680 double* __restrict__ destinationValues,
681 ::peano4::utils::LoopPlacement parallelisation
682 );
683
685 int numberOfDoFsPerAxisInSourcePatch,
686 int numberOfDoFsPerAxisInDestinationPatch,
687 int haloSourcePatch,
688 int haloDestinationPatch,
689 int unknowns,
690 const double* __restrict__ sourceValues,
691 double* __restrict__ destinationValues,
692 ::peano4::utils::LoopPlacement parallelisation
693 );
694
696 int numberOfDoFsPerAxisInSourcePatch,
697 int numberOfDoFsPerAxisInDestinationPatch,
698 int haloSourcePatch,
699 int haloDestinationPatch,
700 int unknowns,
701 const double* __restrict__ sourceValues,
702 double* __restrict__ destinationValues,
703 ::peano4::utils::LoopPlacement parallelisation
704 );
705
706 namespace internal {
794 int numberOfDoFsPerAxisInPatch,
795 int normal,
796 bool extrapolateLinearly,
797 bool interpolateLinearlyAlongNormal
798 );
799
804 int numberOfDoFsPerAxisInPatch,
805 bool extrapolateLinearly
806 );
807
809 int numberOfDoFsPerAxisInInputPatch,
810 int numberOfDoFsPerAxisInOutputPatch,
811 bool extrapolateLinearly
812 );
813
893 int numberOfDoFsPerAxisInPatch,
894 int normal,
895 int overlap
896 );
897
906 int numberOfDoFsPerAxisInPatch
907 );
908
921 const tarch::la::DynamicMatrix& P1d,
922 int numberOfDoFsPerAxisInPatch,
923 int normal
924 );
925
939 const tarch::la::DynamicMatrix& P1d,
940 int numberOfDoFsPerAxisInPatch,
941 int normal
942 );
943
953 int numberOfDoFsPerAxisInPatch,
954 int overlap,
955 int unknowns,
956 const double* __restrict__ fineGridCellValuesLeft,
957 const double* __restrict__ fineGridCellValuesRight,
958 double* fineGridFaceValues
959 );
960
967 relativePositionWithinFatherCell,
968 int numberOfDoFsPerAxisInPatch,
969 int unknowns,
970 const double* __restrict__ fineGridValues,
971 double* coarseGridValues
972 );
973
976 relativePositionWithinFatherCell,
977 int numberOfDoFsPerAxisInPatch,
978 int unknowns,
979 const double* __restrict__ fineGridValues,
980 double* coarseGridValues,
981 bool extrapolateLinearly
982 );
983
991
993 int numberOfDoFsPerAxisInPatch_,
994 int overlap_,
995 int normal_
996 ):
997 numberOfDoFsPerAxisInPatch(numberOfDoFsPerAxisInPatch_),
998 overlap(overlap_),
999 normal(normal_) {}
1000
1001 inline bool operator<(const FaceInterpolationOperatorKey& otherKey
1002 ) const {
1003 return (this->numberOfDoFsPerAxisInPatch < otherKey.numberOfDoFsPerAxisInPatch)
1004 or (this->numberOfDoFsPerAxisInPatch == otherKey.numberOfDoFsPerAxisInPatch and this->overlap < otherKey.overlap)
1005 or (this->numberOfDoFsPerAxisInPatch == otherKey.numberOfDoFsPerAxisInPatch and this->overlap == otherKey.overlap and this->normal < otherKey.normal);
1006 }
1007 };
1008
1014
1015 inline CellInterpolationOperatorKey(int numberOfDoFsPerAxisInPatch_):
1016 numberOfDoFsPerAxisInPatch(numberOfDoFsPerAxisInPatch_) {}
1017
1018 inline bool operator<(const CellInterpolationOperatorKey& otherKey
1019 ) const {
1020 return this->numberOfDoFsPerAxisInPatch
1021 < otherKey.numberOfDoFsPerAxisInPatch;
1022 }
1023 };
1024
1025 typedef std::map<FaceInterpolationOperatorKey, tarch::la::DynamicMatrix*>
1027
1038 typedef std::map<CellInterpolationOperatorKey, tarch::la::DynamicMatrix*>
1040 } // namespace internal
1041 } // namespace blockstructured
1042} // namespace toolbox
My standard matrix is a matrix where the size is fixed at compile time.
LoopPlacement
Guide loop-level parallelism.
Definition Loop.h:65
tarch::la::DynamicMatrix * createInterpolationMatrixFrom1dTemplateByInsertingZeroColsAndRows(const tarch::la::DynamicMatrix &P1d, int numberOfDoFsPerAxisInPatch, int normal)
This routine accepts a matrix as input.
void interpolateCell_AoS_linear(const tarch::la::Vector< Dimensions, int > &relativePositionWithinFatherCell, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ fineGridValues, double *coarseGridValues, bool extrapolateLinearly)
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 interpolateCell_AoS_piecewise_constant(const tarch::la::Vector< Dimensions, int > &relativePositionWithinFatherCell, int numberOfDoFsPerAxisInPatch, int unknowns, const double *__restrict__ fineGridValues, double *coarseGridValues)
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)
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)
void interpolateHaloLayer_AoS_piecewise_constant(const peano4::datamanagement::FaceMarker &marker, int numberOfDoFsPerAxisInPatch, int overlap, int unknowns, const double *__restrict__ coarseGridFaceValues, double *__restrict__ fineGridFaceValues)
Take the coarse grid values and interpolate them onto the fine grid.
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:134
bool operator<(const CellInterpolationOperatorKey &otherKey) const
bool operator<(const FaceInterpolationOperatorKey &otherKey) const
FaceInterpolationOperatorKey(int numberOfDoFsPerAxisInPatch_, int overlap_, int normal_)