21template <
typename ScalarT >
35 : comm_( distributed_domain.
comm() )
54 if ( c.size() != x.size() )
56 throw std::runtime_error(
"VectorQ1Scalar::lincomb: c and x must have the same size" );
63 else if ( x.size() == 1 )
67 else if ( x.size() == 2 )
71 else if ( x.size() == 3 )
78 throw std::runtime_error(
"VectorFVScalar::lincomb: not implemented" );
93 static_cast< int >( grid_data_.extent( 0 ) ),
94 static_cast< int >( grid_data_.extent( 1 ) - 1 ),
95 static_cast< int >( grid_data_.extent( 2 ) - 1 ),
96 static_cast< int >( grid_data_.extent( 3 ) - 1 ) },
123 grid_data_.extent( 0 ),
124 grid_data_.extent( 1 ) - 1,
125 grid_data_.extent( 2 ) - 1,
126 grid_data_.extent( 3 ) - 1 },
140 std::swap( grid_data_, other.grid_data_ );
141 std::swap( comm_, other.comm_ );
150 MPI_Comm
comm()
const {
return comm_; }
154 MPI_Comm comm_ = MPI_COMM_WORLD;
158static_assert( VectorLike< VectorFVScalar< double > > );
168template <
typename ScalarT,
int VecDim = 3 >
182 : comm_( distributed_domain.
comm() )
201 if ( c.size() != x.size() )
203 throw std::runtime_error(
"VectorQ1Scalar::lincomb: c and x must have the same size" );
210 else if ( x.size() == 1 )
214 else if ( x.size() == 2 )
218 else if ( x.size() == 3 )
225 throw std::runtime_error(
"VectorFVScalar::lincomb: not implemented" );
240 static_cast< int >( grid_data_.extent( 0 ) ),
241 static_cast< int >( grid_data_.extent( 1 ) - 1 ),
242 static_cast< int >( grid_data_.extent( 2 ) - 1 ),
243 static_cast< int >( grid_data_.extent( 3 ) - 1 ),
270 grid_data_.extent( 0 ),
271 grid_data_.extent( 1 ) - 1,
272 grid_data_.extent( 2 ) - 1,
273 grid_data_.extent( 3 ) - 1,
287 std::swap( grid_data_, other.grid_data_ );
288 std::swap( comm_, other.comm_ );
297 MPI_Comm
comm()
const {
return comm_; }
301 MPI_Comm comm_ = MPI_COMM_WORLD;
305static_assert( VectorLike< VectorFVVec< double > > );
Parallel data structure organizing the thick spherical shell metadata for distributed (MPI parallel) ...
Definition spherical_shell.hpp:2518
const std::map< SubdomainInfo, std::tuple< LocalSubdomainIdx, SubdomainNeighborhood > > & subdomains() const
Definition spherical_shell.hpp:2650
const DomainInfo & domain_info() const
Returns a const reference.
Definition spherical_shell.hpp:2647
int subdomain_num_nodes_radially() const
Equivalent to calling subdomain_num_nodes_radially( subdomain_refinement_level() )
Definition spherical_shell.hpp:861
int subdomain_num_nodes_per_side_laterally() const
Equivalent to calling subdomain_num_nodes_per_side_laterally( subdomain_refinement_level() )
Definition spherical_shell.hpp:852
Finite volume vector on distributed shell grid with one DoF per hex (merging 2 wedges) and ghost-laye...
Definition vector_fv.hpp:23
ScalarT ScalarType
Scalar type of the vector.
Definition vector_fv.hpp:26
grid::Grid4DDataScalar< ScalarType > & grid_data()
Get mutable reference to grid data.
Definition vector_fv.hpp:147
const grid::Grid4DDataScalar< ScalarType > & grid_data() const
Get const reference to grid data.
Definition vector_fv.hpp:145
void swap_impl(VectorFVScalar &other)
Swap implementation for VectorLike concept. Exchanges grid_data and mask_data with another vector.
Definition vector_fv.hpp:138
void lincomb_impl(const std::vector< ScalarType > &c, const std::vector< VectorFVScalar > &x, const ScalarType c0)
Linear combination implementation for VectorLike concept. Computes: .
Definition vector_fv.hpp:52
bool has_nan_or_inf_impl() const
NaN/Inf check implementation for VectorLike concept. Returns true if any entry of grid_data is NaN or...
Definition vector_fv.hpp:133
void invert_entries_impl()
Invert entries implementation for VectorLike concept. Computes: .
Definition vector_fv.hpp:102
void scale_with_vector_impl(const VectorFVScalar &x)
Elementwise scaling implementation for VectorLike concept. Computes: .
Definition vector_fv.hpp:107
ScalarType dot_impl(const VectorFVScalar &x) const
Dot product implementation for VectorLike concept. Computes: over owned nodes.
Definition vector_fv.hpp:86
ScalarType max_abs_entry_impl() const
Max absolute entry implementation for VectorLike concept. Computes: .
Definition vector_fv.hpp:117
MPI_Comm comm() const
MPI communicator this vector's reductions run on.
Definition vector_fv.hpp:150
VectorFVScalar()=default
Default constructor.
void randomize_impl()
Randomize entries implementation for VectorLike concept. Sets each entry of grid_data to a random val...
Definition vector_fv.hpp:112
VectorFVScalar(const std::string &label, const grid::shell::DistributedDomain &distributed_domain)
Construct a scalar finite volume vector with label and domain.
Definition vector_fv.hpp:34
Static assertion: VectorQ1Scalar satisfies VectorLike concept.
Definition vector_fv.hpp:170
void randomize_impl()
Randomize entries implementation for VectorLike concept. Sets each entry of grid_data to a random val...
Definition vector_fv.hpp:259
ScalarType dot_impl(const VectorFVVec &x) const
Dot product implementation for VectorLike concept. Computes: over owned nodes.
Definition vector_fv.hpp:233
void lincomb_impl(const std::vector< ScalarType > &c, const std::vector< VectorFVVec > &x, const ScalarType c0)
Linear combination implementation for VectorLike concept. Computes: .
Definition vector_fv.hpp:199
VectorFVVec(const std::string &label, const grid::shell::DistributedDomain &distributed_domain)
Construct a scalar finite volume vector with label and domain.
Definition vector_fv.hpp:181
VectorFVVec()=default
Default constructor.
void swap_impl(VectorFVVec &other)
Swap implementation for VectorLike concept. Exchanges grid_data and mask_data with another vector.
Definition vector_fv.hpp:285
MPI_Comm comm() const
MPI communicator this vector's reductions run on.
Definition vector_fv.hpp:297
void scale_with_vector_impl(const VectorFVVec &x)
Elementwise scaling implementation for VectorLike concept. Computes: .
Definition vector_fv.hpp:254
ScalarT ScalarType
Scalar type of the vector.
Definition vector_fv.hpp:173
grid::Grid4DDataVec< ScalarType, VecDim > & grid_data()
Get mutable reference to grid data.
Definition vector_fv.hpp:294
bool has_nan_or_inf_impl() const
NaN/Inf check implementation for VectorLike concept. Returns true if any entry of grid_data is NaN or...
Definition vector_fv.hpp:280
void invert_entries_impl()
Invert entries implementation for VectorLike concept. Computes: .
Definition vector_fv.hpp:249
const grid::Grid4DDataVec< ScalarType, VecDim > & grid_data() const
Get const reference to grid data.
Definition vector_fv.hpp:292
ScalarType max_abs_entry_impl() const
Max absolute entry implementation for VectorLike concept. Computes: .
Definition vector_fv.hpp:264
Kokkos::View< ScalarType ****, Layout > Grid4DDataScalar
Definition grid_types.hpp:27
void invert_inplace(const grid::Grid4DDataScalar< ScalarType > &y)
Definition grid_operations.hpp:232
bool has_nan_or_inf(const grid::Grid4DDataScalar< ScalarType > &x, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:704
ScalarType max_abs_entry_subset(const grid::Grid4DDataScalar< ScalarType > &x, dense::Vec< int, 4 > start, dense::Vec< int, 4 > end_excl, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:377
void set_constant(const grid::Grid2DDataScalar< ScalarType > &x, ScalarType value)
Definition grid_operations.hpp:12
void mult_elementwise_inplace(const grid::Grid4DDataScalar< ScalarType > &y, const grid::Grid4DDataScalar< ScalarType > &x)
Definition grid_operations.hpp:252
void rand(const grid::Grid4DDataScalar< ScalarTypeDst > &dst)
Definition grid_operations.hpp:749
void lincomb(const grid::Grid4DDataScalar< ScalarType > &y, ScalarType c_0, ScalarType c_1, const grid::Grid4DDataScalar< ScalarType > &x_1)
Definition grid_operations.hpp:133
ScalarType dot_product_subset(const grid::Grid4DDataScalar< ScalarType > &x, const grid::Grid4DDataScalar< ScalarType > &y, dense::Vec< int, 4 > start, dense::Vec< int, 4 > end_excl, MPI_Comm comm=MPI_COMM_WORLD)
Definition grid_operations.hpp:676
Contains linear algebra utilities and functions for the Terra project.
Definition inv_rho_drho_dt.hpp:12
SoA (Structure-of-Arrays) 4D vector grid data.
Definition grid_types.hpp:51