IndexSet
-
class IndexSet : public godzilla::PetscObjectWrapper<IS>
IndexSets are objects used to do efficient indexing into other data structures such asVectorandMatrixPublic Functions
-
void assign(const IndexSet &src)
Replace the content of this index set with the content of another index set.
- Parameters:
src – The index set to copy from
-
void create(MPI_Comm comm)
Creates an index set object.
- Parameters:
comm – The MPI communicator
-
IndexSet complement(Int nmin, Int nmax) const
Generates the complement index set.
That is all indices that are NOT in the given set.
- Parameters:
nmin – The first index desired in the local part of the complement
nmax – The largest index desired in the local part of the complement (note that all indices in this indexs set must be greater or equal to
nminand less thannmax)
-
void destroy()
Destroys an index set.
-
bool is_null() const
Test if the index set is “null”.
- Returns:
trueis the label is null,falseotherwise
-
IndexSet duplicate() const
Creates a duplicate copy of an index set.
- Returns:
The copy of the index set
-
bool equal(const IndexSet &other) const
Compares if this index set has the same set of indices as the
other- Parameters:
other – The index set to compare with
- Returns:
trueif the index sets are equal,falseotherwise
-
bool equal_unsorted(const IndexSet &other) const
Compares if this index set has the same set of indices as the
otherNote
This routine does NOT sort the contents of the index sets before the comparison is made, i.e., the order of indices is important.
- Parameters:
other – The index set to compare with
- Returns:
trueif the index sets are equal,falseotherwise
-
IndexSetBorrowedIndices borrow_indices()
Borrow the indices from this index set.
-
String get_type() const
Gets the index set type name.
- Returns:
The type name
-
void get_point_range(Int &start, Int &end, const Int *&points) const
Returns a description of the points in an IndexSet suitable for traversal.
- Parameters:
start – The first index
end – One past the last index
points – The indices
-
void restore_point_range(Int start, Int end, const Int *points) const
Destroys the traversal description created with
get_point_range- Parameters:
start – The first index
end – One past the last index
points – The indices
-
void get_point_subrange(Int start, Int end, const Int *points) const
Configures the IndexSet to be a subrange for the traversal information given.
- Parameters:
start – The first index of the subrange
end – One past the last index for the subrange
points – The indices for the entire range, from
get_point_range
-
std::tuple<Int, Int> get_min_max() const
Gets the minimum and maximum values.
- Returns:
A tuple containing the minimum and maximum values
-
Int get_size() const
Returns the global length of an index set.
- Returns:
The global size of the index set
-
Int get_local_size() const
Returns the local (processor) length of an index set.
- Returns:
The local size of the index set
-
Int locate(Int key) const
Determine the location of an index within the local component of an index set.
- Parameters:
key – The index to locate
- Returns:
if >= 0, a location within the index set that is equal to the key, otherwise the key is not in the index set
-
bool identity() const
Determines whether index set is the identity mapping.
- Returns:
trueif the index set is the identity mapping,falseotherwise
-
void set_identity()
Sets the index set to be the identity mapping.
-
bool permutation() const
Determines whether index set is a permutation.
- Returns:
trueif the index set is a permutation,falseotherwise
-
void set_permutation()
Informs the index set that it is a permutation.
-
void set_type(String type)
Builds a index set, for a particular type.
- Parameters:
type – The type of index set to build
-
bool empty() const
Checks if the IndexSet is empty (i.e., has no indices)
- Returns:
trueif the index set is empty,falseotherwise
-
void shift(Int offset)
Shift all indices by given offset.
- Parameters:
offset – The offset to shift the indices by
-
bool sorted() const
Checks the indices to determine whether they have been sorted.
- Returns:
trueis index set is sorted
-
void sort() const
Sort the indices of the index set.
-
void sort_remove_dups() const
Sort the indices of the index set, removing duplicates.
-
void view(PetscViewer viewer = PETSC_VIEWER_STDOUT_WORLD) const
View the index set.
- Parameters:
viewer – The PETSc viewer
Public Static Functions
-
static IndexSet create_general(MPI_Comm comm, const std::vector<Int> &idx, CopyMode copy_mode = COPY_VALUES)
Creates a data structure for an index set containing a list of integers.
- Parameters:
comm – The MPI communicator
idx – The length of the index set
copy_mode – The copy mode see,
CopyModefor details
-
static IndexSet intersect(const IndexSet &is1, const IndexSet &is2)
Computes the intersection of two index sets, by sorting and comparing.
- Parameters:
is1 – The first index set
is2 – The second index set
- Returns:
The sorted intersection of
is1andis2
-
static void copy(const IndexSet &src, IndexSet &dest)
Copies an index set.
- Parameters:
src – The index set to copy from
dest – The index set to copy to
-
static IndexSet concatenate(MPI_Comm comm, const std::vector<IndexSet> &is_list)
Forms a new IS by locally concatenating the indices from an IS list without reordering.
- Parameters:
comm – The MPI communicator
is_list – The list of index sets to concatenate
- Returns:
The concatenated index set
-
static IndexSet difference(const IndexSet &is1, const IndexSet &is2)
Computes the difference between two index sets.
- Parameters:
is1 – The first index set, to have items removed from it
is2 – Index values to be removed
- Returns:
The difference between
is1andis2
-
void assign(const IndexSet &src)