50 #ifndef _ZOLTAN2_PROBLEM_HPP_ 51 #define _ZOLTAN2_PROBLEM_HPP_ 68 template<
typename Adapter>
72 #ifdef HAVE_ZOLTAN2_MPI 75 Problem(Adapter *, ParameterList *params, MPI_Comm comm);
80 Problem(Adapter *, ParameterList *params);
92 virtual void solve(
bool updateInputData) = 0;
107 #ifdef Z2_OMIT_ALL_ERROR_CHECKING 113 timer_->printAndResetToZero();
160 void setupProblemEnvironment(ParameterList *pl);
164 #ifdef HAVE_ZOLTAN2_MPI 166 template <
typename Adapter>
173 RCP<Teuchos::OpaqueWrapper<MPI_Comm> > wrapper =
174 Teuchos::opaqueWrapper(comm);
175 comm_ = rcp<const Comm<int> >(
new Teuchos::MpiComm<int>(wrapper));
176 setupProblemEnvironment(params);
180 template <
typename Adapter>
188 comm_ = DefaultComm<int>::getComm();
189 setupProblemEnvironment(params);
192 template <
typename Adapter>
198 env_ = rcp(
new Environment(*params, Teuchos::DefaultComm<int>::getComm()));
204 ParameterList &processedParameters =
env_->getParametersNonConst();
205 params_ = rcp<ParameterList>(&processedParameters,
false);
207 #ifndef Z2_OMIT_ALL_PROFILING 211 bool haveType=
false, haveStream=
false, haveFile=
false;
214 const Teuchos::ParameterEntry *pe = pl.getEntryPtr(
"timer_type");
217 choice = pe->getValue<
int>(&choice);
224 pe = pl.getEntryPtr(
"timer_output_file");
227 fname = pe->getValue<
string>(&fname);
228 std::ofstream *dbgFile =
new std::ofstream;
229 if (
comm_->getRank()==0){
232 dbgFile->open(fname.c_str(), std::ios::out|std::ios::trunc);
234 catch(std::exception &e){
235 throw std::runtime_error(e.what());
242 pe = pl.getEntryPtr(
"timer_output_stream");
244 choice = pe->getValue<
int>(&choice);
250 if (haveStream || haveType){
256 std::ofstream *of = NULL;
262 if (haveType || haveStream || haveFile)
269 template <
typename Adapter>
272 env_ = rcp(
new Environment(*params, Teuchos::DefaultComm<int>::getComm()));
275 ParameterList &processedParameters =
env_->getParametersNonConst();
276 params_ = rcp<ParameterList>(&processedParameters,
false);
RCP< GraphModel< base_adapter_t > > graphModel_
Time an algorithm (or other entity) as a whole.
virtual void solve(bool updateInputData)=0
Method that creates a solution.
Adapter::base_adapter_t base_adapter_t
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
base_adapter_t * baseInputAdapter_
virtual ~Problem()
Destructor.
TimerType
The type of timers which should be active.
/dev/null: do actions but don't output results
RCP< const Comm< int > > comm_
void resetParameters(ParameterList *params)
Reset the list of parameters.
RCP< IdentifierModel< base_adapter_t > > identifierModel_
Problem(Adapter *, ParameterList *params)
Constructor where communicator is Teuchos default.
Defines the IdentifierModel interface.
OSType
Output stream types.
Problem base class from which other classes (PartitioningProblem, ColoringProblem, OrderingProblem, MatchingProblem, etc.) derive.
void printTimers() const
If timer data was collected, print out global data.
RCP< CoordinateModel< base_adapter_t > > coordinateModel_
The user parameters, debug, timing and memory profiling output objects, and error checking methods...
RCP< TimerManager > timer_
Defines the CoordinateModel classes.
Gathering definitions used in software development.
RCP< ParameterList > params_
Defines the GraphModel interface.
RCP< const Model< base_adapter_t > > baseModel_
RCP< const Environment > envConst_
Declarations for TimerManager.