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

Epetra_MapColoring: A class for coloring Epetra_Map and Epetra_BlockMap objects. More...

#include <Epetra_MapColoring.h>

Inheritance diagram for Epetra_MapColoring:
Inheritance graph
[legend]

Classes

struct  ListItem
 

Private Member Functions

int Allocate (int *ElementColors, int Increment)
 
int GenerateLists () const
 
int DeleteLists () const
 
bool InItemList (int ColorValue) const
 
int CheckSizes (const Epetra_SrcDistObject &A)
 Allows the source and target (this) objects to be compared for compatibility, return nonzero if not. More...
 
int CopyAndPermute (const Epetra_SrcDistObject &Source, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode=Zero)
 Perform ID copies and permutations that are on processor. More...
 
int PackAndPrepare (const Epetra_SrcDistObject &Source, int NumExportIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &SizeOfPacket, int *Sizes, bool &VarSizes, Epetra_Distributor &Distor)
 Perform any packing or preparation required for call to DoTransfer(). More...
 
int UnpackAndCombine (const Epetra_SrcDistObject &Source, int NumImportIDs, int *ImportLIDs, int LenImports, char *Imports, int &SizeOfPacket, Epetra_Distributor &Distor, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor)
 Perform any unpacking and combining after call to DoTransfer(). More...
 
Epetra_MapColoringoperator= (const Epetra_MapColoring &Coloring)
 
template<typename int_type >
Epetra_MapTGenerateMap (int Color) const
 
template<typename int_type >
Epetra_BlockMapTGenerateBlockMap (int Color) const
 

Private Attributes

int DefaultColor_
 
Epetra_HashTable< int > * ColorIDs_
 
ListItemFirstColor_
 
int NumColors_
 
int * ListOfColors_
 
int * ColorCount_
 
int * ElementColors_
 
int ** ColorLists_
 
bool Allocated_
 
bool ListsAreGenerated_
 
bool ListsAreValid_
 

Constructors/destructors

 Epetra_MapColoring (const Epetra_BlockMap &Map, const int DefaultColor=0)
 Epetra_MapColoring basic constructor. More...
 
 Epetra_MapColoring (const Epetra_BlockMap &Map, int *ElementColors, const int DefaultColor=0)
 Epetra_MapColoring constructor. More...
 
 Epetra_MapColoring (const Epetra_MapColoring &Source)
 Epetra_MapColoring copy constructor. More...
 
virtual ~Epetra_MapColoring ()
 Epetra_MapColoring destructor. More...
 

Set Color methods

int & operator[] (int LID)
 LID element color assignment method. More...
 
int & operator() (long long GID)
 GID element color assignment method, Note: Valid only for GIDs owned by calling processor. More...
 

Local/Global color accessor methods

const int & operator[] (int LID) const
 LID element color access method. More...
 
const int & operator() (long long GID) const
 GID element color assignment method, Note: Valid only for GIDs owned by calling processor. More...
 

Color Information Access Methods

int NumColors () const
 Returns number of colors on the calling processor. More...
 
int MaxNumColors () const
 Returns maximum over all processors of the number of colors. More...
 
int * ListOfColors () const
 Array of length NumColors() containing List of color values used in this coloring. More...
 
int DefaultColor () const
 Returns default color. More...
 
int NumElementsWithColor (int Color) const
 Returns number of map elements on calling processor having specified Color. More...
 
int * ColorLIDList (int Color) const
 Returns pointer to array of Map LIDs associated with the specified color. More...
 
int * ElementColors () const
 Returns pointer to array of the colors associated with the LIDs on the calling processor. More...
 

Epetra_Map and Epetra_BlockMap generators

Epetra_MapGenerateMap (int Color) const
 Generates an Epetra_Map of the GIDs associated with the specified color. More...
 
Epetra_BlockMapGenerateBlockMap (int Color) const
 Generates an Epetra_BlockMap of the GIDs associated with the specified color. More...
 

I/O methods

virtual void Print (std::ostream &os) const
 Print method. More...
 

Additional Inherited Members

- Public Member Functions inherited from Epetra_DistObject
 Epetra_DistObject (const Epetra_BlockMap &Map)
 Basic Epetra_DistObject constuctor. More...
 
 Epetra_DistObject (const Epetra_BlockMap &Map, const char *const Label)
 
 Epetra_DistObject (const Epetra_DistObject &Source)
 Epetra_DistObject copy constructor. More...
 
virtual ~Epetra_DistObject ()
 Epetra_DistObject destructor. More...
 
int Import (const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
 Imports an Epetra_DistObject using the Epetra_Import object. More...
 
int Import (const Epetra_SrcDistObject &A, const Epetra_Export &Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
 Imports an Epetra_DistObject using the Epetra_Export object. More...
 
int Export (const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
 Exports an Epetra_DistObject using the Epetra_Import object. More...
 
int Export (const Epetra_SrcDistObject &A, const Epetra_Export &Exporter, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
 Exports an Epetra_DistObject using the Epetra_Export object. More...
 
const Epetra_BlockMapMap () const
 Returns the address of the Epetra_BlockMap for this multi-vector. More...
 
const Epetra_CommComm () const
 Returns the address of the Epetra_Comm for this multi-vector. More...
 
bool DistributedGlobal () const
 Returns true if this multi-vector is distributed global, i.e., not local replicated. More...
 
- Public Member Functions inherited from Epetra_Object
 Epetra_Object (int TracebackModeIn=-1, bool set_label=true)
 Epetra_Object Constructor. More...
 
 Epetra_Object (const char *const Label, int TracebackModeIn=-1)
 Epetra_Object Constructor. More...
 
 Epetra_Object (const Epetra_Object &Object)
 Epetra_Object Copy Constructor. More...
 
virtual ~Epetra_Object ()
 Epetra_Object Destructor. More...
 
virtual void SetLabel (const char *const Label)
 Epetra_Object Label definition using char *. More...
 
virtual const char * Label () const
 Epetra_Object Label access funtion. More...
 
virtual int ReportError (const std::string Message, int ErrorCode) const
 Error reporting method. More...
 
- Public Member Functions inherited from Epetra_SrcDistObject
virtual ~Epetra_SrcDistObject ()
 Epetra_SrcDistObject destructor. More...
 
- Static Public Member Functions inherited from Epetra_Object
static void SetTracebackMode (int TracebackModeValue)
 Set the value of the Epetra_Object error traceback report mode. More...
 
static int GetTracebackMode ()
 Get the value of the Epetra_Object error report mode. More...
 
static std::ostream & GetTracebackStream ()
 Get the output stream for error reporting. More...
 
- Static Public Attributes inherited from Epetra_Object
static int TracebackMode
 
- Protected Member Functions inherited from Epetra_DistObject
virtual int DoTransfer (const Epetra_SrcDistObject &A, Epetra_CombineMode CombineMode, int NumSameIDs, int NumPermuteIDs, int NumRemoteIDs, int NumExportIDs, int *PermuteToLIDs, int *PermuteFromLIDs, int *RemoteLIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &LenImports, char *&Imports, Epetra_Distributor &Distor, bool DoReverse, const Epetra_OffsetIndex *Indexor)
 Perform actual transfer (redistribution) of data across memory images, using Epetra_Distributor object. More...
 
- Protected Member Functions inherited from Epetra_Object
std::string toString (const int &x) const
 
std::string toString (const long long &x) const
 
std::string toString (const double &x) const
 
- Protected Attributes inherited from Epetra_DistObject
Epetra_BlockMap Map_
 
const Epetra_CommComm_
 
char * Exports_
 
char * Imports_
 
int LenExports_
 
int LenImports_
 
int * Sizes_
 

Detailed Description

Epetra_MapColoring: A class for coloring Epetra_Map and Epetra_BlockMap objects.

This class allows the user to associate an integer value, i.e., a color, to each element of
an existing Epetra_Map or Epetra_BlockMap object.  Colors may be assigned at construction, or
via set methods.  Any elements that are not explicitly assigned a color are assigned the color
0 (integer zero).

This class has the following features:

Definition at line 113 of file Epetra_MapColoring.h.

Constructor & Destructor Documentation

Epetra_MapColoring::Epetra_MapColoring ( const Epetra_BlockMap Map,
const int  DefaultColor = 0 
)

Epetra_MapColoring basic constructor.

Parameters
InMap - An Epetra_Map or Epetra_BlockMap (Note: Epetra_BlockMap is a base class of Epetra_Map, so either can be passed in to this constructor.
InDefaultColor - The integer value to use as the default color for this map. This constructor will initially define the color of all map elements to the default color.
Returns
Pointer to a Epetra_MapColoring object.

Definition at line 69 of file Epetra_MapColoring.cpp.

Epetra_MapColoring::Epetra_MapColoring ( const Epetra_BlockMap Map,
int *  ElementColors,
const int  DefaultColor = 0 
)

Epetra_MapColoring constructor.

Parameters
InMap - An Epetra_Map or Epetra_BlockMap (Note: Epetra_BlockMap is a base class of Epetra_Map, so either can be passed in to this constructor.
InElementColors - Array of dimension Map.NumMyElements() containing the list of colors that should be assigned the map elements on this processor. If this argument is set to 0 (zero), all elements will initially be assigned color 0 (zero). Element colors can be modified by using methods described below.
InDefaultColor - The color that will be assigned by default when no other value is specified. This value has no meaning for this constructor, but is used by certain methods now and in the future.
Returns
Pointer to a Epetra_MapColoring object.

Definition at line 51 of file Epetra_MapColoring.cpp.

Epetra_MapColoring::Epetra_MapColoring ( const Epetra_MapColoring Source)

Epetra_MapColoring copy constructor.

Definition at line 87 of file Epetra_MapColoring.cpp.

Epetra_MapColoring::~Epetra_MapColoring ( )
virtual

Epetra_MapColoring destructor.

Definition at line 104 of file Epetra_MapColoring.cpp.

Member Function Documentation

int& Epetra_MapColoring::operator[] ( int  LID)
inline

LID element color assignment method.

Allows color assignment of ith LID: colormap[i] = color

Returns
MapColor(LID).

Definition at line 170 of file Epetra_MapColoring.h.

int& Epetra_MapColoring::operator() ( long long  GID)
inline

GID element color assignment method, Note: Valid only for GIDs owned by calling processor.

Allows color assignment of specified GID only if the GID is owned by map on the calling processor. If you are unsure about the ownership of a GID, check by using the MyGID() method. MyGID(GID) returns true if the GID is owned by the calling processor.

Returns
MapColor(GID).

Definition at line 178 of file Epetra_MapColoring.h.

const int& Epetra_MapColoring::operator[] ( int  LID) const
inline

LID element color access method.

Returns color of ith LID: colormap[i] = color

Returns
MapColor[LID].

Definition at line 187 of file Epetra_MapColoring.h.

const int& Epetra_MapColoring::operator() ( long long  GID) const
inline

GID element color assignment method, Note: Valid only for GIDs owned by calling processor.

Allows color assignment of specified GID only if the GID is owned by map on the calling processor. If you are unsure about the ownership, check by using the MyGID() method on the map object.

Returns
MapColor(GID).

Definition at line 195 of file Epetra_MapColoring.h.

int Epetra_MapColoring::NumColors ( ) const
inline

Returns number of colors on the calling processor.

Definition at line 201 of file Epetra_MapColoring.h.

int Epetra_MapColoring::MaxNumColors ( ) const

Returns maximum over all processors of the number of colors.

Definition at line 422 of file Epetra_MapColoring.cpp.

int* Epetra_MapColoring::ListOfColors ( ) const
inline

Array of length NumColors() containing List of color values used in this coloring.

Color values can be arbitrary integer values. As a result, a user of a previously constructed MapColoring object may need to know exactly which color values are present. This array contains that information as a sorted list of integer values.

Definition at line 211 of file Epetra_MapColoring.h.

int Epetra_MapColoring::DefaultColor ( ) const
inline

Returns default color.

Definition at line 214 of file Epetra_MapColoring.h.

int Epetra_MapColoring::NumElementsWithColor ( int  Color) const

Returns number of map elements on calling processor having specified Color.

Definition at line 205 of file Epetra_MapColoring.cpp.

int * Epetra_MapColoring::ColorLIDList ( int  Color) const

Returns pointer to array of Map LIDs associated with the specified color.

Returns a pointer to a list of Map LIDs associated with the specified color. This is a purely local list with no information about other processors. If there are no LIDs associated with the specified color, the pointer is set to zero.

Definition at line 214 of file Epetra_MapColoring.cpp.

int* Epetra_MapColoring::ElementColors ( ) const
inline

Returns pointer to array of the colors associated with the LIDs on the calling processor.

Returns a pointer to the list of colors associated with the elements on this processor such that ElementColor[LID] is the color assigned to that LID.

Definition at line 230 of file Epetra_MapColoring.h.

Epetra_Map * Epetra_MapColoring::GenerateMap ( int  Color) const

Generates an Epetra_Map of the GIDs associated with the specified color.

This method will create an Epetra_Map such that on each processor the GIDs associated with the specified color will be part of the map on that processor. Note that this method always generates an Epetra_Map, not an Epetra_BlockMap, even if the map associated with this map coloring is a block map. Once the map is generated, the user is responsible for deleting it.

Definition at line 245 of file Epetra_MapColoring.cpp.

Epetra_BlockMap * Epetra_MapColoring::GenerateBlockMap ( int  Color) const

Generates an Epetra_BlockMap of the GIDs associated with the specified color.

This method will create an Epetra_BlockMap such that on each processor the GIDs associated with the specified color will be part of the map on that processor. Note that this method will generate an Epetra_BlockMap such that each element as the same element size as the corresponding element of map associated with the map coloring. Once the map is generated, the user is responsible for deleting it.

Definition at line 295 of file Epetra_MapColoring.cpp.

void Epetra_MapColoring::Print ( std::ostream &  os) const
virtual

Print method.

Reimplemented from Epetra_DistObject.

Definition at line 312 of file Epetra_MapColoring.cpp.

int Epetra_MapColoring::Allocate ( int *  ElementColors,
int  Increment 
)
private

Definition at line 133 of file Epetra_MapColoring.cpp.

int Epetra_MapColoring::GenerateLists ( ) const
private

Definition at line 146 of file Epetra_MapColoring.cpp.

int Epetra_MapColoring::DeleteLists ( ) const
private

Definition at line 112 of file Epetra_MapColoring.cpp.

bool Epetra_MapColoring::InItemList ( int  ColorValue) const
private

Definition at line 190 of file Epetra_MapColoring.cpp.

int Epetra_MapColoring::CheckSizes ( const Epetra_SrcDistObject Source)
privatevirtual

Allows the source and target (this) objects to be compared for compatibility, return nonzero if not.

Implements Epetra_DistObject.

Definition at line 430 of file Epetra_MapColoring.cpp.

int Epetra_MapColoring::CopyAndPermute ( const Epetra_SrcDistObject Source,
int  NumSameIDs,
int  NumPermuteIDs,
int *  PermuteToLIDs,
int *  PermuteFromLIDs,
const Epetra_OffsetIndex Indexor,
Epetra_CombineMode  CombineMode = Zero 
)
privatevirtual

Perform ID copies and permutations that are on processor.

Implements Epetra_DistObject.

Definition at line 436 of file Epetra_MapColoring.cpp.

int Epetra_MapColoring::PackAndPrepare ( const Epetra_SrcDistObject Source,
int  NumExportIDs,
int *  ExportLIDs,
int &  LenExports,
char *&  Exports,
int &  SizeOfPacket,
int *  Sizes,
bool &  VarSizes,
Epetra_Distributor Distor 
)
privatevirtual

Perform any packing or preparation required for call to DoTransfer().

Implements Epetra_DistObject.

Definition at line 470 of file Epetra_MapColoring.cpp.

int Epetra_MapColoring::UnpackAndCombine ( const Epetra_SrcDistObject Source,
int  NumImportIDs,
int *  ImportLIDs,
int  LenImports,
char *  Imports,
int &  SizeOfPacket,
Epetra_Distributor Distor,
Epetra_CombineMode  CombineMode,
const Epetra_OffsetIndex Indexor 
)
privatevirtual

Perform any unpacking and combining after call to DoTransfer().

Implements Epetra_DistObject.

Definition at line 508 of file Epetra_MapColoring.cpp.

Epetra_MapColoring& Epetra_MapColoring::operator= ( const Epetra_MapColoring Coloring)
private
template<typename int_type >
Epetra_Map * Epetra_MapColoring::TGenerateMap ( int  Color) const
private

Definition at line 224 of file Epetra_MapColoring.cpp.

template<typename int_type >
Epetra_BlockMap * Epetra_MapColoring::TGenerateBlockMap ( int  Color) const
private

Definition at line 263 of file Epetra_MapColoring.cpp.

Member Data Documentation

int Epetra_MapColoring::DefaultColor_
private

Definition at line 312 of file Epetra_MapColoring.h.

Epetra_HashTable<int>* Epetra_MapColoring::ColorIDs_
mutableprivate

Definition at line 313 of file Epetra_MapColoring.h.

ListItem* Epetra_MapColoring::FirstColor_
mutableprivate

Definition at line 314 of file Epetra_MapColoring.h.

int Epetra_MapColoring::NumColors_
mutableprivate

Definition at line 315 of file Epetra_MapColoring.h.

int* Epetra_MapColoring::ListOfColors_
mutableprivate

Definition at line 316 of file Epetra_MapColoring.h.

int* Epetra_MapColoring::ColorCount_
mutableprivate

Definition at line 317 of file Epetra_MapColoring.h.

int* Epetra_MapColoring::ElementColors_
mutableprivate

Definition at line 318 of file Epetra_MapColoring.h.

int** Epetra_MapColoring::ColorLists_
mutableprivate

Definition at line 319 of file Epetra_MapColoring.h.

bool Epetra_MapColoring::Allocated_
private

Definition at line 320 of file Epetra_MapColoring.h.

bool Epetra_MapColoring::ListsAreGenerated_
mutableprivate

Definition at line 321 of file Epetra_MapColoring.h.

bool Epetra_MapColoring::ListsAreValid_
mutableprivate

Definition at line 322 of file Epetra_MapColoring.h.


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