9 #ifndef _COMPADRE_MISC_HPP_
10 #define _COMPADRE_MISC_HPP_
22 KOKKOS_INLINE_FUNCTION
23 XYZ(
double _x = 0.0,
double _y = 0.0,
double _z = 0.0) :
x(_x),
y(_y),
z(_z) {}
25 KOKKOS_INLINE_FUNCTION
28 XYZ(
const std::vector<scalar_type>& vec) :
x(vec[0]),
y(vec[1]),
z(vec[2]) {};
30 KOKKOS_INLINE_FUNCTION
36 KOKKOS_INLINE_FUNCTION
42 KOKKOS_INLINE_FUNCTION
48 KOKKOS_INLINE_FUNCTION
54 KOKKOS_INLINE_FUNCTION
60 KOKKOS_INLINE_FUNCTION
71 KOKKOS_INLINE_FUNCTION
82 KOKKOS_INLINE_FUNCTION
91 KOKKOS_INLINE_FUNCTION
96 KOKKOS_INLINE_FUNCTION
104 KOKKOS_INLINE_FUNCTION
106 return XYZ( vecA.
x + vecB.
x, vecA.
y + vecB.
y, vecA.
z + vecB.
z); }
108 KOKKOS_INLINE_FUNCTION
110 return XYZ( vecA.
x - vecB.
x, vecA.
y - vecB.
y, vecA.
z - vecB.
z); }
112 KOKKOS_INLINE_FUNCTION
114 return XYZ( vecA.
x * vecB.
x, vecA.
y * vecB.
y, vecA.
z * vecB.
z); }
116 KOKKOS_INLINE_FUNCTION
118 return XYZ( vecA.
x + constant, vecA.
y + constant, vecA.
z + constant); }
120 KOKKOS_INLINE_FUNCTION
122 return XYZ( vecA.
x + constant, vecA.
y + constant, vecA.
z + constant); }
124 KOKKOS_INLINE_FUNCTION
126 return XYZ( vecA.
x - constant, vecA.
y - constant, vecA.
z - constant); }
128 KOKKOS_INLINE_FUNCTION
130 return XYZ( constant - vecA.
x, constant - vecA.
y, constant - vecA.
z); }
132 KOKKOS_INLINE_FUNCTION
134 return XYZ( vecA.
x * constant, vecA.
y * constant, vecA.
z * constant); }
136 KOKKOS_INLINE_FUNCTION
138 return XYZ( vecA.
x * constant, vecA.
y * constant, vecA.
z * constant); }
140 KOKKOS_INLINE_FUNCTION
142 return XYZ( vecA.
x / constant, vecA.
y / constant, vecA.
z / constant); }
145 os <<
"(" << vec.
x <<
", " << vec.
y <<
", " << vec.
z <<
")" ;
return os; }
148 KOKKOS_INLINE_FUNCTION
152 for (
unsigned i=0; i<
p; i++) {
168 KOKKOS_INLINE_FUNCTION
178 KOKKOS_INLINE_FUNCTION
183 return dimension*added_alpha_size;
185 return added_alpha_size;
189 KOKKOS_INLINE_FUNCTION
198 RHS_row = RHS_col = N + added_coeff_size;
200 if (dense_solver_type !=
LU) {
204 RHS_row = RHS_col = N + added_coeff_size;
209 KOKKOS_INLINE_FUNCTION
219 out_row = M + added_alpha_size;
220 out_col = N + added_coeff_size;
222 if (dense_solver_type ==
LU) {
223 out_row = M + added_alpha_size;
224 out_col = N + added_coeff_size;
233 KOKKOS_INLINE_FUNCTION
234 int getTargetOutputIndex(
const int operation_num,
const int output_component_axis_1,
const int output_component_axis_2,
const int dimensions) {
236 return axis_1_size*output_component_axis_1 + output_component_axis_2;
240 KOKKOS_INLINE_FUNCTION
243 return axis_1_size*output_component_axis_1 + output_component_axis_2;
247 KOKKOS_INLINE_FUNCTION
254 KOKKOS_INLINE_FUNCTION
261 KOKKOS_INLINE_FUNCTION
267 KOKKOS_INLINE_FUNCTION
275 KOKKOS_INLINE_FUNCTION
285 sm =(bm < sm) ? bm : sm;
291 KOKKOS_INLINE_FUNCTION
297 KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION int getOutputDimensionOfSampling(SamplingFunctional sro, const int local_dimensions)
Dimensions ^ output rank for sampling operation (always in local chart if on a manifold, never ambient space)
KOKKOS_INLINE_FUNCTION int getAdditionalAlphaSizeFromConstraint(DenseSolverType dense_solver_type, ConstraintType constraint_type)
ConstraintType
Constraint type.
int output_rank
Rank of sampling functional output for each SamplingFunctional.
Neumann Gradient Scalar Type.
ReconstructionSpace
Space in which to reconstruct polynomial.
KOKKOS_INLINE_FUNCTION scalar_type & operator[](const int i)
Scalar basis reused as many times as there are components in the vector resulting in a much cheaper p...
KOKKOS_INLINE_FUNCTION int extent_int(int comp=0)
KOKKOS_INLINE_FUNCTION int getAdditionalCoeffSizeFromConstraintAndSpace(DenseSolverType dense_solver_type, ConstraintType constraint_type, ReconstructionSpace reconstruction_space, const int dimension)
KOKKOS_INLINE_FUNCTION XYZ operator-(const XYZ &vecA, const XYZ &vecB)
KOKKOS_INLINE_FUNCTION XYZ operator+(const XYZ &vecA, const XYZ &vecB)
KOKKOS_INLINE_FUNCTION int calculateSamplingMultiplier(const ReconstructionSpace rs, const SamplingFunctional sro, const int local_dimensions)
Calculate sampling_multiplier.
KOKKOS_INLINE_FUNCTION XYZ operator+=(const XYZ &other)
KOKKOS_INLINE_FUNCTION XYZ(double _x=0.0, double _y=0.0, double _z=0.0)
KOKKOS_INLINE_FUNCTION XYZ operator*(double scalar)
KOKKOS_INLINE_FUNCTION int getActualReconstructionSpaceRank(const int &index)
Number of actual components in the ReconstructionSpace.
DenseSolverType
Dense solver type.
Vector polynomial basis having # of components _dimensions, or (_dimensions-1) in the case of manifol...
KOKKOS_INLINE_FUNCTION XYZ operator*(const XYZ &vecA, const XYZ &vecB)
XYZ(const std::vector< scalar_type > &vec)
KOKKOS_INLINE_FUNCTION int getTargetOutputIndex(const int operation_num, const int output_component_axis_1, const int output_component_axis_2, const int dimensions)
Helper function for finding alpha coefficients.
KOKKOS_INLINE_FUNCTION int getInputRankOfSampling(SamplingFunctional sro)
Input rank for sampling operation.
TargetOperation
Available target functionals.
int input_rank
Rank of sampling functional input for each SamplingFunctional.
KOKKOS_INLINE_FUNCTION int pown(int n, unsigned p)
n^p (n^0 returns 1, regardless of n)
LU factorization performed on P^T*W*P matrix.
KOKKOS_INLINE_FUNCTION XYZ(const scalar_type *arry)
KOKKOS_INLINE_FUNCTION int getSamplingOutputIndex(const SamplingFunctional sf, const int output_component_axis_1, const int output_component_axis_2)
Helper function for finding alpha coefficients.
KOKKOS_INLINE_FUNCTION void getPDims(DenseSolverType dense_solver_type, ConstraintType constraint_type, ReconstructionSpace reconstruction_space, const int dimension, const int M, const int N, int &out_row, int &out_col)
import subprocess import os import re import math import sys import argparse p
KOKKOS_INLINE_FUNCTION XYZ operator-=(const XYZ &other)
std::ostream & operator<<(std::ostream &os, const XYZ &vec)
KOKKOS_INLINE_FUNCTION int getTargetOutputTensorRank(const int &index)
Rank of target functional output for each TargetOperation Rank of target functional input for each Ta...
KOKKOS_INLINE_FUNCTION void getRHSDims(DenseSolverType dense_solver_type, ConstraintType constraint_type, ReconstructionSpace reconstruction_space, const int dimension, const int M, const int N, int &RHS_row, int &RHS_col)
KOKKOS_INLINE_FUNCTION int getInputDimensionOfOperation(TargetOperation lro, SamplingFunctional sro, const int local_dimensions)
Dimensions ^ input rank for target operation (always in local chart if on a manifold, never ambient space)
KOKKOS_INLINE_FUNCTION XYZ operator*=(const double &scaling)
KOKKOS_INLINE_FUNCTION XYZ operator/(const XYZ &vecA, const scalar_type &constant)
KOKKOS_INLINE_FUNCTION int getOutputDimensionOfOperation(TargetOperation lro, const int local_dimensions)
Dimensions ^ output rank for target operation.
KOKKOS_INLINE_FUNCTION size_t extent(int comp=0)
KOKKOS_INLINE_FUNCTION int getInputDimensionOfSampling(SamplingFunctional sro, const int global_dimensions)
Dimensions ^ output rank for sampling operation (always in ambient space, never local chart on a mani...
KOKKOS_INLINE_FUNCTION int calculateBasisMultiplier(const ReconstructionSpace rs, const int local_dimensions)
Calculate basis_multiplier.