oomph::DoubleVectorHelpers Namespace Reference

Namespace for helper functions for DoubleVectors. More...

## Functions

void concatenate (const Vector< DoubleVector * > &in_vector_pt, DoubleVector &out_vector)
Concatenate DoubleVectors. Takes a Vector of DoubleVectors. If the out vector is built, we will not build a new distribution. Otherwise we build a uniform distribution. More...

void concatenate (Vector< DoubleVector > &in_vector, DoubleVector &out_vector)
Wrapper around the other concatenate(...) function. Be careful with Vector of vectors. If the DoubleVectors are resized, there could be reallocation of memory. If we wanted to use the function which takes a Vector of pointers to DoubleVectors, we would either have to invoke new and remember to delete, or create a temporary Vector to store pointers to the DoubleVector objects. This wrapper is meant to make life easier for the user by avoiding calls to new/delete AND without creating a temporary vector of pointers to DoubleVectors. If we had C++ 11, this would be so much nicer since we can use smart pointers which will delete themselves, so we do not have to remember to delete! More...

void split (const DoubleVector &in_vector, Vector< DoubleVector * > &out_vector_pt)
Split a DoubleVector into the out DoubleVectors. Let vec_A be the in Vector, and let vec_B and vec_C be the out vectors. Then the splitting of vec_A is depicted below: vec_A: [a0 (on p0) a1] (on p0) [a2 (on p1) a3] (on p1) More...

void split (const DoubleVector &in_vector, Vector< DoubleVector > &out_vector)
Wrapper around the other split(...) function. Be careful with Vector of vectors. If the DoubleVectors are resized, there could be reallocation of memory. If we wanted to use the function which takes a Vector of pointers to DoubleVectors, we would either have to invoke new and remember to delete, or create a temporary Vector to store pointers to the DoubleVector objects. This wrapper is meant to make life easier for the user by avoiding calls to new/delete AND without creating a temporary vector of pointers to DoubleVectors. If we had C++ 11, this would be so much nicer since we can use smart pointers which will delete themselves, so we do not have to remember to delete! More...

void concatenate_without_communication (const Vector< DoubleVector * > &in_vector_pt, DoubleVector &out_vector)
Concatenate DoubleVectors. Takes a Vector of DoubleVectors. If the out vector is built, we will not build a new distribution. Otherwise a new distribution will be built using LinearAlgebraDistribution::concatenate(...). More...

void concatenate_without_communication (Vector< DoubleVector > &in_vector, DoubleVector &out_vector)
Wrapper around the other concatenate_without_communication(...) function. Be careful with Vector of vectors. If the DoubleVectors are resized, there could be reallocation of memory. If we wanted to use the function which takes a Vector of pointers to DoubleVectors, we would either have to invoke new and remember to delete, or create a temporary Vector to store pointers to the DoubleVector objects. This wrapper is meant to make life easier for the user by avoiding calls to new/delete AND without creating a temporary vector of pointers to DoubleVectors. If we had C++ 11, this would be so much nicer since we can use smart pointers which will delete themselves, so we do not have to remember to delete! More...

void split_without_communication (const DoubleVector &in_vector, Vector< DoubleVector * > &out_vector_pt)
Split a DoubleVector into the out DoubleVectors. Data stays on its current processor, no data is sent between processors. This results in our vectors which are a permutation of the in vector. More...

void split_without_communication (const DoubleVector &in_vector, Vector< DoubleVector > &out_vector)
Wrapper around the other split_without_communication(...) function. Be careful with Vector of vectors. If the DoubleVectors are resized, there could be reallocation of memory. If we wanted to use the function which takes a Vector of pointers to DoubleVectors, we would either have to invoke new and remember to delete, or create a temporary Vector to store pointers to the DoubleVector objects. This wrapper is meant to make life easier for the user by avoiding calls to new/delete AND without creating a temporary vector of pointers to DoubleVectors. If we had C++ 11, this would be so much nicer since we can use smart pointers which will delete themselves, so we do not have to remember to delete! More...

## Detailed Description

Namespace for helper functions for DoubleVectors.

## ◆ concatenate() [1/2]

 void oomph::DoubleVectorHelpers::concatenate ( const Vector< DoubleVector * > & in_vector_pt, DoubleVector & out_vector )

Concatenate DoubleVectors. Takes a Vector of DoubleVectors. If the out vector is built, we will not build a new distribution. Otherwise we build a uniform distribution.

The rows of the out vector is seen "as it is" in the in vectors. For example, if we have DoubleVectors with distributions A and B, distributed across two processors (p0 and p1),

A: [a0] (on p0) B: [b0] (on p0) [a1] (on p1) [b1] (on P1),

then the out_vector is

[a0 (on p0) a1] (on p0) [b0] (on p1) b1] (on p1),

Communication is required between processors. The sum of the global number of rows in the in vectors must equal to the global number of rows in the out vector. This condition must be met if one is to supply an out vector with a distribution, otherwise we can let the function generate the out vector distribution itself.

Definition at line 993 of file double_vector.cc.

## ◆ concatenate() [2/2]

 void oomph::DoubleVectorHelpers::concatenate ( Vector< DoubleVector > & in_vector, DoubleVector & out_vector )

Wrapper around the other concatenate(...) function. Be careful with Vector of vectors. If the DoubleVectors are resized, there could be reallocation of memory. If we wanted to use the function which takes a Vector of pointers to DoubleVectors, we would either have to invoke new and remember to delete, or create a temporary Vector to store pointers to the DoubleVector objects. This wrapper is meant to make life easier for the user by avoiding calls to new/delete AND without creating a temporary vector of pointers to DoubleVectors. If we had C++ 11, this would be so much nicer since we can use smart pointers which will delete themselves, so we do not have to remember to delete!

Definition at line 1381 of file double_vector.cc.

References concatenate(), and i.

## ◆ concatenate_without_communication() [1/2]

 void oomph::DoubleVectorHelpers::concatenate_without_communication ( const Vector< DoubleVector * > & in_vector_pt, DoubleVector & out_vector )

Concatenate DoubleVectors. Takes a Vector of DoubleVectors. If the out vector is built, we will not build a new distribution. Otherwise a new distribution will be built using LinearAlgebraDistribution::concatenate(...).

The out vector has its rows permuted according to the individual distributions of the in vectors. For example, if we have DoubleVectors with distributions A and B, distributed across two processors (p0 and p1),

A: [a0] (on p0) B: [b0] (on p0) [a1] (on p1) [b1] (on P1),

then the out_vector is

[a0 (on p0) b0] (on p0) [a1 (on p1) b1] (on p1),

as opposed to

[a0 (on p0) a1] (on p0) [b0 (on p1) b1] (on p1).

Note (1): The out vector may not be uniformly distributed even if the in vectors have uniform distributions. The nrow_local of the out vector will be the sum of the nrow_local of the in vectors. Try this out with two distributions of global rows 3 and 5, uniformly distributed across two processors. Compare this against a distribution of global row 8 distributed across two processors.

There are no MPI send and receive, the data stays on the processor as defined by the distributions from the in vectors.

The out vector has its rows permuted according to the individual distributions of the in vectors. For example, if we have DoubleVectors with distributions A and B, distributed across two processors (p0 and p1),

A: [a0] (on p0) B: [b0] (on p0) [a1] (on p1) [b1] (on P1),

then the out_vector is

[a0 (on p0) b0] (on p0) [a1 (on p1) b1] (on p1),

as opposed to

[a0 (on p0) a1] (on p0) [b0 (on p1) b1] (on p1).

Note (1): The out vector may not be uniformly distributed even if the the in vectors have uniform distributions. The nrow_local of the out vector will be the sum of the nrow_local of the in vectors. Try this out with two distributions of global rows 3 and 5, uniformly distributed across two processors. Compare this against a distribution of global row 8 distributed across two processors.

There are no MPI send and receive, the data stays on the processor as defined by the distributions from the in vectors.

Definition at line 1856 of file double_vector.cc.

## ◆ concatenate_without_communication() [2/2]

 void oomph::DoubleVectorHelpers::concatenate_without_communication ( Vector< DoubleVector > & in_vector, DoubleVector & out_vector )

Wrapper around the other concatenate_without_communication(...) function. Be careful with Vector of vectors. If the DoubleVectors are resized, there could be reallocation of memory. If we wanted to use the function which takes a Vector of pointers to DoubleVectors, we would either have to invoke new and remember to delete, or create a temporary Vector to store pointers to the DoubleVector objects. This wrapper is meant to make life easier for the user by avoiding calls to new/delete AND without creating a temporary vector of pointers to DoubleVectors. If we had C++ 11, this would be so much nicer since we can use smart pointers which will delete themselves, so we do not have to remember to delete!

Definition at line 2039 of file double_vector.cc.

References concatenate_without_communication(), and i.

## ◆ split() [1/2]

 void oomph::DoubleVectorHelpers::split ( const DoubleVector & in_vector, Vector< DoubleVector * > & out_vector_pt )

Split a DoubleVector into the out DoubleVectors. Let vec_A be the in Vector, and let vec_B and vec_C be the out vectors. Then the splitting of vec_A is depicted below: vec_A: [a0 (on p0) a1] (on p0) [a2 (on p1) a3] (on p1)

vec_B: [a0] (on p0) vec_C: [a2] (on p0) [a1] (on p1) [a3] (on p1)

Communication is required between processors. The out_vector_pt must contain pointers to DoubleVector which has already been built with the correct distribution; the sum of the number of global row of the out vectors must be the same the number of global rows of the in vector.

vec_B: [a0] (on p0) vec_C: [a2] (on p0) [a1] (on p1) [a3] (on p1)

Communication is required between processors. The out_vector_pt must contain pointers to DoubleVector which has already been built with the correct distribution; the sum of the number of global row of the out vectors must be the same the the number of global rows of the in vector.

Definition at line 1413 of file double_vector.cc.

## ◆ split() [2/2]

 void oomph::DoubleVectorHelpers::split ( const DoubleVector & in_vector, Vector< DoubleVector > & out_vector )

Wrapper around the other split(...) function. Be careful with Vector of vectors. If the DoubleVectors are resized, there could be reallocation of memory. If we wanted to use the function which takes a Vector of pointers to DoubleVectors, we would either have to invoke new and remember to delete, or create a temporary Vector to store pointers to the DoubleVector objects. This wrapper is meant to make life easier for the user by avoiding calls to new/delete AND without creating a temporary vector of pointers to DoubleVectors. If we had C++ 11, this would be so much nicer since we can use smart pointers which will delete themselves, so we do not have to remember to delete!

Definition at line 1805 of file double_vector.cc.

References i, and split().

## ◆ split_without_communication() [1/2]

 void oomph::DoubleVectorHelpers::split_without_communication ( const DoubleVector & in_vector, Vector< DoubleVector * > & out_vector_pt )

Split a DoubleVector into the out DoubleVectors. Data stays on its current processor, no data is sent between processors. This results in our vectors which are a permutation of the in vector.

Let vec_A be the in Vector, and let vec_B and vec_C be the out vectors. Then the splitting of vec_A is depicted below: vec_A: [a0 (on p0) a1] (on p0) [a2 (on p1) a3] (on p1)

vec_B: [a0] (on p0) vec_C: [a1] (on p0) [a2] (on p1) [a3] (on p1).

This means that the distribution of the in vector MUST be a concatenation of the out vector distributions, refer to LinearAlgebraDistributionHelpers::concatenate(...) to concatenate distributions.

Definition at line 2075 of file double_vector.cc.

## ◆ split_without_communication() [2/2]

 void oomph::DoubleVectorHelpers::split_without_communication ( const DoubleVector & in_vector, Vector< DoubleVector > & out_vector )

Wrapper around the other split_without_communication(...) function. Be careful with Vector of vectors. If the DoubleVectors are resized, there could be reallocation of memory. If we wanted to use the function which takes a Vector of pointers to DoubleVectors, we would either have to invoke new and remember to delete, or create a temporary Vector to store pointers to the DoubleVector objects. This wrapper is meant to make life easier for the user by avoiding calls to new/delete AND without creating a temporary vector of pointers to DoubleVectors. If we had C++ 11, this would be so much nicer since we can use smart pointers which will delete themselves, so we do not have to remember to delete!

Definition at line 2216 of file double_vector.cc.

References i, and split_without_communication().