当前位置: 首页>>代码示例>>C++>>正文


C++ FromHere函数代码示例

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


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


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