Trait green_kernels::traits::Kernel
source · pub trait Kernel: Sync {
type T: RlstScalar;
// Required methods
fn greens_fct(
&self,
eval_type: GreenKernelEvalType,
source: &[<Self::T as RlstScalar>::Real],
target: &[<Self::T as RlstScalar>::Real],
result: &mut [Self::T],
);
fn evaluate_st(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
charges: &[Self::T],
result: &mut [Self::T],
);
fn evaluate_mt(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
charges: &[Self::T],
result: &mut [Self::T],
);
fn assemble_st(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
result: &mut [Self::T],
);
fn assemble_mt(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
result: &mut [Self::T],
);
fn assemble_pairwise_st(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
result: &mut [Self::T],
);
fn domain_component_count(&self) -> usize;
fn space_dimension(&self) -> usize;
fn range_component_count(&self, eval_type: GreenKernelEvalType) -> usize;
}
Expand description
Interface to evaluating Green’s functions for given sources and targets.
Required Associated Types§
Required Methods§
sourcefn greens_fct(
&self,
eval_type: GreenKernelEvalType,
source: &[<Self::T as RlstScalar>::Real],
target: &[<Self::T as RlstScalar>::Real],
result: &mut [Self::T],
)
fn greens_fct( &self, eval_type: GreenKernelEvalType, source: &[<Self::T as RlstScalar>::Real], target: &[<Self::T as RlstScalar>::Real], result: &mut [Self::T], )
Evaluate the Green’s fct. for a single source and single target.
sourcefn evaluate_st(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
charges: &[Self::T],
result: &mut [Self::T],
)
fn evaluate_st( &self, eval_type: GreenKernelEvalType, sources: &[<Self::T as RlstScalar>::Real], targets: &[<Self::T as RlstScalar>::Real], charges: &[Self::T], result: &mut [Self::T], )
Single threaded evaluation of Green’s functions.
eval_type
: Either [EvalType::Value] to only return Green’s function values or [EvalType::ValueDeriv] to return values and derivatives.sources
: A slice defining the source points. The points must be given in the form[x_1, x_2, ... x_N, y_1, y_2, ..., y_N, z_1, z_2, ..., z_N]
, that is the value for each dimension must be continuously contained in the slice.targets
: A slice defining the targets. The memory layout is the same as for sources.charges
: A slice defining the charges. For each source point there needs to be one charge.result
: The result array. If the kernel is RlstScalar andeval_type
has the value [EvalType::Value] thenresult
has the same number of elemens as there are targets. For a RlstScalar kernel in three dimensional space if [EvalType::ValueDeriv] was chosen thenresult
contains for each target in consecutive order the value of the kernel and the three components of its derivative.
sourcefn evaluate_mt(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
charges: &[Self::T],
result: &mut [Self::T],
)
fn evaluate_mt( &self, eval_type: GreenKernelEvalType, sources: &[<Self::T as RlstScalar>::Real], targets: &[<Self::T as RlstScalar>::Real], charges: &[Self::T], result: &mut [Self::T], )
Multi-threaded evaluation of a Green’s function kernel.
The method parallelizes over the given targets. It expects a Rayon ThreadPool
in which the multi-threaded execution can be scheduled.
sourcefn assemble_st(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
result: &mut [Self::T],
)
fn assemble_st( &self, eval_type: GreenKernelEvalType, sources: &[<Self::T as RlstScalar>::Real], targets: &[<Self::T as RlstScalar>::Real], result: &mut [Self::T], )
Single threaded assembly of a kernel matrix.
eval_type
: Either [EvalType::Value] to only return Green’s function values or [EvalType::ValueDeriv] to return values and derivatives.sources
: A slice defining the source points. The points must be given in the form[x_1, x_2, ... x_N, y_1, y_2, ..., y_N, z_1, z_2, ..., z_N]
, that is the value for each dimension must be continuously contained in the slice.targets
: A slice defining the targets. The memory layout is the same as for sources.result
: The result array. If the kernel is RlstScalar andeval_type
has the value [EvalType::Value] thenresult
is equivalent to a column major matrix of dimension [S, T], where S is the number of sources and T is the number of targets. Hence, for each target all corresponding source evaluations are consecutively in memory. For a RlstScalar kernel in three dimensional space if [EvalType::ValueDeriv] was chosen thenresult
is equivalent to a column-major matrix of dimension [4 * S, T], where the first 4 rows are the values of Green’s fct. value and derivatives for the first source and all targets. The next 4 rows correspond to values and derivatives of second source with all targets and so on.
sourcefn assemble_mt(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
result: &mut [Self::T],
)
fn assemble_mt( &self, eval_type: GreenKernelEvalType, sources: &[<Self::T as RlstScalar>::Real], targets: &[<Self::T as RlstScalar>::Real], result: &mut [Self::T], )
Multi-threaded version of kernel matrix assembly.
sourcefn assemble_pairwise_st(
&self,
eval_type: GreenKernelEvalType,
sources: &[<Self::T as RlstScalar>::Real],
targets: &[<Self::T as RlstScalar>::Real],
result: &mut [Self::T],
)
fn assemble_pairwise_st( &self, eval_type: GreenKernelEvalType, sources: &[<Self::T as RlstScalar>::Real], targets: &[<Self::T as RlstScalar>::Real], result: &mut [Self::T], )
Single threaded assembly of the diagonal of a kernel matrix
sourcefn domain_component_count(&self) -> usize
fn domain_component_count(&self) -> usize
Return the domain component count of the Green’s fct.
For a RlstScalar kernel this is 1
.
sourcefn space_dimension(&self) -> usize
fn space_dimension(&self) -> usize
Return the space dimension.
sourcefn range_component_count(&self, eval_type: GreenKernelEvalType) -> usize
fn range_component_count(&self, eval_type: GreenKernelEvalType) -> usize
Return the range component count of the Green’s fct.
For a RlstScalar kernel this is 1
if [EvalType::Value] is
given, and 4
if [EvalType::ValueDeriv] is given.