EpetraExt Development
Zoltan_MigrationContainer.cpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Copyright Notice
00003 //
00004 // Copyright (c) 2000, Sandia Corporation, Albuquerque, NM.
00005 //-------------------------------------------------------------------------
00006 
00007 //-------------------------------------------------------------------------
00008 // Filename       : $Zoltan_MigrationContainer.h$
00009 //
00010 // Purpose        : Static container object allowing C style calls
00011 //        from Zoltan to access Dynamic MigrationObject's.
00012 //
00013 // Special Notes  : 
00014 //
00015 // Creator        : Robert J. Hoekstra, Parallel Computational Science
00016 //
00017 // Creation Date  : 08/04/2000
00018 //
00019 // Revision Information:
00020 // ---------------------
00021 //
00022 // Revision Number: $$
00023 //
00024 // Revision Date  : $$
00025 //
00026 // Current Owner  : $$
00027 //-------------------------------------------------------------------------
00028 
00029 #include <Zoltan_MigrationContainer.h>
00030 
00031 #include <Zoltan_MigrationObject.h>
00032 
00033 
00034 int Zoltan::MigrationContainer::CurrentObject = 0;
00035 
00036 std::map< int, Zoltan::MigrationObject * > Zoltan::MigrationContainer::StaticMap;
00037 
00038 void Zoltan::MigrationContainer::setMigrationID( const int & id )
00039 {
00040   CurrentObject = id;
00041 }
00042 
00043 const int & Zoltan::MigrationContainer::getMigrationID()
00044 {
00045   return CurrentObject;
00046 }
00047 
00048 bool Zoltan::MigrationContainer::registerMigrationObject( const int & id, 
00049     Zoltan::MigrationObject * obj_ptr )
00050 {
00051   if( StaticMap.find( id ) == StaticMap.end() )
00052   {
00053     StaticMap[ id ] = obj_ptr;
00054     return true;
00055   }
00056   else
00057   {
00058     // Redundant id
00059     return false;
00060   }
00061 }
00062 
00063 Zoltan::MigrationObject * Zoltan::MigrationContainer::getMigrationObject(
00064   const int & id )
00065 {
00066   if( StaticMap.find( id ) != StaticMap.end() )
00067   {
00068     return StaticMap[ id ];
00069   }
00070   else
00071   {
00072     // Not found
00073     return 0;
00074   }
00075 }
00076 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines