/** * Initializes the object for taking measurements. * * This is done once the walk is brought to "equilibrium." After this is * called, either measure() or repeat_measurement() should be called after * every step. */ void initialize (const Walk &walk) { BOOST_ASSERT(!initialized); BOOST_ASSERT(this->is_valid_walk(walk)); initialize_(*boost::polymorphic_downcast<const Walk_T *>(&walk)); initialized = true; }
GLView::GLView(const Rect& frame, const String& name, uint mode, uint flags, const RGBColor& color, uint style, uint ex_style) : View(frame, name, mode, flags, color, style, ex_style) , m_dc(NULL) , m_rc(NULL) { initialize_(); }
QOgreUIView::QOgreUIView (QGraphicsScene *scene) : QGraphicsView (scene), win_ (0), view_ (0) { initialize_ (); }
Teuchos::RCP<const ErrorEstimateBase<double> > GAASPErrorEstimator::controlGlobalError(double uTOL) { if (!isInitialized_) { initialize_(); } Teuchos::EVerbosityLevel verbLevel = this->getVerbLevel(); Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream(); Teuchos::OSTab ostab(out,1,"GAASPErrorEstimator::"); paramList_->sublist(GAASPInterface_name_).set("uTOL",uTOL); gaaspInterfacePtr_->setParameterList(sublist(paramList_,GAASPInterface_name_)); if (Teuchos::as<int>(verbLevel) != Teuchos::VERB_NONE) { *out << "controlGlobalError: Global error tolerance = " << uTOL << std::endl; } Teuchos::RCP<const ErrorEstimateBase<double> > gaaspEE; gaaspEE = getErrorEstimate(); while (fabs(gaaspEE->getTotalError()) > uTOL) { if (Teuchos::as<int>(verbLevel) != Teuchos::VERB_NONE) { *out << "controlGlobalError: Calling GAASPInterface::refineMesh()..." << std::endl; } gaaspInterfacePtr_->refineMesh(); gaaspEE = getErrorEstimate(); } return(gaaspEE); }
QOgreUIView::QOgreUIView () : QGraphicsView (), win_ (0), view_ (0) { initialize_ (); }
std::optional<double> CurrentTransformer::calc_rms() { timer_.start(); double sample_cur = adc_->read_conversion(); num_samples_++; // calculate points where sample sign changes when the sine wave crosses zero if (std::signbit(sample_prev_) != std::signbit(sample_cur)) { crossings_--; } sum_ += sample_cur * sample_cur; sample_prev_ = sample_cur; if ((crossings_ > 0) || (timer_.read_ms() < 1000)) { // reasult not available since measurement is ongoing return std::nullopt; } double volts_rms = sqrt(sum_ / num_samples_); initialize_(); LOG_INFO("%s: %f (%fA)", name_, volts_rms, volts_rms * amps_per_volt); return volts_rms; }
AbcdMathFunction::AbcdMathFunction(Real aa, Real bb, Real cc, Real dd) : a_(aa), b_(bb), c_(cc), d_(dd), abcd_(4), dabcd_(4) { abcd_[0]=a_; abcd_[1]=b_; abcd_[2]=c_; abcd_[3]=d_; initialize_(); }
AbcdMathFunction::AbcdMathFunction(const std::vector<Real>& abcd) : abcd_(abcd), dabcd_(4) { a_=abcd_[0]; b_=abcd_[1]; c_=abcd_[2]; d_=abcd_[3]; initialize_(); }
//-------------------------------------------------------------- bool xtionni::BaseManager::initialize(xtionni::XtionNI *xtion) { if (isInitialized_) return true; xtion_ = xtion; isUpdated_ = false; bool result = initialize_(); isInitialized_ = result; return result; }
LODNode::LODNode( const NodeId nodeId, const Vector3i& blockSize, const Vector3i& levelTotalBlockDimensions ) : nodeId_( nodeId ), blockSize_( blockSize ) { initialize_( ); computeWorldBox_( levelTotalBlockDimensions ); }
LODNode::LODNode( const NodeId nodeId, const Vector3i& blockSize, const Boxf& worldBox ) : nodeId_( nodeId ), blockSize_( blockSize ), worldBox_( worldBox ) { initialize_( ); }
void pca::set_num_variables(long num_vars) { num_vars_ = num_vars; assert_num_vars_(); num_retained_ = num_vars_; data_.resize(record_buffer_, num_vars_); eigval_.resize(num_vars_); eigvec_.resize(num_vars_, num_vars_); mean_.resize(num_vars_); sigma_.resize(num_vars_); eigval_boot_.resize(num_bootstraps_, num_vars_); energy_boot_.resize(num_bootstraps_); initialize_(); }
bool Parameters::initialize( const std::string& filename ) { try { configuration_.parseConfigFile( filename ); initialize_( ); return true; } catch( const boost::program_options::error& exception ) { LBINFO << "Error parsing : " << exception.what() << std::endl; } return false; }
bool Parameters::initialize( const int32_t argc, const char **argv ) { try { configuration_.parseCommandLine( argc, argv ); initialize_( ); return true; } catch( const boost::program_options::error& exception ) { LBINFO << "Error parsing : " << exception.what() << std::endl; } return false; }
bool TextureObject::load_( ) { if( !lodTextureData_ ) return false; if( !lodTextureData_->isValid( ) ) { LBERROR << "Load texture is executed for invalid or unloaded data" << std::endl; return false; } if( !textureState_->texturePoolPtr.get() ) { const Vector3i& maxBlockSize = dataSourcePtr_->getVolumeInformation().maximumBlockSize; const GLenum gpuDataType = lodTextureData_->getGPUDataType(); GLenum format; switch( dataSourcePtr_->getVolumeInformation().compCount ) { case 1: format = GL_RED; break; case 3: format = GL_RGB; break; default: format = GL_RED; break; } TexturePoolPtr pool = textureCachePtr_->getTexturePool( maxBlockSize, format, gpuDataType ); textureState_->texturePoolPtr = pool; } initialize_( ); textureState_->texturePoolPtr->generateTexture( textureState_ ); LBASSERT( textureState_->textureId ); loadTextureToGPU_( ); lodTextureData_.reset( TextureDataObject::getEmptyPtr() ); return true; }
bool init_(void) { if(!initialize_()) { return false; } bool rgb = (FF_SUPPORTED==getPluginCaps_( FF_CAP_24BITVIDEO )); bool rgba= (FF_SUPPORTED==getPluginCaps_( FF_CAP_32BITVIDEO )); if(rgb || rgba) { m_rgba=rgba; } else { return false; } m_cancopy = (FF_SUPPORTED==getPluginCaps_( FF_CAP_PROCESSFRAMECOPY )); getInfo_(); getExtendedInfo_(); initParameters_(); return true; }
pca::pca(long num_vars) : num_vars_(num_vars), num_records_(0), record_buffer_(1000), solver_("dc"), do_normalize_(false), do_bootstrap_(false), num_bootstraps_(10), bootstrap_seed_(1), num_retained_(num_vars_), data_(record_buffer_, num_vars_), energy_(1), energy_boot_(num_bootstraps_), eigval_(num_vars_), eigval_boot_(num_bootstraps_, num_vars_), eigvec_(num_vars_, num_vars_), proj_eigvec_(num_vars_, num_vars_), princomp_(record_buffer_, num_vars_), mean_(num_vars_), sigma_(num_vars_) { assert_num_vars_(); initialize_(); }
Teuchos::RCP<const ErrorEstimateBase<double> > GAASPErrorEstimator::getErrorEstimate() { if (!isInitialized_) { initialize_(); } Teuchos::EVerbosityLevel verbLevel = this->getVerbLevel(); Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream(); Teuchos::OSTab ostab(out,1,"GAASPErrorEstimator::"); if (Teuchos::as<int>(verbLevel) != Teuchos::VERB_NONE) { *out << "getErrorEstimate: Calling GAASPInterface::forwardSolve()..." << std::endl; } gaaspInterfacePtr_->forwardSolve(); if (Teuchos::as<int>(verbLevel) != Teuchos::VERB_NONE) { *out << "getErrorEstimate: Calling GAASPInterface::adjointSolve()..." << std::endl; } gaaspInterfacePtr_->adjointSolve(); if (Teuchos::as<int>(verbLevel) != Teuchos::VERB_NONE) { *out << "getErrorEstimate: Calling GAASPInterface::computeErrorEstimate()..." << std::endl; } Teuchos::RCP<const GAASPErrorEstimate> gaaspEE = gaaspInterfacePtr_->computeErrorEstimate(); if (Teuchos::as<int>(verbLevel) != Teuchos::VERB_NONE) { *out << "getErrorEstimate: Global Error Estimate = " << fabs(gaaspEE->getTotalError()) << std::endl; } return(gaaspEE); }
void meander_(const integer *stations, const integer *stnserod, const doublereal *x, const doublereal *y, const doublereal *xs, const doublereal *dels, const doublereal *flow, const doublereal *rerody, const doublereal *lerody, const doublereal *slope, const doublereal *width, const doublereal *depth, const doublereal *diam, doublereal *delta_x__, doublereal *delta_y__, doublereal *rightdepth, doublereal *leftdepth, doublereal *lambda) { doublereal rho, transfactor, grav; doublereal *delx = new doublereal[*stnserod], *dely = new doublereal[*stnserod], *phi = new doublereal[*stnserod], *tauwall = new doublereal[*stnserod], *spreaddelta_x__ = new doublereal[*stnserod], *spreaddelta_y__ = new doublereal[*stnserod], *curvature = new doublereal[*stnserod], *vel = new doublereal[*stnserod-1], *transslope = new doublereal[*stnserod-1], *acs = new doublereal[*stnserod], *deln = new doublereal[*stnserod], *latforce = new doublereal[*stations], *lag = new doublereal[*stations]; memset(acs,0,*stnserod*sizeof(doublereal)); memset(deln,0,*stnserod*sizeof(doublereal)); memset(latforce,0,*stations*sizeof(doublereal)); memset(lag,0,*stations*sizeof(doublereal)); /* Parameter adjustments */ --lambda; --leftdepth; --rightdepth; --delta_y__; --delta_x__; --diam; --depth; --width; --slope; --lerody; --rerody; --flow; --dels; --xs; --y; --x; /* Function Body */ /* print *, 'stnserod in meander:', stnserod */ /* declare parameter values; get initial channel config.: */ initialize_(stnserod, phi, &x[1], &y[1], delx, dely, &rho, &grav, &width[ 1], &lambda[1]); /* print *, 'stnserod in meander:', stnserod */ /* define channel characteristics: */ channel_(stnserod, stations, &flow[1], &slope[1], &diam[1], &width[1], & rho, &grav, phi, curvature, &dels[1], acs, deln, &rightdepth[1], & leftdepth[1], &depth[1], vel, delx, dely, &transfactor, transslope); /* calculate lateral force and downstream lag: */ forcelag_(stnserod, stations, &rho, vel, &depth[1], &width[1], latforce, lag, curvature, acs, &dels[1], deln); /* propagate and smooth lateral force: */ forcedist_(stnserod, stations, &lambda[1], &width[1], lag, latforce, & dels[1], phi, curvature, &depth[1], spreaddelta_x__, spreaddelta_y__, &rightdepth[1], &leftdepth[1], &xs[1], tauwall); /* change channel position: */ changeposition_(stnserod, stations, &lerody[1], &rerody[1], spreaddelta_x__, spreaddelta_y__, delx, dely, &depth[1], & delta_x__[1], &delta_y__[1]); /* print *, 'last reach node K = ', transfactor */ delete [] delx; delete [] dely; delete [] phi ; delete [] tauwall; delete [] spreaddelta_x__; delete [] spreaddelta_y__; delete [] curvature; delete [] vel; delete [] transslope; delete [] acs; delete [] deln; delete [] latforce; delete [] lag; return; } /* meander_ */
CurrentTransformer::CurrentTransformer(const char* name, Ads1115* adc, int half_waves_to_measure) : name_(name), adc_(adc), half_waves_to_measure_(half_waves_to_measure) { LOG_INFO("CurrentTransformer::CurrentTransformer"); initialize_(); }
//-----------------------------------------------------------------// img_files(const std::string& exts = "bmp,png,jpg,jpeg,j2k,jp2,pvr,tga") { initialize_(exts); }
void PolynomialModel::setPolynomial( const RCP<const Teuchos::Polynomial<double> >& poly ) { poly_ = poly; initialize_(); }
int Ionosphere:: initialize_irifun() { return initialize_(); } /* initialize_irifun */