Advanced Multi-Physics (AMP)
On-Line Documentation
SubsetVector Class Reference

This vector is a subset of an AMP Vector. More...

#include <SubsetVectorData.h>

Detailed Description

This vector is a subset of an AMP Vector.

Given an AMP Vector, this class will create a view of a subset of the vector. For instance, if \(\mathbf{a} = \{ a_0 a_1 a_2 \ldots a_n\}\), and \(S\) is a set of non-negative integers \(( s_0 s_1 \ldots s_m )\) such that \(0 \le s_i \le n\), then the SubsetVector will be the vector \(\mathbf{a}_S = \{ a_{s_0} a_{s_1} a_{s_2} \ldots a_{s_m}\} \).

This class provides a factory method called view:

auto vec2 = AMP::SubsetVector( vec1 , subsetVar );
auto vec3 = vec2->clone();
vec3->setName( "subset2" );
\code
Since this is a view, any change to vec2 will be reflected on vec1 and
vice versa. vec2 is a sparse vector, with a mapping of new index to old.
vec3, on the other hand, is a dense vector without an index. If a lot
of computation is necessary on the sparse vector, the data can be copied
in and out:
\code
// Subset the vector to make a sparse vector.
vec2 = AMP::SubsetVector( vec1 , subsetVar )
// Copy the sparse vector data to a dense vector
vec3.copyVector( vec2 );
// Perform whatever math
performComputation( vec3 );
// Copy data back to vec2, and, consequently, vec1
vec2.copyVector( vec3 );
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60

The documentation for this class was generated from the following file:



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