Changeset b57b9b for src/mg.cpp
- Timestamp:
- Sep 20, 2012, 1:54:01 PM (13 years ago)
- Children:
- c3acbb
- Parents:
- 2d3854
- File:
-
- 1 edited
-
src/mg.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/mg.cpp
r2d3854 rb57b9b 57 57 #include "base/timer.hpp" 58 58 #include "comm/comm.hpp" 59 #include "cycles/cycle.hpp" 59 60 #include "grid/grid.hpp" 60 61 #include "grid/tempgrid.hpp" … … 130 131 void MG::PostInit() 131 132 { 132 Multigrid* sol = new Multigrid(GetComm(), GetInterface()); 133 sol->Register("SOL"); 134 135 Multigrid* rhs = new Multigrid(GetComm(), GetInterface()); 136 rhs->Register("RHS"); 137 138 TempGrid* temp = new TempGrid(); 139 temp->Register("TEMPGRID"); 140 141 new ObjectStorage<int>("GLOBAL_MAXLEVEL", sol->GlobalMaxLevel()); 142 new ObjectStorage<int>("MINLEVEL", sol->MinLevel()); 143 new ObjectStorage<int>("MAXLEVEL", sol->MaxLevel()); 144 145 GetComm()->PostInit(*GetSol(), *GetRhs()); 133 if (GetFactory().TestObject("COMM") && GetFactory().TestObject("INTERFACE")) { 134 135 Multigrid* sol = new Multigrid(GetComm(), GetInterface()); 136 sol->Register("SOL"); 137 138 Multigrid* rhs = new Multigrid(GetComm(), GetInterface()); 139 rhs->Register("RHS"); 140 141 TempGrid* temp = new TempGrid(); 142 temp->Register("TEMPGRID"); 143 144 new ObjectStorage<int>("GLOBAL_MAXLEVEL", sol->GlobalMaxLevel()); 145 new ObjectStorage<int>("MINLEVEL", sol->MinLevel()); 146 new ObjectStorage<int>("MAXLEVEL", sol->MaxLevel()); 147 148 if (GetFactory().TestObject("CYCLE")) 149 GetCycle()->Generate(); 150 151 if (GetFactory().TestObject("COMM")) 152 GetComm()->PostInit(*GetSol(), *GetRhs()); 153 154 } 146 155 } 147 156 … … 211 220 } 212 221 222 Cycle* MG::GetCycle() 223 { 224 return MG::GetFactory().Get("CYCLE")->Cast<VMG::Cycle>(); 225 } 226 213 227 Discretization* MG::GetDiscretization() 214 228 { … … 261 275 } 262 276 263 static bool CheckObject(std::string id)264 {265 Object *obj = MG::GetFactory().Get(id);266 267 #ifdef DEBUG_OUTPUT268 if (obj == NULL)269 printf("\nMultigrid: CLASS %s NOT INITIALIZED\n\n", id.c_str());270 #endif271 272 return obj != NULL;273 }274 275 277 bool MG::IsInitialized() 276 278 { 279 const Factory& f = GetFactory(); 280 277 281 bool init = true; 278 282 279 init &= CheckObject("COMM");280 init &= CheckObject("LEVEL_OPERATOR");281 init &= CheckObject("RHS");282 init &= CheckObject("SOL");283 init &= CheckObject("SOLVER");284 init &= CheckObject("SMOOTHER");285 init &= CheckObject("DISCRETIZATION");286 init &= CheckObject("MAX_ITERATION");287 init &= CheckObject("PRECISION");288 init &= CheckObject("PRESMOOTHSTEPS");289 init &= CheckObject("POSTSMOOTHSTEPS");290 init &= CheckObject("COMMANDLIST_INIT");291 init &= CheckObject("COMMANDLIST_LOOP");292 init &= CheckObject("COMMANDLIST_FINALIZE");293 init &= CheckObject("MINLEVEL");294 init &= CheckObject("MAXLEVEL");295 init &= CheckObject("GLOBAL_MAXLEVEL");296 init &= CheckObject("INTERFACE");283 init &= f.TestObject("COMM"); 284 init &= f.TestObject("LEVEL_OPERATOR"); 285 init &= f.TestObject("RHS"); 286 init &= f.TestObject("SOL"); 287 init &= f.TestObject("SOLVER"); 288 init &= f.TestObject("SMOOTHER"); 289 init &= f.TestObject("DISCRETIZATION"); 290 init &= f.TestObject("MAX_ITERATION"); 291 init &= f.TestObject("PRECISION"); 292 init &= f.TestObject("PRESMOOTHSTEPS"); 293 init &= f.TestObject("POSTSMOOTHSTEPS"); 294 init &= f.TestObject("COMMANDLIST_INIT"); 295 init &= f.TestObject("COMMANDLIST_LOOP"); 296 init &= f.TestObject("COMMANDLIST_FINALIZE"); 297 init &= f.TestObject("MINLEVEL"); 298 init &= f.TestObject("MAXLEVEL"); 299 init &= f.TestObject("GLOBAL_MAXLEVEL"); 300 init &= f.TestObject("INTERFACE"); 297 301 298 302 return init;
Note:
See TracChangeset
for help on using the changeset viewer.
