Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • T Trilinos
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 936
    • Issues 936
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • James Willenbring
  • Trilinos
  • Issues
  • #1994

Closed
Open
Created Nov 16, 2017 by James Willenbring@jmwilleMaintainer

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.

Assignee
Assign to
Time tracking