Advanced Multi-Physics (AMP)
On-Line Documentation
StridedVectorSelector.h
Go to the documentation of this file.
1#ifndef included_AMP_test_StridedVectorFactory
2#define included_AMP_test_StridedVectorFactory
3
4#include "AMP/utils/UnitTest.h"
5#include "AMP/vectors/MultiVector.h"
6#include "AMP/vectors/VectorSelector.h"
7#include "AMP/vectors/testHelpers/VectorTests.h"
8
9
10namespace AMP::LinearAlgebra {
11
12
14{
15public:
16 explicit StridedVectorFactory( std::shared_ptr<const VectorFactory> factory )
17 : d_factory( factory )
18 {
19 }
21 {
22 auto vec = d_factory->getVector();
23 auto criterion = AMP::LinearAlgebra::VS_Stride( 1, 3 );
24 auto vec_select = vec->select( criterion );
25 size_t N1 = vec->getGlobalSize();
26 size_t N2 = vec_select->getGlobalSize();
27 AMP_ASSERT( N1 / 3 == N2 );
28 return vec_select;
29 }
30 std::string name() const override { return "StridedVectorFactory<" + d_factory->name() + ">"; }
31
32private:
33 std::shared_ptr<const VectorFactory> d_factory;
34};
35
36
37} // namespace AMP::LinearAlgebra
38
39#endif
std::shared_ptr< const VectorFactory > d_factory
AMP::LinearAlgebra::Vector::shared_ptr getVector() const override
StridedVectorFactory(std::shared_ptr< const VectorFactory > factory)
Create a subset based on a stride in the vector.
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60
#define AMP_ASSERT(EXP)
Assert error.



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page