00001 ///////////////////////////////////////////////////////////////////////////////////////// 00002 /// \file problem.h 00003 /// \brief Declaration of the classes SPARK::TProblem and SPARK::TProblem::TState 00004 /// 00005 ///////////////////////////////////////////////////////////////////////////////////////// 00006 // 00007 // VisualSPARK version 2.0 00008 // 00009 // Copyright (c) 1999-2003, The Regents of the University of California, 00010 // through the Lawrence Berkeley National Laboratory (subject to receipt of 00011 // any required approvals from the U.S. Department of Energy). All rights 00012 // reserved. 00013 // 00014 // Portions of VisualSPARK version 2.0 were authored by Ayres Sowell 00015 // Associates and are protected by copyright and international treaties. 00016 // 00017 // U.S. GOVERNMENT RIGHTS 00018 // Portions of VisualSPARK version 2.0 (the Software) was developed under 00019 // funding from the U.S. Department of Energy and the U.S. Government 00020 // consequently retains certain rights as follows: the U.S. Government has 00021 // been granted for itself and others acting on its behalf a paid-up, 00022 // nonexclusive, irrevocable, worldwide license in the Software to reproduce, 00023 // prepare derivative works, and perform publicly and display publicly. 00024 // Beginning five (5) years after the date permission to assert copyright is 00025 // obtained from the U.S. Department of Energy, and subject to any subsequent 00026 // five (5) year renewals, the U.S. Government is granted for itself and 00027 // others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide 00028 // license in the Software to reproduce, prepare derivative works, distribute 00029 // copies to the public, perform publicly and display publicly, and to permit 00030 // others to do so. 00031 // 00032 // THIS SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. LAWRENCE 00033 // BERKELEY NATIONAL LABORATORY, ITS LICENSORS, THE UNITED STATES, THE UNITED 00034 // STATES DEPARTMENT OF ENERGY, AYRES SOWELL ASSOCIATES, AND THEIR EMPLOYEES: 00035 // (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 00036 // TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, 00037 // TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY OR 00038 // RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF THE SOFTWARE, 00039 // (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE PRIVATELY 00040 // OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION UNINTERRUPTED, 00041 // THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. 00042 // 00043 ///////////////////////////////////////////////////////////////////////////////////////// 00044 /// \attention 00045 /// PORTIONS COPYRIGHT (C) 2003 AYRES SOWELL ASSOCIATES, INC. \n 00046 /// PORTIONS COPYRIGHT (C) 2003 THE REGENTS OF THE UNIVERSITY OF CALIFORNIA . 00047 /// PENDING APPROVAL BY THE US DEPARTMENT OF ENERGY. ALL RIGHTS RESERVED. 00048 /// 00049 ///////////////////////////////////////////////////////////////////////////////////////// 00050 /// \author Dimitri Curtil (LBNL/SRG) 00051 /// \date April 20, 2001 00052 ///////////////////////////////////////////////////////////////////////////////////////// 00053 00054 00055 // This hides the compilation warnings produced by VC++ when a class/struct does not specify a 00056 // dll-interface for its data to be used by clients 00057 #pragma warning(disable:4251) 00058 00059 00060 #if !defined(__PROBLEM_H__) 00061 #define __PROBLEM_H__ 00062 00063 #include <iosfwd> 00064 #include <bitset> 00065 #include <string> 00066 #include <memory> 00067 #include <vector> 00068 00069 #include "compat.h" // For CLASS_DECLSPEC 00070 #include "exceptions.h" // For SPARK exception classes 00071 00072 00073 ///////////////////////////////////////////////////////////////////////////////////////////// 00074 namespace SPARK { 00075 00076 ///////////////////////////////////////////////////////////////////////////////////////// 00077 // Forward declaration 00078 ///////////////////////////////////////////////////////////////////////////////////////// 00079 class TRuntimeControls; 00080 00081 class TGlobalSettings; 00082 class TPreferenceSettings; 00083 00084 class TComponent; 00085 class TObject; 00086 class TInverse; 00087 class TVariable; 00088 00089 class TClock; 00090 class TTrajectory; 00091 class TTopology; 00092 class TStepper; 00093 class TTimer; 00094 class TInputManager; 00095 class TOutputManager; 00096 class TStateHandler; 00097 00098 namespace Requests { 00099 class TDispatcher; 00100 class TManager; 00101 }; // namespace Requests 00102 00103 00104 00105 ///////////////////////////////////////////////////////////////////////////////////////// 00106 /// \class TProblem 00107 /// \brief Representation of a problem object in the %SPARK solver. 00108 /// 00109 /// Class methods implement : 00110 /// \li read values from input files 00111 /// \li generate snapshot files and write reported values to output or trace files 00112 /// \li solve system of equations for the unknown problem variables at \f$Clock=t_{initial}\f$ 00113 /// where \f$t_{initial}=InitialTime\f$ as specified in the runtime controls 00114 /// \li solve system of equations for the unknown problem variables for 00115 /// \f$t_{initial}+dt <= t <= t_{final}\f$ where \f$dt = TimeStep\f$ and \f$ t_{final} = FinalTime\f$ 00116 /// as specified in the runtime controls file 00117 /// \li save current values of problem variables as history 00118 /// 00119 /// \note The TProblem class relies for all runtime information on a SPARK::TRuntimeControls object that is 00120 /// passed to the TProblem::Initialize() method. 00121 /// \li Invoke the TProblem::Initialize() method to bind the SPARK::TRuntimeControls object 00122 /// with a TProblem object. 00123 /// \li Before re-invoking the TProblem::Initialize() method, make sure that you have invoked 00124 /// the method TProblem::Terminate() first to reset the various managers. 00125 /// 00126 class CLASS_DECLSPEC TProblem 00127 { 00128 public: 00129 ///////////////////////////////////////////////////////////////////////////////////// 00130 // Type definition 00131 ///////////////////////////////////////////////////////////////////////////////////// 00132 00133 // Handle type for URL engine (re-defined in liburl_api.h) 00134 typedef int URL_H ; 00135 00136 00137 /// \brief Level of more or less detailed diagnostic to the run log output stream 00138 enum DiagnosticTypes { 00139 DiagnosticType_CONVERGENCE, ///< (=1) show convergence behavior at each iteration 00140 DiagnosticType_INPUTS, ///< (=2) show where the variables get their input from 00141 DiagnosticType_REPORTS, ///< (=4) show reported values at each report event 00142 DiagnosticType_PREFERENCES, ///< (=8) show preference settings as loaded in LoadPreferenceSettings() 00143 DiagnosticType_STATISTICS, ///< (=16) show run statistics at the end of simulation 00144 DiagnosticType_REQUESTS, ///< (=32) show atomic class requests 00145 00146 DIAGNOSTICTYPES_L ///< Number of diagnostic types 00147 }; 00148 00149 00150 /// \brief Bitset used to specify the diagnostic level with the different diagnostic types 00151 /// 00152 /// To make a run with convergence and preferences diagnostic, specifiy 00153 /// <CODE>DiagnosticLevel( 9 () )</CODE> 00154 /// in the runtime controls file whereby 9 = 1 (<I>DiagnosticType_CONVERGENCE</I>) + 8 (<I>DiagnosticType_PREFERENCES</I>) 00155 typedef std::bitset<DIAGNOSTICTYPES_L> TDiagnosticLevel; 00156 00157 00158 /// \brief Simulation flags 00159 enum SimulationFlags { 00160 SimulationFlag_OK = 0, ///< Step was computed successfully 00161 SimulationFlag_BAD_NUMERICS, ///< Bad numerics detected 00162 SimulationFlag_NO_CONVERGENCE, ///< Could not obtain convergence while solving nonlinear system(s) 00163 SimulationFlag_SINGULAR_SYSTEM, ///< Detected a singular or "badly-conditioned" linear system 00164 SimulationFlag_TIMESTEP_TOO_SMALL, ///< Time step selection is limited by MinTimeStep from runtime controls file 00165 SimulationFlag_FAILED_STEP, ///< Step was rejected too many times in response to user's requests 00166 SimulationFlag_IDLE, ///< Default step when starting the simulation 00167 00168 SIMULATIONFLAGS_L ///< Number of simulation flags 00169 }; 00170 00171 00172 /// \class TState 00173 /// \brief Interface class defining the methods used to save and restore the state of the problem 00174 /// using the TProblem::Save() and TProblem::Restore() methods. 00175 /// 00176 /// The class defines methods used to save the values of all variables at the current global 00177 /// time. Then an instance of this class can be used to restore the problem state by invoking 00178 /// TProblem::Restore() in order to restart a simulation. 00179 /// 00180 /// \warning These methods do not try to store or load the private data associated 00181 /// with each inverse and/or object in the problem under study. This can 00182 /// potentially cause problems when restarting the simulation with saved solution 00183 /// values because the private data might be in a different state. A later 00184 /// version of %SPARK will provide support for full serialization of the problem 00185 /// state, i.e., including class private data, through the addition of dedicated 00186 /// callbacks. 00187 /// 00188 class CLASS_DECLSPEC TState { 00189 public: 00190 // Type definition 00191 typedef std::vector<double> value_container; 00192 00193 00194 ///////////////////////////////////////////////////////////////////////////////// 00195 /// \name Structors 00196 //@{ 00197 TState(); ///< Default consrtuctor 00198 TState(const TState& ); ///< Copy constructor: deep copy of values and class states 00199 ~TState() SPARK_NOT_THROWING; ///< Destructor 00200 //@} 00201 ///////////////////////////////////////////////////////////////////////////////// 00202 00203 00204 ///////////////////////////////////////////////////////////////////////////////// 00205 /// \name Access functions for trajectory 00206 //@{ 00207 /// \brief Returns the character string that dscribes the context at the time 00208 /// the problem state was saved. 00209 const char* GetContext() const; 00210 /// \brief Returns the value of the global time variable for the past value \c idx 00211 /// \exception Throws SPARK::Xinitialization if operation failed 00212 double GetTime(unsigned idx) const; 00213 /// \brief Returns the value of the global time step variable for the past value \c idx 00214 /// \exception Throws SPARK::Xinitialization if operation failed 00215 double GetTimeStep(unsigned idx) const ; 00216 /// \brief Returns the number of variables stored in Trajectory 00217 /// \return Number of values defining the trajectory, including the values of the 00218 /// global time and the global time step. 00219 unsigned GetNumVariables() const; 00220 /// \brief Returns the number of past values stored in Trajectory for each variable 00221 /// \return Number of past values 00222 unsigned GetNumPastValues() const; 00223 /// \brief Returns container with desired past values corresponding to index <code>idx</code> 00224 /// \return Reference to container of values 00225 value_container& GetPastValues(unsigned idx); 00226 /// \brief Returns container with desired past values corresponding to index <code>idx</code> 00227 /// \return Const reference to container of values 00228 const value_container& GetPastValues(unsigned idx) const; 00229 //@} 00230 ///////////////////////////////////////////////////////////////////////////////// 00231 00232 00233 ///////////////////////////////////////////////////////////////////////////////// 00234 /// \name Main operations 00235 //@{ 00236 /// \brief Loads the problem state at the current time (values and class data) 00237 /// 00238 /// If necessary, frees previously allocated memory. 00239 /// 00240 /// \param context Description of the problem context 00241 /// \param trajectory Trajectory tracker for the current problem 00242 /// \param topology %Problem topology to save 00243 void Save(const std::string& context, const SPARK::TTrajectory& trajectory, const TTopology& topology); 00244 /// \brief Restores the problem state 00245 /// 00246 /// \param trajectory Trajectory tracker for the current problem 00247 /// \param topology %Problem topology to restore 00248 void Restore(TTrajectory& trajectory, TTopology& topology) const; 00249 //@} 00250 ///////////////////////////////////////////////////////////////////////////////// 00251 00252 00253 private: 00254 const std::auto_ptr<SPARK::TStateHandler> Handler; // Pimpl design pattern 00255 00256 }; 00257 00258 00259 ///////////////////////////////////////////////////////////////////////////////////// 00260 /// \name Structors 00261 //@{ 00262 00263 /// \brief Constructs a TProblem object from the structure specified by the variable arrays and the solution sequence described by the component array. 00264 /// 00265 /// \param numInverses Number of inverses 00266 /// \param inverses Array of pointers to TInverse objects 00267 /// \param numVariables Number of problem variables 00268 /// \param variables Array of pointers to TVariable objects 00269 /// \param numComponents Number of components comprising the problem 00270 /// \param components Array of pointers to TComponent objects 00271 /// 00272 /// \exception Throws SPARK::XMemory if out of memory when building the problem. 00273 TProblem( 00274 unsigned numInverses, SPARK::TInverse* inverses[], 00275 unsigned numVariables, SPARK::TVariable* variables[], 00276 unsigned numComponents, SPARK::TComponent* components[] 00277 ) 00278 SPARK_THROWING( (SPARK::XMemory) ) 00279 SPARK_RETHROWING( (SPARK::XAssertion, std::exception) ); 00280 00281 /// \brief Destructor that frees memory allocated for the various solvers. 00282 /// 00283 /// \note Destructor does not destroy any data that was passed to the constructor to describe 00284 /// the problem topology. The calling program is responsible for destroying these data 00285 /// structures explicitly if needed. 00286 ~TProblem() SPARK_NOT_THROWING; 00287 00288 //@} 00289 ///////////////////////////////////////////////////////////////////////////////////// 00290 00291 00292 ///////////////////////////////////////////////////////////////////////////////////// 00293 /// \name Main methods invoked by driver function 00294 //@{ 00295 00296 /// \brief Performs run-time initialization 00297 /// 00298 /// \param controls runtime control parameters for the simulation 00299 /// 00300 /// \post Initializes clock manager 00301 /// \post Allocates history and inner values 00302 /// \post Prepares input and output managers 00303 /// \post Loads initial values 00304 /// \post Fires construct callbacks 00305 void Initialize(const SPARK::TRuntimeControls& controls) 00306 SPARK_THROWING( (SPARK::XMemory) ) 00307 SPARK_RETHROWING( (SPARK::XAssertion, std::exception) ); 00308 00309 /// \brief Loads preference settings (default and for each component) 00310 /// 00311 /// \param preferences An object of class SPARK::TPreferenceSettings that contains data from the *.prf file 00312 /// 00313 /// \post The SPARK::TGlobalSettings object is loaded for this problem. 00314 /// \post The SPARK::TComponentSettings object are loaded for each component. 00315 void LoadPreferenceSettings(const SPARK::TPreferenceSettings& preferences) 00316 SPARK_THROWING( (SPARK::XMemory) ) 00317 SPARK_RETHROWING( (SPARK::XAssertion, std::exception) ); 00318 00319 /// \brief Computes solution from InitialTime to FinalTime 00320 /// 00321 /// \return Simulation flag as enum SimulationFlags 00322 /// 00323 /// \pre %Problem must have initialized with a prior call to TProblem::Initialize() 00324 /// \post Output and trace files are updated after each simulation step until end of simulation. 00325 /// \post Initial snapshot file is generated after the first step if requested in the runtime controls file. 00326 /// \post Final snapshot file is generated at the last step if requested in the runtime controls file. 00327 /// 00328 /// \exception Throws a SPARK::XInitialization exception object if problem was not initialized or 00329 /// if it is in an inconsistent state. 00330 SimulationFlags Simulate() 00331 SPARK_THROWING( (SPARK::XInitialization) ); 00332 00333 /// \brief Ends processing and writes statistics to run log file 00334 /// 00335 /// \post Fires destruct callbacks 00336 /// \post Deletes input and output managers 00337 /// \post Resets internal counters to allow for a fresh simulation run 00338 /// with a new set of runtime controls specified with a call to TProblem::Initialize(). 00339 void Terminate() 00340 SPARK_RETHROWING( (SPARK::XAssertion, std::exception) ); 00341 //@} 00342 ///////////////////////////////////////////////////////////////////////////////////// 00343 00344 00345 ///////////////////////////////////////////////////////////////////////////////////// 00346 /// \name State management functions 00347 /// 00348 /// These method let you save and restore the problem state in order to allow for 00349 /// a simulation restart from the saved state. 00350 /// 00351 //@{ 00352 00353 /// \brief Saves problem state at current time 00354 /// 00355 /// This method populates the state object with the state of the problem at the 00356 /// current time. 00357 /// 00358 /// \param state Object containing the problem state being saved. 00359 /// \exception Throws a SPARK::XInitialization exception object if problem could not be saved 00360 void Save(SPARK::TProblem::TState& state) const 00361 SPARK_THROWING( (SPARK::XInitialization) ); 00362 00363 /// \brief Restores problem state at the time specified in the state structure 00364 /// 00365 /// The method initializes the variables with the trajectory values stored in the state 00366 /// object. For now there is no support for class data persistency. 00367 /// 00368 /// \param state Object containing the saved problem state to be restored. 00369 void Restore(const SPARK::TProblem::TState& state); 00370 //@} 00371 ///////////////////////////////////////////////////////////////////////////////////// 00372 00373 00374 ///////////////////////////////////////////////////////////////////////////////////// 00375 /// \name Access functions 00376 //@{ 00377 const char* GetName() const; ///< Returns the name of the problem as const char* 00378 void SetName(const char* name); ///< Sets the problem name from name 00379 00380 unsigned long GetStepCount() const; ///< Returns the number of simulation steps performed so far 00381 00382 SPARK::TGlobalSettings* GetGlobalSettings(); ///< Returns pointer to global settings object 00383 const SPARK::TGlobalSettings* GetGlobalSettings() const; ///< Returns pointer to const global settings object 00384 //@} 00385 ///////////////////////////////////////////////////////////////////////////////////// 00386 00387 00388 ///////////////////////////////////////////////////////////////////////////////////// 00389 /// \name Access operations for global problem variables 00390 //@{ 00391 const SPARK::TVariable& GetGlobalTime() const; ///< Returns a const reference to the TVariable object that describes the global time link 00392 const SPARK::TVariable& GetGlobalTimeStep() const; ///< Returns a const reference to the TVariable object that describes the global time step link 00393 //@} 00394 ///////////////////////////////////////////////////////////////////////////////////// 00395 00396 00397 ///////////////////////////////////////////////////////////////////////////////////// 00398 /// \name Access operations for the problem variables 00399 //@{ 00400 00401 /// Returns TVariable& object by handle 00402 /// 00403 /// \param handle is the unsigned value that uniquely identifies this variable as specified in the XML file. See TVariable::Handle 00404 /// \exception SPARK::XAssertion Could not find a variable for this handle 00405 SPARK::TVariable& GetVariable(unsigned handle) 00406 SPARK_THROWING( (SPARK::XAssertion) ); 00407 /// Returns const TVariable& object by handle 00408 /// 00409 /// \param handle is the unsigned value that uniquely identifies this variable as specified in the XML file. See TVariable::Handle 00410 /// \exception SPARK::XAssertion Could not find a variable for this handle 00411 const SPARK::TVariable& GetVariable(unsigned handle) const 00412 SPARK_THROWING( (SPARK::XAssertion) ); 00413 00414 /// Returns TVariable& object by name 00415 /// 00416 /// \param name const char* that stands for the name of the variable as specified in the XML file. See TVariable::Name 00417 /// \note The variable name is case-sensitive. 00418 /// \exception SPARK::XAssertion Could not find a variable with this name. 00419 SPARK::TVariable& GetVariable(const char* name) 00420 SPARK_THROWING( (SPARK::XAssertion) ); 00421 /// Returns const TVariable& object by name 00422 /// 00423 /// \param name const char* that stands for the name of the variable as specified in the XML file. See TVariable::Name 00424 /// \note The variable name is case-sensitive. 00425 /// \exception SPARK::XAssertion Could not find a variable with this name. 00426 const SPARK::TVariable& GetVariable(const char* name) const 00427 SPARK_THROWING( (SPARK::XAssertion) ); 00428 //@} 00429 ///////////////////////////////////////////////////////////////////////////////////// 00430 00431 00432 ///////////////////////////////////////////////////////////////////////////////////// 00433 /// \name Access operations for the problem inverses 00434 //@{ 00435 SPARK::TInverse* GetInverse(unsigned handle) ; ///< Returns pointer to TInverse object by handle 00436 SPARK::TInverse* GetInverse(const char* name) ; ///< Returns pointer to TInverse object by name 00437 //@} 00438 ///////////////////////////////////////////////////////////////////////////////////// 00439 00440 00441 ///////////////////////////////////////////////////////////////////////////////////// 00442 /// \name Access operations for the problem objects 00443 //@{ 00444 SPARK::TObject* GetObject(unsigned handle) ; ///< Returns pointer to TObject object by handle 00445 SPARK::TObject* GetObject(const char* name) ; ///< Returns pointer to TObject object by name 00446 //@} 00447 ///////////////////////////////////////////////////////////////////////////////////// 00448 00449 00450 ///////////////////////////////////////////////////////////////////////////////////// 00451 /// \name Predicate methods 00452 //@{ 00453 bool IsInitialTime() const; ///< Returns true if global time is equal to initial time 00454 bool IsFinalTime() const; ///< Returns true if global time is equal to final time 00455 00456 /// Returns true if first step of simulation. 00457 /// 00458 /// \note True for first step computed when calling TProblem::Simulate() 00459 /// This is different than checking for GetStepCount()==1 since the StepCount counter is 00460 /// incremented at every step, possibly for multiple calls to TProblem::Simulate(). 00461 /// StepCount is reset to 0 only when calling TProblem::Initialize(). 00462 bool Starting() const; 00463 00464 bool IsStaticStep() const ; ///< Returns true if current step is a static step 00465 bool IsTimeStepVariable() const;///< Returns true if key VariableTimeStep is set to 1 in runtime controls 00466 bool IsReady() const; ///< Returns true if problem is ready for simulation. False otherwise. 00467 00468 bool IsDiagnostic() const { return DiagnosticLevel.any(); } ///< Returns true if any diagnostic is set 00469 bool IsDiagnostic(DiagnosticTypes d) const { return DiagnosticLevel[d]; } ///< Returns true if diagnostic d is set 00470 //@} 00471 ///////////////////////////////////////////////////////////////////////////////////// 00472 00473 00474 ///////////////////////////////////////////////////////////////////////////////////// 00475 /// \name IO functions 00476 //@{ 00477 /// \brief Writes current step stamp to output stream os 00478 bool WriteStamp(std::ostream& os) const ; 00479 /// \brief Writes simulation statistics to output stream os 00480 void ReportStatistics(std::ostream& os, const std::string& before) const; 00481 /// \brief Generates the snapshot file named "filename" 00482 void GenerateSnapshot(const std::string& filename) const 00483 SPARK_THROWING( (SPARK::XInitialization) ); 00484 //@} 00485 ///////////////////////////////////////////////////////////////////////////////////// 00486 00487 00488 00489 private: 00490 ///////////////////////////////////////////////////////////////////////////////////// 00491 // Private Methods 00492 ///////////////////////////////////////////////////////////////////////////////////// 00493 00494 ///////////////////////////////////////////////////////////////////////////////////// 00495 /// \name Not implemented methods 00496 //@{ 00497 TProblem(); ///< Default constructor 00498 TProblem(const TProblem& ); ///< Copy constructor 00499 TProblem& operator=(const TProblem& ); ///< Assignment operator 00500 //@} 00501 ///////////////////////////////////////////////////////////////////////////////////// 00502 00503 00504 ///////////////////////////////////////////////////////////////////////////////////// 00505 /// \name Atomic step operations 00506 //@{ 00507 /// \brief Computes a single step. It is either a static step or a dynamic step depending on the 00508 /// current state of the simulator. 00509 /// \return Simulation flag as enum SimulationFlags 00510 SimulationFlags Step() 00511 SPARK_RETHROWING( (SPARK::XAssertion, std::exception) ); 00512 /// \brief Computes a single static step. 00513 /// \return Simulation flag as enum SimulationFlags 00514 SimulationFlags StaticStep(); 00515 /// \brief Computes a single dynamic step. 00516 /// \return Simulation flag as enum SimulationFlags 00517 SimulationFlags DynamicStep(); 00518 //@} 00519 ///////////////////////////////////////////////////////////////////////////////////// 00520 00521 00522 ///////////////////////////////////////////////////////////////////////////////////// 00523 /// \name Handler classes (actions delegated to specific handler by TProblem) 00524 /// 00525 /// \note We use the "pimpl" aka pointer-to-implementation design pattern to hide 00526 /// the implementation details 00527 //@{ 00528 std::auto_ptr<SPARK::TTopology> Topology; ///< Describes the problem topology and the solution sequence 00529 std::auto_ptr<SPARK::TClock> Clock; ///< Manages global time and time step 00530 std::auto_ptr<SPARK::TTrajectory> Trajectory; ///< Manages history and inner values that describe trajectory 00531 00532 URL_H UrlHandle; ///< Problem-level handle for URL engine 00533 std::auto_ptr<SPARK::TInputManager> InputManager; ///< Manages all input read ops 00534 std::auto_ptr<SPARK::TOutputManager> OutputManager; ///< Manages all output write ops 00535 00536 std::auto_ptr<SPARK::TStepper> Stepper; ///< Keeps track of stepping process for simulator 00537 std::auto_ptr<SPARK::Requests::TManager> RequestManager; ///< Processes requests dispatched by SPARK::Requests::TDispatcher 00538 //@} 00539 ///////////////////////////////////////////////////////////////////////////////////// 00540 00541 00542 ///////////////////////////////////////////////////////////////////////////////////// 00543 /// \name Misc data 00544 //@{ 00545 std::string Name; ///< Unique name of this problem instance 00546 TDiagnosticLevel DiagnosticLevel; ///< Bitset used to specify diagnostic level generated to run log 00547 std::auto_ptr<SPARK::TGlobalSettings> GlobalSettings; ///< Wrapper class for all global settings (See *.prf file) 00548 const std::auto_ptr<SPARK::TTimer> Timer; ///< Keeps track of CPU time 00549 //@} 00550 ///////////////////////////////////////////////////////////////////////////////////// 00551 00552 friend class SPARK::Requests::TDispatcher; 00553 }; 00554 ///////////////////////////////////////////////////////////////////////////////////////// 00555 00556 00557 }; // namespace SPARK 00558 ///////////////////////////////////////////////////////////////////////////////////////////// 00559 00560 00561 #endif //__PROBLEM_H__ 00562 00563