//----------------------------------------------------------------- // Import elevation file // Elevation are processed QGT per QGT // The array Spot is used to store for each detail tile the // spot elevation: // Type 0: This is a unic elevation shared between sevral tiles // Type 1: This is the unic center elevation for the detail tile // Type 2: Elevation is an array of integers of dimension dim //----------------------------------------------------------------- // 1) The elevations found in the database are loaded // 2) The elevations from the BT file for this QGT are loaded // by => GetRegionElevation // 3) New elevation overwrite those from the database =>Overwrite // 4) Rectabgular region of same type are computed => CreateAreas //----------------------------------------------------------------- void CImport::ImportElevations(char *fn) { REGION_REC reg; reg.qgt = 0; CBtParser btp(fn); Dim = btp.Resolution(); TRACE("=====BUILDING REGIONS =========================="); while ( btp.GetQgtKey(reg.qtx,reg.qtz)) { reg.key = QGTKEY(reg.qtx,reg.qtz); TRACE("---QGT key=%010d",reg.key); //--- Load existing elevations from database ---- globals->sqm->GetQgtElevation(reg,ELVtoSlots); btp.GetRegionElevation(reg); Overwrite(reg); //--- Create areas ---------------------------- CreateAreas(); area.qgt = 0; area.qtx = reg.qtx; area.qtz = reg.qtz; globals->sqm->DeleteElevation(reg.key); WriteRegions(1); //----Reset all resources --------------------- Reset(); delete [] reg.data; reg.data = 0; btp.NextQgtKey(); } return; }
void btp(TreeNode * root, string & p) { string tmp(p); if(root->left == nullptr && root->right == nullptr) { vs.push_back(p); } if(root->left) { p += "->" + to_string(root->left->val); btp(root->left, p); p = tmp; } if(root->right) { p += "->" + to_string(root->right->val); btp(root->right, p); p =tmp; } }
vector<string> binaryTreePaths(TreeNode* root) { if(root == nullptr) return vector<string>(); string path(to_string(root->val)); btp(root, path); return vs; }
void jsk_pcl_ros::DepthImageCreator::onInit () { JSK_NODELET_INFO("[%s::onInit]", getName().c_str()); ConnectionBasedNodelet::onInit(); tf_listener_ = TfListenerSingleton::getInstance(); // scale_depth pnh_->param("scale_depth", scale_depth, 1.0); JSK_ROS_INFO("scale_depth : %f", scale_depth); // use fixed transform pnh_->param("use_fixed_transform", use_fixed_transform, false); JSK_ROS_INFO("use_fixed_transform : %d", use_fixed_transform); pnh_->param("use_service", use_service, false); JSK_ROS_INFO("use_service : %d", use_service); pnh_->param("use_asynchronous", use_asynchronous, false); JSK_ROS_INFO("use_asynchronous : %d", use_asynchronous); pnh_->param("use_approximate", use_approximate, false); JSK_ROS_INFO("use_approximate : %d", use_approximate); pnh_->param("info_throttle", info_throttle_, 0); info_counter_ = 0; pnh_->param("max_queue_size", max_queue_size_, 3); // set transformation std::vector<double> trans_pos(3, 0); std::vector<double> trans_quat(4, 0); trans_quat[3] = 1.0; if (pnh_->hasParam("translation")) { jsk_topic_tools::readVectorParameter(*pnh_, "translation", trans_pos); } if (pnh_->hasParam("rotation")) { jsk_topic_tools::readVectorParameter(*pnh_, "rotation", trans_quat); } tf::Quaternion btq(trans_quat[0], trans_quat[1], trans_quat[2], trans_quat[3]); tf::Vector3 btp(trans_pos[0], trans_pos[1], trans_pos[2]); fixed_transform.setOrigin(btp); fixed_transform.setRotation(btq); pub_image_ = advertise<sensor_msgs::Image> (*pnh_, "output", max_queue_size_); pub_cloud_ = advertise<PointCloud>(*pnh_, "output_cloud", max_queue_size_); pub_disp_image_ = advertise<stereo_msgs::DisparityImage> (*pnh_, "output_disp", max_queue_size_); if (use_service) { service_ = pnh_->advertiseService("set_point_cloud", &DepthImageCreator::service_cb, this); } onInitPostProcess(); }
BiotModulus<EvalT, Traits>:: BiotModulus(Teuchos::ParameterList& p) : biotModulus(p.get<std::string>("Biot Modulus Name"), p.get<Teuchos::RCP<PHX::DataLayout> >("QP Scalar Data Layout")) { Teuchos::ParameterList* elmd_list = p.get<Teuchos::ParameterList*>("Parameter List"); Teuchos::RCP<PHX::DataLayout> vector_dl = p.get< Teuchos::RCP<PHX::DataLayout> >("QP Vector Data Layout"); std::vector<PHX::DataLayout::size_type> dims; vector_dl->dimensions(dims); numQPs = dims[1]; numDims = dims[2]; Teuchos::RCP<ParamLib> paramLib = p.get< Teuchos::RCP<ParamLib> >("Parameter Library", Teuchos::null); std::string type = elmd_list->get("Biot Modulus Type", "Constant"); if (type == "Constant") { is_constant = true; constant_value = elmd_list->get("Value", 1.0); // Add Biot Modulus as a Sacado-ized parameter this->registerSacadoParameter("Biot Modulus", paramLib); } else if (type == "Truncated KL Expansion") { is_constant = false; PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> fx(p.get<std::string>("QP Coordinate Vector Name"), vector_dl); coordVec = fx; this->addDependentField(coordVec); exp_rf_kl = Teuchos::rcp(new Stokhos::KL::ExponentialRandomField<RealType>(*elmd_list)); int num_KL = exp_rf_kl->stochasticDimension(); // Add KL random variables as Sacado-ized parameters rv.resize(num_KL); for (int i=0; i<num_KL; i++) { std::string ss = Albany::strint("Biot Modulus KL Random Variable",i); this->registerSacadoParameter(ss, paramLib); rv[i] = elmd_list->get(ss, 0.0); } } else { TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter, "Invalid Biot modulus type " << type); } if ( p.isType<std::string>("Porosity Name") ) { Teuchos::RCP<PHX::DataLayout> scalar_dl = p.get< Teuchos::RCP<PHX::DataLayout> >("QP Scalar Data Layout"); PHX::MDField<ScalarT,Cell,QuadPoint> tp(p.get<std::string>("Porosity Name"), scalar_dl); porosity = tp; this->addDependentField(porosity); isPoroElastic = true; FluidBulkModulus = elmd_list->get("Fluid Bulk Modulus Value", 10.0e9); this->registerSacadoParameter("Skeleton Bulk Modulus Parameter Value", paramLib); GrainBulkModulus = elmd_list->get("Grain Bulk Modulus Value", 10.0e12); // typically Kgrain >> Kskeleton this->registerSacadoParameter("Grain Bulk Modulus Value", paramLib); } else { isPoroElastic=false; FluidBulkModulus=10.0e9; // temp value..need to change GrainBulkModulus = 10.0e12; // temp value need to change } if ( p.isType<std::string>("Biot Coefficient Name") ) { Teuchos::RCP<PHX::DataLayout> scalar_dl = p.get< Teuchos::RCP<PHX::DataLayout> >("QP Scalar Data Layout"); PHX::MDField<ScalarT,Cell,QuadPoint> btp(p.get<std::string>("Biot Coefficient Name"), scalar_dl); biotCoefficient = btp; this->addDependentField(biotCoefficient); } this->addEvaluatedField(biotModulus); this->setName("Biot Modulus"+PHX::typeAsString<EvalT>()); }