Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
Epetra_Util Class Reference

Epetra_Util: The Epetra Util Wrapper Class. More...

#include <Epetra_Util.h>

Public Member Functions

 Epetra_Util ()
 Epetra_Util Constructor. More...
 
 Epetra_Util (const Epetra_Util &Util)
 Epetra_Util Copy Constructor. More...
 
virtual ~Epetra_Util ()
 Epetra_Util Destructor. More...
 
template<typename T >
void Sort (bool SortAscending, int NumKeys, T *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
 

Static Public Member Functions

template<typename T >
static void EPETRA_LIB_DLL_EXPORT Sort (bool SortAscending, int NumKeys, T *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
 Epetra_Util Sort Routine (Shell sort) More...
 
static void Sort (bool SortAscending, int NumKeys, int *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
 
static void Sort (bool SortAscending, int NumKeys, long long *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
 
static void Sort (bool SortAscending, int NumKeys, int *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions)
 
static void Sort (bool SortAscending, int NumKeys, double *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
 
static Epetra_Map Create_Root_Map (const Epetra_Map &usermap, int root=0)
 Epetra_Util Create_Root_Map function. More...
 
static Epetra_Map Create_OneToOne_Map (const Epetra_Map &usermap, bool high_rank_proc_owns_shared=false)
 Epetra_Util Create_OneToOne_Map function. More...
 
static Epetra_BlockMap Create_OneToOne_BlockMap (const Epetra_BlockMap &usermap, bool high_rank_proc_owns_shared=false)
 Epetra_Util Create_OneToOne_Map function. More...
 
static Epetra_BlockMap Create_OneToOne_BlockMap64 (const Epetra_BlockMap &usermap, bool high_rank_proc_owns_shared=false)
 Epetra_Util Create_OneToOne_Map function for long long ordinals. More...
 
static int SortCrsEntries (int NumRows, const int *CRS_rowptr, int *CRS_colind, double *CRS_vals)
 Epetra_Util SortCrsEntries function. More...
 
static int SortCrsEntries (int NumRows, const size_t *CRS_rowptr, int *CRS_colind, double *CRS_vals)
 Epetra_Util SortCrsEntries function. More...
 
static int SortAndMergeCrsEntries (int NumRows, int *CRS_rowptr, int *CRS_colind, double *CRS_vals)
 Epetra_Util SortAndMergeCrsEntries function. More...
 
static int SortAndMergeCrsEntries (int NumRows, size_t *CRS_rowptr, int *CRS_colind, double *CRS_vals)
 Epetra_Util SortAndMergeCrsEntries function. More...
 
static int GetPidGidPairs (const Epetra_Import &Importer, std::vector< std::pair< int, int > > &gpids, bool use_minus_one_for_local)
 Epetra_Util GetPidGidPairs function. More...
 
static int GetPidGidPairs (const Epetra_Import &Importer, std::vector< std::pair< int, long long > > &gpids, bool use_minus_one_for_local)
 
static int GetPids (const Epetra_Import &Importer, std::vector< int > &pids, bool use_minus_one_for_local)
 Epetra_Util GetPids function. More...
 
static int GetRemotePIDs (const Epetra_Import &Importer, std::vector< int > &RemotePIDs)
 Epetra_Util GetRemotePIDs. More...
 
static double Chop (const double &Value)
 Epetra_Util Chop method. Return zero if input Value is less than ChopValue. More...
 

Static Public Attributes

static const double chopVal_ = 1.0e-15
 

Private Attributes

unsigned int Seed_
 

Random number utilities

unsigned int RandomInt ()
 Returns a random integer on the interval (0, 2^31-1) More...
 
double RandomDouble ()
 Returns a random double on the interval (-1.0,1.0) More...
 
unsigned int Seed () const
 Get seed from Random function. More...
 
int SetSeed (unsigned int Seed_in)
 Set seed for Random function. More...
 

Detailed Description

Epetra_Util: The Epetra Util Wrapper Class.

The Epetra_Util class is a collection of useful functions that cut across a broad

set of other classes.

Epetra_Util is a serial interface only. This is appropriate since the standard utilities are only specified for serial execution (or shared memory parallel).

Definition at line 87 of file Epetra_Util.h.

Constructor & Destructor Documentation

Epetra_Util::Epetra_Util ( )
inline

Epetra_Util Constructor.

Builds an instance of a serial Util object.

Definition at line 278 of file Epetra_Util.h.

Epetra_Util::Epetra_Util ( const Epetra_Util Util)
inline

Epetra_Util Copy Constructor.

Makes an exact copy of an existing Epetra_Util instance.

Definition at line 280 of file Epetra_Util.h.

Epetra_Util::~Epetra_Util ( )
inlinevirtual

Epetra_Util Destructor.

Definition at line 282 of file Epetra_Util.h.

Member Function Documentation

unsigned int Epetra_Util::RandomInt ( )

Returns a random integer on the interval (0, 2^31-1)

Definition at line 71 of file Epetra_Util.cpp.

double Epetra_Util::RandomDouble ( )

Returns a random double on the interval (-1.0,1.0)

Definition at line 90 of file Epetra_Util.cpp.

unsigned int Epetra_Util::Seed ( ) const

Get seed from Random function.

Returns
Current random number seed.

Definition at line 102 of file Epetra_Util.cpp.

int Epetra_Util::SetSeed ( unsigned int  Seed_in)

Set seed for Random function.

Parameters
InSeed - An integer on the interval [1, 2^31-2]
Returns
Integer error code, set to 0 if successful.

Definition at line 107 of file Epetra_Util.cpp.

template<typename T >
static void EPETRA_LIB_DLL_EXPORT Epetra_Util::Sort ( bool  SortAscending,
int  NumKeys,
T *  Keys,
int  NumDoubleCompanions,
double **  DoubleCompanions,
int  NumIntCompanions,
int **  IntCompanions,
int  NumLongLongCompanions,
long long **  LongLongCompanions 
)
static

Epetra_Util Sort Routine (Shell sort)

This function sorts a list of integer values in ascending or descending order. Additionally it sorts any number of companion lists of doubles or ints. A shell sort is used, which is fast if indices are already sorted.

Parameters
InSortAscending - Sort keys in ascending order if true, otherwise sort in descending order..
InNumKeys - Number of integer values to be sorted.
In/OutKeys - List of integers to be sorted.
InNumDoubleCompanions - Number of lists of double precision numbers to be sorted with the key. If set to zero, DoubleCompanions is ignored and can be set to zero.
InDoubleCompanions - DoubleCompanions[i] is a pointer to the ith list of doubles to be sorted with key.
InNumIntCompanions - Number of lists of integers to be sorted with the key. If set to zero, IntCompanions is ignored and can be set to zero.
InIntCompanions - IntCompanions[i] is a pointer to the ith list of integers to be sorted with key.
template void Epetra_Util::Sort< int > ( bool  SortAscending,
int  NumKeys,
int *  Keys,
int  NumDoubleCompanions,
double **  DoubleCompanions,
int  NumIntCompanions,
int **  IntCompanions,
int  NumLongLongCompanions,
long long **  LongLongCompanions 
)
static

Definition at line 158 of file Epetra_Util.cpp.

template void Epetra_Util::Sort< long long > ( bool  SortAscending,
int  NumKeys,
long long *  Keys,
int  NumDoubleCompanions,
double **  DoubleCompanions,
int  NumIntCompanions,
int **  IntCompanions,
int  NumLongLongCompanions,
long long **  LongLongCompanions 
)
static

Definition at line 169 of file Epetra_Util.cpp.

void Epetra_Util::Sort ( bool  SortAscending,
int  NumKeys,
int *  Keys,
int  NumDoubleCompanions,
double **  DoubleCompanions,
int  NumIntCompanions,
int **  IntCompanions 
)
static

Definition at line 192 of file Epetra_Util.cpp.

void Epetra_Util::Sort ( bool  SortAscending,
int  NumKeys,
double *  Keys,
int  NumDoubleCompanions,
double **  DoubleCompanions,
int  NumIntCompanions,
int **  IntCompanions,
int  NumLongLongCompanions,
long long **  LongLongCompanions 
)
static

Definition at line 180 of file Epetra_Util.cpp.

Epetra_Map Epetra_Util::Create_Root_Map ( const Epetra_Map usermap,
int  root = 0 
)
static

Epetra_Util Create_Root_Map function.

Function to create a new Epetra_Map object with all GIDs sent to the root processor which is zero by default. All all processors will have no GIDs. This root map can then be used to create an importer or exporter that will migrate all data to the root processor.

If root is set to -1 then the user map will be replicated completely on all processors.

Definition at line 357 of file Epetra_Util.cpp.

Epetra_Map Epetra_Util::Create_OneToOne_Map ( const Epetra_Map usermap,
bool  high_rank_proc_owns_shared = false 
)
static

Epetra_Util Create_OneToOne_Map function.

Function to create a new Epetra_Map object with 1-to-1 ownership of entries from an existing map which may have entries that appear on multiple processors.

Definition at line 234 of file Epetra_Util.cpp.

Epetra_BlockMap Epetra_Util::Create_OneToOne_BlockMap ( const Epetra_BlockMap usermap,
bool  high_rank_proc_owns_shared = false 
)
static

Epetra_Util Create_OneToOne_Map function.

Function to create a new Epetra_Map object with 1-to-1 ownership of entries from an existing map which may have entries that appear on multiple processors.

Definition at line 378 of file Epetra_Util.cpp.

Epetra_BlockMap Epetra_Util::Create_OneToOne_BlockMap64 ( const Epetra_BlockMap usermap,
bool  high_rank_proc_owns_shared = false 
)
static

Epetra_Util Create_OneToOne_Map function for long long ordinals.

Function to create a new Epetra_Map object with 1-to-1 ownership of entries from an existing map which may have entries that appear on multiple processors.

Definition at line 430 of file Epetra_Util.cpp.

int Epetra_Util::SortCrsEntries ( int  NumRows,
const int *  CRS_rowptr,
int *  CRS_colind,
double *  CRS_vals 
)
static

Epetra_Util SortCrsEntries function.

Definition at line 479 of file Epetra_Util.cpp.

int Epetra_Util::SortCrsEntries ( int  NumRows,
const size_t *  CRS_rowptr,
int *  CRS_colind,
double *  CRS_vals 
)
static

Epetra_Util SortCrsEntries function.

Definition at line 517 of file Epetra_Util.cpp.

int Epetra_Util::SortAndMergeCrsEntries ( int  NumRows,
int *  CRS_rowptr,
int *  CRS_colind,
double *  CRS_vals 
)
static

Epetra_Util SortAndMergeCrsEntries function.

Definition at line 555 of file Epetra_Util.cpp.

int Epetra_Util::SortAndMergeCrsEntries ( int  NumRows,
size_t *  CRS_rowptr,
int *  CRS_colind,
double *  CRS_vals 
)
static

Epetra_Util SortAndMergeCrsEntries function.

Definition at line 616 of file Epetra_Util.cpp.

int Epetra_Util::GetPidGidPairs ( const Epetra_Import Importer,
std::vector< std::pair< int, int > > &  gpids,
bool  use_minus_one_for_local 
)
static

Epetra_Util GetPidGidPairs function.

For each GID in the TargetMap, find who owns the GID in the SourceMap. This works entirely from the Distributor and has no communication at all. This routine only works if your Importer is using an Epetra_MpiDistributor under the hood.

The routine returns (by reference) a std::vector of std::pair<int,int> which contains (PID,GID) pairs. If the use_minus_one_for_local==true, any GIDs owned by this processor get -1 instead of their PID.

Definition at line 679 of file Epetra_Util.cpp.

int Epetra_Util::GetPidGidPairs ( const Epetra_Import Importer,
std::vector< std::pair< int, long long > > &  gpids,
bool  use_minus_one_for_local 
)
static

Definition at line 729 of file Epetra_Util.cpp.

int Epetra_Util::GetPids ( const Epetra_Import Importer,
std::vector< int > &  pids,
bool  use_minus_one_for_local 
)
static

Epetra_Util GetPids function.

Like GetPidGidPairs, but just gets the PIDs, ordered by the columnmap

Definition at line 779 of file Epetra_Util.cpp.

int Epetra_Util::GetRemotePIDs ( const Epetra_Import Importer,
std::vector< int > &  RemotePIDs 
)
static

Epetra_Util GetRemotePIDs.

Gets a list of remote PIDs from an importer in the order corresponding to the RemoteLIDs

Definition at line 825 of file Epetra_Util.cpp.

double Epetra_Util::Chop ( const double &  Value)
static

Epetra_Util Chop method. Return zero if input Value is less than ChopValue.

Definition at line 65 of file Epetra_Util.cpp.

template<typename T >
void Epetra_Util::Sort ( bool  SortAscending,
int  NumKeys,
T *  Keys,
int  NumDoubleCompanions,
double **  DoubleCompanions,
int  NumIntCompanions,
int **  IntCompanions,
int  NumLongLongCompanions,
long long **  LongLongCompanions 
)

Definition at line 114 of file Epetra_Util.cpp.

Member Data Documentation

const double Epetra_Util::chopVal_ = 1.0e-15
static

Definition at line 270 of file Epetra_Util.h.

unsigned int Epetra_Util::Seed_
private

Definition at line 273 of file Epetra_Util.h.


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