ROL: Patch including <fstream> where needed
Created by: mhoemmen
Some ROL files implicitly depend on Teuchos_ConfigDefs.hpp
to include <fstream>
. It wastes build time to include headers that most files don't need. The attached patch includes <fstream>
where needed in ROL. "Where needed" is based on enabling TeuchosCore and letting Trilinos' check-in test script enable all downstream packages, including ROL.
Here is the patch:
diff --git a/packages/rol/src/sol/sampler/ROL_SampleGenerator.hpp b/packages/rol/src/sol/sampler/ROL_SampleGenerator.hpp
index 7bbcb6b..35f09d1 100644
--- a/packages/rol/src/sol/sampler/ROL_SampleGenerator.hpp
+++ b/packages/rol/src/sol/sampler/ROL_SampleGenerator.hpp
@@ -47,10 +47,11 @@
#include "Teuchos_RefCountPtr.hpp"
#include "ROL_BatchManager.hpp"
#include "ROL_Vector.hpp"
+#include <fstream>
namespace ROL {
-template<class Real>
+template<class Real>
class SampleGenerator {
private:
int begin_;
@@ -72,13 +73,13 @@ public:
virtual ~SampleGenerator() {}
SampleGenerator(const Teuchos::RCP<BatchManager<Real> > &bman)
: begin_(0), bman_(bman) {}
- SampleGenerator(const SampleGenerator<Real> &sampler)
+ SampleGenerator(const SampleGenerator<Real> &sampler)
: begin_(sampler.begin_), bman_(sampler.bman_),
points_(sampler.points_), weights_(sampler.weights_) {}
virtual void update(const Vector<Real> &x) {
begin_ = 0;
- }
+ }
virtual int start(void) {
return begin_;
@@ -104,7 +105,7 @@ public:
virtual std::vector<Real> getMyPoint(const int i) const {
return points_[i];
- }
+ }
virtual Real getMyWeight(const int i) const {
return weights_[i];
@trilinos/rol
Motivation and Context
Including too many header files increases build time and makes code fragile to upstream changes.
Definition of Done
[ ] Apply the included patch to ROL.