41 #ifndef DTK_SPLINEEVALUATIONMATRIX_IMPL_HPP 42 #define DTK_SPLINEEVALUATIONMATRIX_IMPL_HPP 48 #include <Teuchos_Array.hpp> 56 template <
class Basis,
int DIM>
58 const Teuchos::RCP<
const Tpetra::Map<int, SupportId>> &domain_map,
59 const Teuchos::RCP<
const Tpetra::Map<int, SupportId>> &range_map,
60 const Teuchos::ArrayView<const double> &target_centers,
61 const Teuchos::ArrayView<const SupportId> &target_center_gids,
62 const Teuchos::ArrayView<const double> &dist_source_centers,
63 const Teuchos::ArrayView<const SupportId> &dist_source_center_gids,
66 DTK_CHECK( 0 == target_centers.size() % DIM );
67 DTK_CHECK( target_centers.size() / DIM == target_center_gids.size() );
68 DTK_CHECK( 0 == dist_source_centers.size() % DIM );
69 DTK_CHECK( dist_source_centers.size() / DIM ==
70 dist_source_center_gids.size() );
73 unsigned num_target_centers = target_center_gids.size();
77 Teuchos::RCP<Tpetra::MultiVector<double, int, SupportId>> Q_vec =
78 Tpetra::createMultiVector<double, int, SupportId>( range_map, offset );
80 for (
unsigned i = 0; i < num_target_centers; ++i )
82 Q_vec->replaceGlobalValue( target_center_gids[i], 0, 1.0 );
84 for (
int d = 0; d < DIM; ++d )
86 Q_vec->replaceGlobalValue( target_center_gids[i], d + 1,
87 target_centers[di + d] );
93 Teuchos::ArrayRCP<SupportId> children_per_parent =
94 target_pairings.childrenPerParent();
95 SupportId max_entries_per_row = *std::max_element(
96 children_per_parent.begin(), children_per_parent.end() );
97 d_N = Teuchos::rcp(
new Tpetra::CrsMatrix<double, int, SupportId>(
98 range_map, max_entries_per_row ) );
99 Teuchos::Array<SupportId> N_indices( max_entries_per_row );
100 Teuchos::Array<double> values( max_entries_per_row );
102 Teuchos::ArrayView<const unsigned> target_neighbors;
106 for (
unsigned i = 0; i < num_target_centers; ++i )
112 ntn = target_neighbors.size();
113 radius = target_pairings.parentSupportRadius( i );
116 for (
int j = 0; j < ntn; ++j )
118 dj = DIM * target_neighbors[j];
120 N_indices[j] = dist_source_center_gids[target_neighbors[j]];
123 &dist_source_centers[dj] );
125 values[j] = BP::evaluateValue( basis, radius, dist );
128 d_N->insertGlobalValues( target_center_gids[i], N_indices( 0, ntn ),
131 d_N->fillComplete( domain_map, range_map );
133 DTK_ENSURE( d_N->isFillComplete() );
142 #endif // end DTK_SPLINEEVALUATIONMATRIX_IMPL_HPP SplineEvaluationMatrix(const Teuchos::RCP< const Tpetra::Map< int, SupportId >> &domain_map, const Teuchos::RCP< const Tpetra::Map< int, SupportId >> &range_map, const Teuchos::ArrayView< const double > &target_centers, const Teuchos::ArrayView< const SupportId > &target_center_gids, const Teuchos::ArrayView< const double > &dist_source_centers, const Teuchos::ArrayView< const SupportId > &dist_source_center_gids, const SplineInterpolationPairing< DIM > &target_pairings, const Basis &basis)
Constructor.
unsigned long int SupportId
Support id type.
Assertions and Design-by-Contract for error handling.
Eucliden distance function.
Vector apply implementation for polynomial matrices.
Teuchos::ArrayView< const unsigned > childCenterIds(const unsigned parent_id) const
Given a parent center local id get the ids of the child centers within the given radius.
Euclidean distance function.
Spline transformation operator.
Local child/parent center pairings.