• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ FromHere函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FromHere函数的典型用法代码示例。如果您正苦于以下问题:C++ FromHere函数的具体用法?C++ FromHere怎么用?C++ FromHere使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FromHere函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:CommWrapperMArray.hpp


示例2: BadValue

CLink& 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,代码来源:CLink.cpp


示例3: ValueNotFound

void 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,代码来源:NLink.cpp


示例4: plane_jacobian_normal

RealVector 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,代码来源:ElementType.cpp


示例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,代码来源:OptionArrayDetail.hpp


示例6: QTreeView

TreeView::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,代码来源:TreeView.cpp


示例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,代码来源:StringConversion.cpp


示例8: FromHere

const 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,代码来源:Triag2DLagrangeP2B.cpp


示例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,代码来源:CommWrapperMArray.hpp


示例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,代码来源:CommWrapperMArray.hpp


示例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,代码来源:ElementCaching.hpp


示例12: data_MIX

double 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,代码来源:DerivativesType5.cpp


示例13: uri

void 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,代码来源:CPlotXY.cpp


示例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,代码来源:ComponentWrapper.hpp


示例15: uri

Field& 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,代码来源:Dictionary.cpp


示例16: Solve3x3eqn

void 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,代码来源:MathMiscFn.cpp


示例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,代码来源:KEpsilonPhysics.cpp


示例18: name

Uint 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,代码来源:CField.cpp


示例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,代码来源:CLibraries.hpp


示例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,代码来源:BinaryDataReader.cpp



注:本文中的FromHere函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FromUTF8函数代码示例发布时间:2022-05-30
下一篇:
C++ FrmGetObjectIndex函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap