这篇教程C++ FromHere函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FromHere函数的典型用法代码示例。如果您正苦于以下问题:C++ FromHere函数的具体用法?C++ FromHere怎么用?C++ FromHere使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FromHere函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: pack /// extraction of data from the wrapped object, returned memory is a copy, not a view /// if nullptr is passed (also default parameter), memory is allocated. /// @return pointer to the newly allocated data which is of size size_of()*stride()*size() virtual const void* pack(void* buf=nullptr) const { if ( is_null(m_data) ) throw cf3::common::BadPointer(FromHere(),name()+": Data expired."); if (buf==nullptr) buf=new T[m_data->num_elements()*m_stride+1]; if ( buf == nullptr ) throw cf3::common::NotEnoughMemory(FromHere(),name()+": Could not allocate temporary buffer."); T* ibuf=(T*)buf; for (int i=0; i<(const int)(m_data->num_elements()*m_stride); i++) *ibuf++=(*m_data)[i]; return buf; }
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:13,
示例2: BadValueCLink& CLink::link_to ( Component::Ptr lnkto ){ if ( is_null(lnkto) ) throw BadValue(FromHere(), "Cannot link to null component"); if (lnkto->is_link()) throw SetupError(FromHere(), "Cannot link a CLink to another CLink"); m_link_component = lnkto; return *this;}
开发者ID:andrealani,项目名称:coolfluid3,代码行数:11,
示例3: ValueNotFoundvoid NLink::go_to_target(SignalArgs & ){ if ( is_null(m_target) ) throw ValueNotFound (FromHere(), "Target of this link is not set or not valid"); QModelIndex index = NTree::global()->index_from_path(m_target->uri()); if(index.isValid()) NTree::global()->set_current_index(index); else throw ValueNotFound (FromHere(), m_target->uri().string() + ": path does not exist");}
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:12,
示例4: plane_jacobian_normalRealVector ElementType::plane_jacobian_normal(const RealVector& mapped_coords, const RealMatrix& nodes, const CoordRef direction) const{ throw Common::NotImplemented(FromHere(),"jacobian not implemented for "+derived_type_name()); return RealVector(1);}
开发者ID:andrealani,项目名称:coolfluid3,代码行数:7,
示例5: operator inline void operator()(boost::any& to_set, const boost::any& new_value) { if(new_value.type() == to_set.type()) { to_set = new_value; } else { try { std::vector<Uint> int_vals = boost::any_cast< std::vector<Uint> >(new_value); const Uint nb_vals = int_vals.size(); std::vector<int> result(nb_vals); for(Uint i = 0; i != nb_vals; ++i) { result[i] = static_cast<int>(int_vals[i]); } to_set = result; } catch(boost::bad_any_cast& e) { throw CastingFailed(FromHere(), std::string("Failed to cast object of type ") + new_value.type().name() + " to type std::vector<int>"); } } }
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:25,
示例6: QTreeViewTreeView::TreeView(CentralPanel * optionsPanel, QMainWindow * parent, bool contextMenuAllowed): QTreeView(parent), m_context_menu_allowed(contextMenuAllowed){ if(m_context_menu_allowed && optionsPanel == nullptr) throw BadValue(FromHere(), "Options panel is a nullptr pointer"); // instantiate class attributes m_model_filter = new FilteringModel(this); m_central_panel = optionsPanel; m_signal_manager = new SignalManager(parent); m_model_filter->setSourceModel(NTree::global().get()); m_model_filter->setDynamicSortFilter(true); this->setModel(m_model_filter); this->set_read_only(false); // when right clicking on the Client, // a "Context menu event" must be generated this->setContextMenuPolicy(Qt::CustomContextMenu); this->header()->setResizeMode(QHeaderView::ResizeToContents); this->header()->setStretchLastSection(true); if(m_context_menu_allowed) { connect(NTree::global().get(), SIGNAL(current_index_changed(QModelIndex, QModelIndex)), this, SLOT(current_index_changed(QModelIndex, QModelIndex))); }}
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:35,
示例7: test_equal Common_API bool from_str<bool> (const std::string& str) { bool match = false; boost::algorithm::is_equal test_equal; if ( test_equal(str,"true") || test_equal(str,"True") || test_equal(str,"on") || test_equal(str,"1") ) { return true; } if ( test_equal(str,"false") || test_equal(str,"False") || test_equal(str,"off") || test_equal(str,"0") ) { return false; } if (!match) throw ParsingFailed (FromHere(), "Incorrect option conversion to bool of string [" + str + "]" ); return true; }
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:25,
示例8: FromHereconst CF::Mesh::ElementType& Triag2DLagrangeP2B::face_type(const CF::Uint face) const{ throw Common::NotImplemented( FromHere(), "Line2DLagrangeP2 does not exist yet" ); static const Line2DLagrangeP1 facetype; return facetype;}
开发者ID:Ivor23,项目名称:coolfluid3,代码行数:7,
示例9: setup /// setup of passing by reference /// @param std::vector of data /// @param stride number of array element grouping void setup(boost::multi_array<T,1>& data, const bool needs_update) { if (boost::is_pod<T>::value==false) throw cf3::common::BadValue(FromHere(),name()+": Data is not POD (plain old datatype)."); m_data=&data; m_stride = 1; m_needs_update=needs_update; }
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:10,
示例10: unpack /// returning back values into the data wrapped by objectwrapper /// @param pointer to the data to be committed back virtual void unpack(void* buf) const { if ( is_null(m_data) ) throw cf3::common::BadPointer(FromHere(),name()+": Data expired."); T* ibuf=(T*)buf; for (int i=0; i<(const int)(m_data->num_elements()*m_stride); i++) (*m_data)[i]=*ibuf++; }
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:9,
示例11: cache /// Create ElementCache if non-existant, else get the ElementCache and lock it through ElementCacheHandle constructor ElementCacheT& cache(const Handle<mesh::Entities const>& entities, const Uint elem) { typename value_type::iterator it = m_element_caches.find(entities.get()); if(it != m_element_caches.end()) { m_cache=it->second.get(); if ( get().idx == elem ) // Nothing to be done { get().lock(); return get(); } if (get().locked()) throw common::IllegalCall(FromHere(),"cache "+uri().string()+" is locked to elem "+common::to_str(it->second->idx)); set_cache(elem); return get(); } boost::shared_ptr<ElementCacheT> element_cache ( new ElementCacheT ); m_cache=element_cache.get(); m_cache->cache = this->handle<Cache>(); configure_cache(entities); set_cache(elem); m_element_caches[entities.get()]=element_cache; return get(); }
开发者ID:tbanyai,项目名称:coolfluid3,代码行数:27,
示例12: data_MIXdouble DerivativesType5::a2(Data::DataStorage& data_Q, Data::DataStorage& data_W, Data::DataStorage& data_MIX, Data::DataStorage& dp, CHEM::SpeciesSet& species_set, int ND){ double rho = data_MIX(0); double a2_rho = 0.0; for (int s= 0; s <= species_set.NS-1; s++) { a2_rho += data_Q(s)*dp(s); } for (int k = species_set.NS; k <= species_set.NS+ND-1; k++) { a2_rho += data_Q(k)*dp(k); } a2_rho += (data_Q(species_set.NS+ND) + data_W(species_set.NS+ND)) * dp(species_set.NS+ND); a2_rho += data_Q(species_set.NS+ND+1) * dp(species_set.NS+ND+1); if (a2_rho < 0.0 || a2_rho == std::numeric_limits<double>::infinity() || a2_rho != a2_rho) { throw Common::ExceptionNegativeValue (FromHere(), "Negative value of a2: Need to check dp_dQ."); } //Common::ErrorCheckNonNegative<double>(a2_rho, "DerivativesType5: rho_a2 cannot be negative"); return (a2_rho / rho);}
开发者ID:minkwankim,项目名称:OP2A,代码行数:27,
示例13: urivoid CPlotXY::convergence_history( SignalArgs & args ){ if( is_not_null(m_data.get()) ) { SignalFrame reply = args.create_reply( uri() ); SignalFrame& options = reply.map( Protocol::Tags::key_options() );// std::vector<Real> data(8000); CTable<Real>& table = *m_data.get(); std::vector<std::string> labels = list_of<std::string>("x")("y")("z")("u")("v")("w")("p")("t"); add_multi_array_in(options.main_map, "Table", m_data->array(), ";", labels);// for(Uint row = 0 ; row < 1000 ; ++row)// {// for(Uint col = 0 ; col < 8 ; ++col)// data[ (row * 8) + col ] = table[row][col];// }// XmlNode node = options.add("Table", data, " ; ");// node.set_attribute("dimensions", "8"); } else throw SetupError( FromHere(), "Data to plot not setup" );}
开发者ID:Ivor23,项目名称:coolfluid3,代码行数:26,
示例14: component /// Return the wrapped component ComponentT& component() { if(is_null(m_component)) throw common::SetupError(FromHere(), "ComponentWrapperImpl points to a null component"); return **m_component; }
开发者ID:tbanyai,项目名称:coolfluid3,代码行数:8,
示例15: uriField& Dictionary::create_field(const std::string &name, math::VariablesDescriptor& variables_descriptor){ CFinfo << "Creating field " << uri()/name << CFendl; if (m_dim == 0) throw SetupError(FromHere(), "dimension not configured"); Handle<Field> field = create_component<Field>(name); field->set_dict(*this); field->set_descriptor(variables_descriptor); if (variables_descriptor.options().option(common::Tags::dimension()).value<Uint>() == 0) { field->descriptor().options().set(common::Tags::dimension(),m_dim); } field->set_row_size(field->descriptor().size()); field->resize(size()); update_structures(); CFinfo << "Created field " << field->uri() << " with variables /n"; for (Uint var=0; var<field->descriptor().nb_vars(); ++var) { CFinfo << " - " << field->descriptor().user_variable_name(var) << " [" << field->descriptor().var_length(var) << "]/n"; } CFinfo << CFflush; return *field;}
开发者ID:Ist163353,项目名称:coolfluid3,代码行数:26,
示例16: Solve3x3eqnvoid Solve3x3eqn(std::vector< std::vector<double> >& A, std::vector<double> &b, std::vector<double> &x){ if (fabs<double>(b[0]) <= MATH_ZERO && fabs<double>(b[1]) <= MATH_ZERO && fabs<double>(b[2]) <= MATH_ZERO) { x.resize(3, 0.0); } else { x.resize(3, 0.0); double det = A[0][0]*(A[1][1]*A[2][2] - A[1][2]*A[2][1]) - A[0][1]*(A[1][0]*A[2][2] - A[1][2]*A[2][1]) + A[0][2]*(A[1][0]*A[2][1] - A[1][1]*A[2][0]); if( fabs<double>(det) < MATH_ZERO) throw Common::ExceptionDimensionMatch (FromHere(), "NO Solution (zero determinent)"); double a11 = A[1][1]*A[2][2] - A[1][2]*A[2][1]; double a12 = -(A[1][0]*A[2][2] - A[1][2]*A[2][0]); double a13 = A[1][0]*A[2][1] - A[1][1]*A[2][0]; double a21 =-(A[0][1]*A[2][2] - A[0][2]*A[2][1]); double a22 = A[0][0]*A[2][2] - A[0][2]*A[2][0]; double a23 =-(A[0][0]*A[2][1] - A[0][1]*A[2][0]); double a31 = A[2][1]*A[1][2] - A[0][2]*A[1][1]; double a32 =-(A[0][0]*A[1][2] - A[0][2]*A[1][0]); double a33 = A[0][0]*A[1][1] - A[0][1]*A[1][0]; x[0] = (a11*b[0] + a12*b[1] + a13*b[2])/det; x[1] = (a21*b[0] + a22*b[1] + a23*b[2])/det; x[2] = (a31*b[0] + a32*b[1] + a33*b[2])/det; }}
开发者ID:minkwankim,项目名称:OP2A,代码行数:30,
示例17: solve_yplus Real solve_yplus(FunctorT&& f) { Real yp_low = 0.; Real yp_high = 1000.; Uint count = 1; Real yplus = 0.; while(((yp_high-yp_low) > 1e-4) && count < 1000) { yplus = (yp_low+yp_high)/2.; if (f(yplus) < yplus) { yp_high = yplus; } else { yp_low = yplus; } count += 1; } if(count == 1000) { throw common::FailedToConverge(FromHere(), "y+ computation did not converge"); } return yplus; }
开发者ID:barche,项目名称:coolfluid3,代码行数:25,
示例18: nameUint CField::var_number ( const std::string& vname ) const{ const std::vector<std::string>::const_iterator var_loc_it = std::find(m_var_names.begin(), m_var_names.end(), vname); if(var_loc_it == m_var_names.end()) throw Common::ValueNotFound(FromHere(), "Variable " + vname + " was not found in field " + name()); return var_loc_it - m_var_names.begin();}
开发者ID:andrealani,项目名称:coolfluid3,代码行数:7,
示例19: library typename LIB::Ptr library () { const std::string lname = LIB::library_namespace(); //instead of LIB::type_name(); Component::Ptr clib = get_child_ptr(lname); typename LIB::Ptr lib; if ( is_null(clib) ) // doesnt exist so build it { CF::Common::TypeInfo::instance().regist< LIB >( lname ); lib = create_component_ptr< LIB >(lname); cf_assert( is_not_null(lib) ); return lib; } // try to convert existing ptr to LIB::Ptr and return it lib = clib->as_ptr<LIB>(); if( is_null(lib) ) // conversion failed throw CastingFailed( FromHere(), "Found component in CLibraries with name " + lname + " but is not the actual library " + LIB::type_name() ); return lib; }
开发者ID:andrealani,项目名称:coolfluid3,代码行数:25,
示例20: read_data_block void read_data_block(char *data, const Uint count, const Uint block_idx) { static const std::string block_prefix("__CFDATA_BEGIN"); XmlNode block_node = get_block_node(block_idx); const Uint block_begin = from_str<Uint>(block_node.attribute_value("begin")); const Uint block_end = from_str<Uint>(block_node.attribute_value("end")); const Uint compressed_size = block_end - block_begin - block_prefix.size(); // Check the prefix binary_file.seekg(block_begin); std::vector<char> prefix_buf(block_prefix.size()); binary_file.read(&prefix_buf[0], block_prefix.size()); const std::string read_prefix(prefix_buf.begin(), prefix_buf.end()); if(read_prefix != block_prefix) throw SetupError(FromHere(), "Bad block prefix for block " + to_str(block_idx)); if(count != 0) { // Build a decompressing stream boost::iostreams::filtering_istream decompressing_stream; decompressing_stream.set_auto_close(false); decompressing_stream.push(boost::iostreams::zlib_decompressor()); decompressing_stream.push(boost::iostreams::restrict(binary_file, 0, compressed_size)); // Read the data decompressing_stream.read(data, count); decompressing_stream.pop(); } cf3_assert(binary_file.tellg() == block_end); }
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:33,
示例21: SetupErrorvoid BinaryDataReader::read_data_block(char *data, const Uint count, const Uint block_idx){ if(is_null(m_implementation.get())) throw SetupError(FromHere(), "No open file for BinaryDataReader at " + uri().path()); m_implementation->read_data_block(data, count, block_idx);}
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:7,
示例22: clearvoid VectorialFunction::parse(){ clear(); for(Uint i = 0; i < m_functions.size(); ++i) { FunctionParser* ptr = new FunctionParser(); ptr->AddConstant("pi", Consts::pi()); m_parsers.push_back(ptr); // CFinfo << "Parsing Function: /'" << m_functions[i] << "/' Vars: /'" << m_vars << "/'/n" << CFendl; ptr->Parse(m_functions[i],m_vars); if ( ptr->GetParseErrorType() != FunctionParser::FP_NO_ERROR ) { std::string msg("ParseError in VectorialFunction::parse(): "); msg += " Error [" +std::string(ptr->ErrorMsg()) + "]"; msg += " Function [" + m_functions[i] + "]"; msg += " Vars: [" + m_vars + "]"; throw common::ParsingFailed (FromHere(),msg); } } m_result.resize(m_functions.size()); m_is_parsed = true;}
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:26,
示例23: compute_properties static void compute_properties ( const CV& coord, const SV& sol, const GM& grad_vars, MODEL::Properties& p ) { p.coords = coord; // cache the coordiantes locally p.vars = sol; // cache the variables locally p.grad_vars = grad_vars; // cache the gradient of variables locally p.rho = sol[Z0]*sol[Z0]; p.u = sol[Z1]/sol[Z0]; p.v = sol[Z2]/sol[Z0]; p.w = sol[Z3]/sol[Z0]; p.H = sol[Z4]/sol[Z0]; p.uuvvww = p.u*p.u + p.v*p.v + p.w*p.w; p.P = p.gamma_minus_1/p.gamma * p.rho*(p.H - 0.5*p.uuvvww); p.rhou = p.rho * p.u; p.rhov = p.rho * p.v; p.rhow = p.rho * p.w; p.rhoE = p.rho * p.E; p.inv_rho = 1. / p.rho; if( p.P <= 0. ) { std::cout << "rho : " << p.rho << std::endl; std::cout << "rhou : " << p.rhou << std::endl; std::cout << "rhov : " << p.rhov << std::endl; std::cout << "rhoE : " << p.rhoE << std::endl; std::cout << "P : " << p.P << std::endl; std::cout << "u : " << p.u << std::endl; std::cout << "v : " << p.v << std::endl; std::cout << "w : " << p.w << std::endl; std::cout << "uuvvww : " << p.uuvvww << std::endl; throw common::FailedToConverge( FromHere(), "Pressure is negative at coordinates [" + common::to_str(coord[XX]) + "," + common::to_str(coord[YY]) + "," + common::to_str(coord[ZZ]) + "]"); } const Real RT = p.P * p.inv_rho; // RT = p/rho p.E = p.rhoE * p.inv_rho; // E = rhoE / rho p.a2 = p.gamma * RT; p.a = sqrt( p.a2 ); p.Ma = sqrt( p.uuvvww / p.a2 ); p.T = RT / p.R; p.half_gm1_v2 = 0.5 * p.gamma_minus_1 * p.uuvvww; }
开发者ID:khairy,项目名称:coolfluid3,代码行数:59,
示例24: FromHeresolver::CSolver& ActionDirector::solver(){ Handle< solver::CSolver > s = m_solver; if( is_null(s) ) throw common::SetupError( FromHere(), "Solver not yet set for component " + uri().string() ); return *s;}
开发者ID:xyuan,项目名称:coolfluid3,代码行数:8,
注:本文中的FromHere函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FromUTF8函数代码示例 C++ FrmGetObjectIndex函数代码示例 |