Skip to content

Commit

Permalink
ROL: correct warnings in examples and tests
Browse files Browse the repository at this point in the history
The tests were mostly signed/unsigned comparisons
which I cast to match.  I did consider changing
the types, but other comparisons in the same code
would have required a cast in the opposite direction
so that was pointless.  The example code was
complaining about unused variables. I did lleave those
in place but commented out so that the example is still
there but the compiler does not complain.  If someone
wanted to instead use those in some way that would be good.

closes issue #2284
  • Loading branch information
prwolfe committed Mar 9, 2018
1 parent b89f7eb commit 12df728
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions packages/rol/example/tempus/example_01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ int main(int argc, char *argv[]) {

RCP<Tempus::IntegratorBasic<RealT> > integrator = Tempus::integratorBasic<RealT>(tempusParList, model);

bool integratorStatus = integrator->advanceTime();
integrator->advanceTime();

// Test if at 'Final Time'
RealT time = integrator->getTime();
RealT timeFinal = tempusParList->sublist("Demo Integrator").sublist("Time Step Control").get<RealT>("Final Time");
// How to Test if at 'Final Time'
// RealT time = integrator->getTime();
// RealT timeFinal = tempusParList->sublist("Demo Integrator").sublist("Time Step Control").get<RealT>("Final Time");

// Output solution.
std::ofstream ftmp("Tempus_ForwardEuler_SinCos.dat");
Expand Down
10 changes: 5 additions & 5 deletions packages/rol/src/vector/ROL_PinTVector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class PinTVector
int numLeft = 0;
int numRight = 0;

for(int i=0;i<stencil_.size();i++) {
for(int i=0;i<(int)stencil_.size();i++) {
if(stencil_[i]<0)
numLeft = std::max(numLeft,std::abs(stencil_[i]));
else if(stencil_[i]>0)
Expand Down Expand Up @@ -288,11 +288,11 @@ class PinTVector
return true;

// these are "neighbor" unowned vectors (left)
if(-leftVectors_.size() <= i && i < 0)
if(-(int)leftVectors_.size() <= i && i < 0)
return true;

// these are "neighbor" unowned vectors (right)
if(numOwnedSteps() <= i && i<numOwnedSteps()+rightVectors_.size())
if(numOwnedSteps() <= i && i<(int)(numOwnedSteps()+rightVectors_.size()))
return true;

return false;
Expand All @@ -309,11 +309,11 @@ class PinTVector
return stepVectors_->get(i);

// these are "neighbor" unowned vectors (left)
if(-leftVectors_.size() <= i && i < 0)
if(-(int)leftVectors_.size() <= i && i < 0)
return leftVectors_[leftVectors_.size()+i];

// these are "neighbor" unowned vectors (right)
if(numOwnedSteps() <= i && i<numOwnedSteps()+rightVectors_.size())
if((int)numOwnedSteps() <= i && i<(int)(numOwnedSteps()+rightVectors_.size()))
return rightVectors_[i-numOwnedSteps()];

return nullPtr;
Expand Down
1 change: 0 additions & 1 deletion packages/rol/test/function/constraint/test_03.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ int main(int argc, char* argv[]) {
// check inverses adjoint Jacobian_1_new
*outStream << "Checking apply Jacobian 2 new" << std::endl;
{
ROL::Vector<RealT> & v_un = *dynamic_cast<ROL::PartitionedVector<RealT>&>(*v_u).get(1);
dynamic_cast<ROL::PartitionedVector<RealT>&>(*v_u).get(0)->scale(0.0);

PtrVector jv_u = un_vec->clone();
Expand Down

0 comments on commit 12df728

Please sign in to comment.