Skip to content
Snippets Groups Projects
Commit e5d797df authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Only small modifications.

parent 6ad371c1
No related branches found
No related tags found
No related merge requests found
...@@ -50,18 +50,15 @@ namespace AMDiS { ...@@ -50,18 +50,15 @@ namespace AMDiS {
creator = NEW DiagonalPreconditioner::Creator; creator = NEW DiagonalPreconditioner::Creator;
addCreator("diag", creator); addCreator("diag", creator);
creator = NEW IdentityPreconditioner::Creator;
addCreator("no", creator);
creator = NEW ILUPreconditioner::Creator; creator = NEW ILUPreconditioner::Creator;
addCreator("ilu", creator); addCreator("ilu", creator);
creator = NEW ICPreconditioner::Creator; creator = NEW ICPreconditioner::Creator;
addCreator("ic", creator); addCreator("ic", creator);
}
creator = NEW IdentityPreconditioner::Creator;
addCreator("no", creator);
}
#if 0 #if 0
template<> template<>
......
...@@ -42,9 +42,7 @@ namespace AMDiS { ...@@ -42,9 +42,7 @@ namespace AMDiS {
class CreatorMap class CreatorMap
{ {
public: public:
/** \brief /// Adds a new creator together with the given key to the map.
* Adds a new creator together with the given key to the map.
*/
static void addCreator(std::string key, CreatorInterface<BaseClass>* creator) static void addCreator(std::string key, CreatorInterface<BaseClass>* creator)
{ {
FUNCNAME("CreatorMap::addCreator()"); FUNCNAME("CreatorMap::addCreator()");
...@@ -54,9 +52,7 @@ namespace AMDiS { ...@@ -54,9 +52,7 @@ namespace AMDiS {
creatorMap[key] = creator; creatorMap[key] = creator;
} }
/** \brief /// Creates a object of the type corresponding to key.
* Creates a object of the type corresponding to key.
*/
static CreatorInterface<BaseClass>* getCreator(std::string key) { static CreatorInterface<BaseClass>* getCreator(std::string key) {
FUNCNAME("CreatorMap::getCreator()"); FUNCNAME("CreatorMap::getCreator()");
init(); init();
...@@ -69,24 +65,19 @@ namespace AMDiS { ...@@ -69,24 +65,19 @@ namespace AMDiS {
static void addDefaultCreators(); static void addDefaultCreators();
protected: protected:
/** \brief /// Constructor is protected because derived maps should be singleton.
* Constructor is protected because derived maps should be singleton. static void init() {
*/ if (!initialized) {
static void init() { initialized = true;
if(!initialized) { NullCreator<BaseClass> *nullCreator = new NullCreator<BaseClass>;
initialized = true; addCreator("0", nullCreator);
NullCreator<BaseClass> *nullCreator = new NullCreator<BaseClass>; addDefaultCreators();
// addCreator("no", nullCreator); }
addCreator("0", nullCreator); }
addDefaultCreators();
}
};
protected: protected:
/** \brief /// STL map containing the pairs of keys and creators.
* STL map containing the pairs of keys and creators.
*/
static std::map< std::string, CreatorInterface<BaseClass>* > creatorMap; static std::map< std::string, CreatorInterface<BaseClass>* > creatorMap;
static bool initialized; static bool initialized;
......
...@@ -8,11 +8,7 @@ namespace AMDiS { ...@@ -8,11 +8,7 @@ namespace AMDiS {
{ {
typename std::map< std::string, CreatorInterface<BaseClass>* >::iterator it; typename std::map< std::string, CreatorInterface<BaseClass>* >::iterator it;
for (it = creatorMap.begin(); for (it = creatorMap.begin(); it != creatorMap.end(); ++it)
it != creatorMap.end();
++it) {
DELETE it->second; DELETE it->second;
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment