openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
|
#include <SF_abstract_vector.h>
Public Types | |
enum | ltype { algebraic, nodal, elemwise, unset } |
Public Member Functions | |
virtual | ~abstract_vector ()=default |
virtual void | init (const meshdata< mesh_int_t, mesh_real_t > &imesh, int idpn, ltype inp_layout)=0 |
virtual void | init (const abstract_vector< T, S > &vec)=0 |
virtual void | init (int igsize, int ilsize, int idpn=1, ltype ilayout=unset)=0 |
std::tuple< int, int > | init_common (const meshdata< mesh_int_t, mesh_real_t > &imesh, int idpn, ltype inp_layout) |
virtual void | set (const vector< T > &idx, const vector< S > &vals, const bool additive=false)=0 |
virtual void | set (const vector< T > &idx, const S val)=0 |
virtual void | set (const S val)=0 |
virtual void | set (const T idx, const S val)=0 |
virtual void | get (const vector< T > &idx, S *out)=0 |
virtual S | get (const T idx)=0 |
virtual void | operator*= (const S sca)=0 |
virtual void | operator/= (const S sca)=0 |
virtual void | operator*= (const abstract_vector< T, S > &vec)=0 |
virtual void | add_scaled (const abstract_vector< T, S > &vec, S k)=0 |
virtual void | operator+= (const abstract_vector< T, S > &vec)=0 |
virtual void | operator-= (const abstract_vector< T, S > &vec)=0 |
virtual void | operator+= (S c)=0 |
virtual void | operator= (const vector< S > &rhs)=0 |
virtual void | operator= (const abstract_vector< T, S > &rhs)=0 |
virtual void | shallow_copy (const abstract_vector< T, S > &v)=0 |
virtual void | deep_copy (const abstract_vector< T, S > &v)=0 |
virtual void | overshadow (const abstract_vector< T, S > &sub, bool member, int offset, int sz, bool share)=0 |
virtual T | lsize () const =0 |
virtual T | gsize () const =0 |
virtual void | get_ownership_range (T &start, T &stop) const =0 |
virtual S * | ptr ()=0 |
virtual const S * | const_ptr () const =0 |
virtual void | release_ptr (S *&p)=0 |
virtual void | const_release_ptr (const S *&p) const =0 |
virtual S | mag () const =0 |
virtual S | sum () const =0 |
virtual S | min () const =0 |
virtual S | dot (const abstract_vector< T, S > &v) const =0 |
virtual bool | is_init () const =0 |
virtual std::string | to_string () const =0 |
virtual bool | equals (const abstract_vector< T, S > &rhs) const =0 |
virtual void | finish_assembly ()=0 |
virtual void | forward (abstract_vector< T, S > &out, scattering &sc, bool add=false)=0 |
virtual void | backward (abstract_vector< T, S > &out, scattering &sc, bool add=false)=0 |
virtual void | apply_scattering (scattering &sc, bool fwd)=0 |
size_t | write_ascii (const char *file, bool write_header) |
template<typename V > | |
size_t | write_binary (FILE *fd) |
Write a vector to HD in binary. File descriptor is already set up. More... | |
template<typename V > | |
size_t | write_binary (std::string file) |
write binary. Open file descriptor myself. More... | |
template<typename V > | |
size_t | read_binary (FILE *fd) |
template<typename V > | |
size_t | read_binary (std::string file) |
size_t | read_ascii (FILE *fd) |
size_t | read_ascii (std::string file) |
Public Attributes | |
const meshdata< mesh_int_t, mesh_real_t > * | mesh = NULL |
the connected mesh More... | |
int | dpn = 0 |
d.o.f. per mesh vertex. More... | |
ltype | layout = unset |
used vector layout (nodal, algebraic, unset) More... | |
An abstract class representing a (possibly distributed) vector.
It is connected to a mesh and offers some convenience features w.r.t. setup and function calls. This is an interface definition, for concrete implementations see the petsc_vector or ginkgo_vector classes.
T | Integer type (indices). |
S | Floating point type (values). |
Definition at line 54 of file SF_abstract_vector.h.
enum SF::abstract_vector::ltype |
Enumeration of layout types for the vector
Enumerator | |
---|---|
algebraic | |
nodal | |
elemwise | |
unset |
Definition at line 59 of file SF_abstract_vector.h.
|
virtualdefault |
Default destructor
|
pure virtual |
Adds vec scaled by k to this vector (i.e., BLAS axpy).
vec | The second vector to scale and multiply this vector with. |
k | The scalar. |
|
pure virtual |
Apply the scattering sc to this vector.
sc | The scattering class. |
fwd | Use forward or backwdard scattering. |
|
pure virtual |
Backward scattering. This object is input (from).
out | Scatter to. |
sc | The scattering class. |
add | Use additive scattering or overwrite. |
|
pure virtual |
Get a const host pointer to the local data. Use const_release_ptr when done.
|
pure virtual |
Release a const pointer to local data
p | the const pointer to release |
|
pure virtual |
Deep copy into this vector from another abstract_vector.
v | The vector to copy from. |
: unify with operator= ?
|
pure virtual |
Compute the dot product of this vector and the vector v.
v | The other vector used in the dot product. |
|
pure virtual |
Whether the this vector and rhs are equal.
|
pure virtual |
Mark the assembly as finished.
|
pure virtual |
Forward scattering. This object is input (from).
out | Scatter to. |
sc | The scattering class. |
add | Use additive scattering or overwrite. |
|
pure virtual |
Get the values at the requested indices
idx | The indices to get. |
out | The values at the requested indices. |
|
pure virtual |
Get the value of one index
idx | The index to get. |
|
pure virtual |
Get the range of indices owned by this processor.
start | the first index owned. |
stop | one more than the last index owned. |
|
pure virtual |
Get the global size.
|
pure virtual |
Init the vector dimensions based on a give mesh.
imesh | The mesh defining the parallel layout of the vector. |
idpn | The number of d.o.f. per mesh vertex. |
inp_layout | The vector layout. |
|
pure virtual |
Initialize a vector from the setup of another given vector.
vec | Vector to replicate the setup from. |
|
pure virtual |
Initialize a vector directly with set sizes.
igsize | Global size |
ilsize | Local size |
idpn | Number of d.o.f. used per mesh node |
ilayout | Vector layout w.r.t. used mesh. |
|
inline |
Non backend-specific vector initialization based on a mesh.
imesh | The mesh defining the parallel layout of the vector. |
idpn | The number of d.o.f. per mesh vertex. |
inp_layout | The vector layout. |
Definition at line 105 of file SF_abstract_vector.h.
|
pure virtual |
Whether the vector is initialized.
|
pure virtual |
Get the local size.
|
pure virtual |
Compute the L2 norm of this vector.
|
pure virtual |
Find the minimum value of this vector.
|
pure virtual |
Convenient operator overload to multiply the vector by a scalar.
sca | The scalar to multiply the vector by. |
|
pure virtual |
Convenient operator overload to multiply the vector by another.
vec | The second vector to multiply this vector with. |
|
pure virtual |
Convenient operator overload to add the vector with another.
vec | The second vector to add this vector with. |
|
pure virtual |
Convenient operator overload to add a scalar to this vector (vector shift).
c | The scalar to add. |
|
pure virtual |
Convenient operator overload to substract the vector by another.
vec | The second vector to substract this vector with. |
|
pure virtual |
Convenient operator overload to divide the vector by a scalar.
sca | The scalar to divide the vector by. |
|
pure virtual |
Deep copy into this vector from a standard (CPU-based) vector.
rhs | The vector to copy from. |
|
pure virtual |
Deep copy into this vector from another abstract_vector.
rhs | The vector to copy from. |
|
pure virtual |
Create a subvector which is defined on a superset of procs and has the same layout
Processes not part of the original owner set will have no data
sub | the vector on the subnodes |
member | true if the process is part of the original vector |
offset | offset of new vector into original |
sz | number of entries to extract from original, -1=all |
share | use the same memory |
|
pure virtual |
Get a host pointer to the local data. Use release_ptr when done.
|
inline |
|
inline |
Definition at line 619 of file SF_abstract_vector.h.
|
inline |
|
inline |
Definition at line 578 of file SF_abstract_vector.h.
|
pure virtual |
Release a pointer to local data
p | the pointer to release |
|
pure virtual |
Set the vector values.
idx | The global indices where to set. |
vals | The values to set. |
additive | Whether to add into the current values or overwrite them. |
|
pure virtual |
Set the specified vector indices to one value.
idx | The indices where to set. |
val | The value to set. |
|
pure virtual |
Set the whole vector to one value.
val | The value to set. |
|
pure virtual |
Set one index to a specific value.
idx | The index to be set. |
val | The value to set. |
|
pure virtual |
Shallow copy into this vector from another abstract_vector.
I.e., copy the internal pointers only.
v | The vector to copy from. |
|
pure virtual |
Compute the sum of elements of this vector.
|
pure virtual |
A string format for the current vector.
|
inline |
Write the vector to a file
file | The file to write to. |
write_header | Whether to write the header as well |
Definition at line 436 of file SF_abstract_vector.h.
|
inline |
Write a vector to HD in binary. File descriptor is already set up.
File descriptor is not closed by this function.
fd | The already set up file descriptor. |
Definition at line 510 of file SF_abstract_vector.h.
|
inline |
write binary. Open file descriptor myself.
Definition at line 530 of file SF_abstract_vector.h.
int SF::abstract_vector< T, S >::dpn = 0 |
d.o.f. per mesh vertex.
Definition at line 62 of file SF_abstract_vector.h.
ltype SF::abstract_vector< T, S >::layout = unset |
used vector layout (nodal, algebraic, unset)
Definition at line 63 of file SF_abstract_vector.h.
const meshdata<mesh_int_t,mesh_real_t>* SF::abstract_vector< T, S >::mesh = NULL |
the connected mesh
Definition at line 61 of file SF_abstract_vector.h.