diff --git a/src/core/ActionPilot.h b/src/core/ActionPilot.h index a4a1d74a0bbb8ea78e81943ca59e8e3235c442d8..9065312e3fa6ad6f65090c2a1f73c99993e653f0 100644 --- a/src/core/ActionPilot.h +++ b/src/core/ActionPilot.h @@ -41,7 +41,6 @@ class ActionPilot: { int stride; // multiple time step protected: - int getStride()const; void setStride( const unsigned& ss ); public: explicit ActionPilot(const ActionOptions&); @@ -49,6 +48,8 @@ public: static void registerKeywords(Keywords& keys); /// Check if the action is active on this step bool onStep()const; +/// Get the stride + int getStride()const; }; } diff --git a/src/gridtools/ActionWithInputGrid.cpp b/src/gridtools/ActionWithInputGrid.cpp index 7f20c59c49c37e740a7547cc8646d3013814c905..d29153c4c7278cc2d00e177f57fb23c289c645f0 100644 --- a/src/gridtools/ActionWithInputGrid.cpp +++ b/src/gridtools/ActionWithInputGrid.cpp @@ -48,6 +48,11 @@ mygrid(NULL) if(!mves) error("action labelled " + mlab + " does not exist or does not have vessels"); addDependency(mves); + ActionPilot* ap=dynamic_cast<ActionPilot*>( mves ); + if( ap ){ + if( getStride()!=ap->getStride() ) error("mismatch between strides in " + ap->getLabel() + " and " + getLabel() ); + } + log.printf(" using grid calculated by action %s \n",mves->getLabel().c_str() ); for(unsigned i=0;i<mves->getNumberOfVessels();++i){ mygrid=dynamic_cast<GridVessel*>( mves->getPntrToVessel(i) ); diff --git a/src/gridtools/FindContour.cpp b/src/gridtools/FindContour.cpp index 99259c95d34c53e0bfcf61fc8f43368a3ec8bd1d..2aff20ad28ad57a0f19f6ee3ab31e0c6b018cdf2 100644 --- a/src/gridtools/FindContour.cpp +++ b/src/gridtools/FindContour.cpp @@ -139,7 +139,6 @@ outgrid(NULL) vesselbase::VesselOptions dar( da, keys ); outgrid = new GridFunction(dar); addVessel( outgrid ); if( mygrid->noDerivatives() ) outgrid->setNoDerivatives(); - resizeFunctions(); } // START OF BIT TO IMPROVE @@ -204,6 +203,7 @@ void FindContour::performOperationsWithGrid( const bool& from_update ){ snbins[i]=mygrid->getNbin()[gdirs[i]]; } outgrid->setBounds( smin, smax, snbins, fspacing); + resizeFunctions(); } // Run over whole grid diff --git a/src/gridtools/GridVessel.cpp b/src/gridtools/GridVessel.cpp index 0db5abb297af96dc93b970134612891fb07bdbc5..ec41108307a559f35cb2fd11139351ebc705f738 100644 --- a/src/gridtools/GridVessel.cpp +++ b/src/gridtools/GridVessel.cpp @@ -120,7 +120,11 @@ std::string GridVessel::description(){ void GridVessel::resize(){ plumed_massert( nper>0, "Number of datapoints at each grid point has not been set"); - resizeBuffer( npoints*nper ); data.resize( npoints*nper, 0 ); active.resize( npoints, true ); + resizeBuffer( npoints*nper ); + if( data.size()!=npoints*nper ){ + data.resize( npoints*nper, 0 ); + active.resize( npoints, true ); + } } unsigned GridVessel::getIndex( const std::vector<unsigned>& indices ) const {