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

C++ element_type类代码示例

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

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



在下文中一共展示了element_type类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: erase

			void erase(element_type const & elem)
			{
				typedef std::pair<uint64_t,uint64_t> upair;
				typedef std::pair<int,upair> q_element;
				
				std::deque< q_element > todo; 
				
				if ( elem.getTo() > elem.getFrom() )
				{
					todo.push_back(q_element(k,upair(elem.getFrom(),elem.getTo())));
			
					while ( todo.size() )
					{
						q_element q = todo.front();
						todo.pop_front();
						
						int const level = k-q.first;

						uint64_t const basebin = (1ull << level)-1;
						uint64_t const div = (1ull<<(q.first+1));
						
						uint64_t const mask = (q.first >= 0) ? (1<<q.first) : 0;

						uint64_t const low = q.second.first;
						uint64_t const high = q.second.second;
						uint64_t const bin = basebin + low/div;

						// std::cerr << level << "," << q.first << "," << q.second.first << "," << q.second.second << "," << basebin << "," << div << "," << bin << std::endl;
						
						assert ( high > low );
						
						bool const cross = ((high-1)&mask) != (low & mask);
						
						if ( cross || q.first < 0 )
						{
							if ( bins.find(bin) != bins.end() )
							{
								std::vector<element_type> & V = bins.find(bin)->second;
								
								uint64_t o = 0;
								for ( uint64_t i = 0; i < V.size(); ++i )
									if ( !(V[i] == elem) )
										V[o++] = V[i];
								
								V.resize(o);
							}
							break;
						}
						else
						{
							assert ( q.first >= 0 );
							todo.push_back(q_element(q.first-1,upair(low,high)));
						}
					}
				}
			}
开发者ID:jameslz,项目名称:libmaus2,代码行数:56,代码来源:RangeSet.hpp


示例2: create_boundary_elements

      static void create_boundary_elements(element_type & element, inserter_type & inserter)
      {
        BoundaryElementType boundary_element( inserter.get_physical_container_collection() );

        int index = 0;
        for (int i = 0; i < boundary_elements<simplex_tag<n>, vertex_tag >::num; ++i)
            for (int j = i+1; j < boundary_elements<simplex_tag<n>, vertex_tag >::num; ++j)
            {
                boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(i), 0 );
                boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(j), 1 );

                element.set_boundary_element( boundary_element, inserter.template insert<true, true>(boundary_element), index++ );
            }
      }
开发者ID:jonancm,项目名称:viennagrid-dev,代码行数:14,代码来源:simplex.hpp


示例3: defined

void
Navierstokes::exportResults( double time, element_type& U )
{
    auto u = U.element<0>();
    auto p = U.element<1>();

    auto v = V.element<0>();
    auto q = V.element<1>();
#if defined( FEELPP_USE_LM )
    auto lambda = U.element<2>();
    auto nu = V.element<2>();
    LOG(INFO) << "value of the Lagrange multiplier lambda= " << lambda( 0 ) << "\n";

#endif

    double div_u_error_L2 = normL2( _range=elements( u.mesh() ), _expr=divv( u ) );
    LOG(INFO) << "[navierstokes] ||div(u)||_2=" << div_u_error_L2 << "\n";

    if ( exporter->doExport() )
    {
        exporter->step( time )->setMesh( U.functionSpace()->mesh() );
        exporter->step( time )->addRegions();
        exporter->step( time )->add( {"u","p","l"}, U );
        exporter->save();
    }

} // NavierStokes::export
开发者ID:LANTZT,项目名称:feelpp,代码行数:27,代码来源:ns.hpp


示例4: assert_space

void SparseVector<T_Element,T_Alloc>::insert_element(element_type ele)
{
  assert_space(1);
  assert_is_sorted();
  // Find the insertion point
  if( nz() ) {
    typedef SparseVectorUtilityPack::SpVecIndexLookup<T_Element> SpVecIndexLookup;
    typedef typename SpVecIndexLookup::poss_type poss_type;
    index_lookup_.validate_state();
    poss_type poss
      = ( nz()
          ? index_lookup_.find_poss(ele.index(), SpVecIndexLookup::LOWER_ELE)
          : poss_type(0,SpVecIndexLookup::BEFORE_ELE)
        );
    // Make sure this element does not already exist!
#ifdef TEUCHOS_DEBUG
    TEUCHOS_TEST_FOR_EXCEPTION(
      nz() && poss.rel == SpVecIndexLookup::EQUAL_TO_ELE, std::length_error
      ,"SparseVector<...>::insert_element(...) : Error, this index"
      " all ready exists!" );
#endif
    const size_type
      insert_poss = (poss.rel == SpVecIndexLookup::BEFORE_ELE ? poss.poss : poss.poss+1);
    // Copy elements out of the way to make room for inserted element
    std::copy_backward( // This assumes element_type supports assignment!
      index_lookup_.ele() + insert_poss, index_lookup_.ele() + index_lookup_.nz()
      , index_lookup_.ele() + index_lookup_.nz() + 1 );
    index_lookup_.ele()[insert_poss] = ele;
    index_lookup_.incr_nz();
  }
  else { // The first element we are adding!
    index_lookup_.ele()[0] = ele;
    index_lookup_.incr_nz();
  }
}
开发者ID:00liujj,项目名称:trilinos,代码行数:35,代码来源:AbstractLinAlgPack_SparseVectorClassDef.hpp


示例5: LOG

void
AdvectionDiffusion::exportResults( element_type& U , parameter_type const& mu )
{

    if ( M_do_export )
    {
        LOG(INFO) << "exportResults starts\n";

        std::string exp_name;
        export_ptrtype exporter;
        std::string mu_str;

        for ( int i=0; i<mu.size(); i++ )
        {
            mu_str= mu_str + ( boost::format( "_%1%" ) %mu[i] ).str() ;
        }

        exp_name = "solution_with_parameters_" + mu_str;

        exporter = export_ptrtype( Exporter<mesh_type>::New( "ensight", exp_name  ) );
        exporter->step( 0 )->setMesh( U.functionSpace()->mesh() );
        exporter->step( 0 )->add( "u", U );
        exporter->save();
    }
} // AdvectionDiffusion::export
开发者ID:ChaliZhg,项目名称:feelpp,代码行数:25,代码来源:ad.hpp


示例6: insert

			void insert(element_type const & elem)
			{
				typedef std::pair<uint64_t,uint64_t> upair;
				typedef std::pair<int,upair> q_element;
				
				std::deque< q_element > todo; 
				
				if ( elem.getTo() > elem.getFrom() )
				{
					todo.push_back(q_element(k,upair(elem.getFrom(),elem.getTo())));
			
					while ( todo.size() )
					{
						q_element q = todo.front();
						todo.pop_front();
						
						int const level = k-q.first;

						uint64_t const basebin = (1ull << level)-1;
						uint64_t const div = (1ull<<(q.first+1));
						
						uint64_t const mask = (q.first >= 0) ? (1<<q.first) : 0;

						uint64_t const low = q.second.first;
						uint64_t const high = q.second.second;
						uint64_t const bin = basebin + low/div;

						// std::cerr << level << "," << q.first << "," << q.second.first << "," << q.second.second << "," << basebin << "," << div << "," << bin << std::endl;
						
						assert ( high > low );
						
						bool const cross = ((high-1)&mask) != (low & mask);
						
						if ( cross || q.first < 0 )
						{
							bins[bin].push_back(elem);
							break;
						}
						else
						{
							assert ( q.first >= 0 );
							todo.push_back(q_element(q.first-1,upair(low,high)));
						}
					}
				}
			}
开发者ID:jameslz,项目名称:libmaus2,代码行数:46,代码来源:RangeSet.hpp


示例7: operator

 // apply the functional
 virtual value_type
 operator()( const element_type& x ) const
 {
     //auto vector = sumAllVectors( true );
     auto vector = M_backend->newVector( this->space() );
     sumAllVectors( vector, true );
     vector->close();
     return M_backend->dot( *vector, x.container() );
 }
开发者ID:dbarbier,项目名称:feelpp,代码行数:10,代码来源:fsfunctionallinearcomposite.hpp


示例8: operator

    // apply the functional
    virtual value_type
    operator()( const element_type& x ) const
    {
        auto vector = M_backend->newVector( this->space() );
        form1( _test=this->space(),_vector=vector) = M_expr;
        vector->close();

        return M_backend->dot( *vector, x.container() );
    }
开发者ID:TrojanXu,项目名称:feelpp,代码行数:10,代码来源:fsfunctionallinearfree.hpp


示例9: _write_optional_enclosure_field

	void CSVDocument::_write_optional_enclosure_field( std::ostream& out_stream, const element_type& elem, bool last_elem )
	{
		if (elem.find("\"") != std::string::npos)
		{
			std::string new_elem = elem;
			_replace_all(new_elem, "\"", "\"\"");
			out_stream << "\"" << new_elem << "\"";
		}
		else if (elem.find(",") != std::string::npos || elem.find("\n") != std::string::npos)
		{
			out_stream << "\"" << elem << "\"";
		}
		else
		{
			out_stream << elem;
		}

		out_stream << (last_elem ? "\n" : ",");
	}
开发者ID:hzqst,项目名称:CaptionMod,代码行数:19,代码来源:csv_document.cpp


示例10: Ublas2Epetra

    static void Ublas2Epetra( element_type const& x, vector_ptrtype& v )
    {
        epetra_vector_type& _v( dynamic_cast<epetra_vector_type&>( *v ) );
        Epetra_Map v_map( _v.Map() );

        DVLOG(2) << "Local size of ublas vector" << x.localSize() << "\n";
        DVLOG(2) << "Local size of epetra vector" << v->localSize() << "\n";

        const size_type L = v->localSize();

        for ( size_type i=0; i<L; i++ )
        {
            DVLOG(2) << "v[" << v_map.GID( i ) << "] = "
                           << "x(" << x.firstLocalIndex() + i  << ")="
                           << x( x.firstLocalIndex() + i ) << "\n";

            v->set( v_map.GID( i ), x( x.firstLocalIndex() + i ) );
        }
    }
开发者ID:TrojanXu,项目名称:feelpp,代码行数:19,代码来源:backendtrilinos.hpp


示例11: U

void
ConvectionCrb::solve( sparse_matrix_ptrtype& D,
              element_type& u,
              vector_ptrtype& F )
{

    vector_ptrtype U( M_backend->newVector( u.functionSpace() ) );
    M_backend->solve( D, D, U, F );
    u = *U;
}
开发者ID:ChaliZhg,项目名称:feelpp,代码行数:10,代码来源:convection_crb_other.cpp


示例12:

void
Beam<nDim,nOrder>::exportResults( double time, element_type const& u, element_type const &v  )
{
    timers["export"].first.restart();

    exporter->step( time )->setMesh( u.functionSpace()->mesh() );
    exporter->step( time )->add( "displ", u );
    exporter->step( time )->add( "P", v );
    exporter->save();
    timers["export"].second = timers["export"].first.elapsed();
} // Beam::export
开发者ID:LANTZT,项目名称:feelpp,代码行数:11,代码来源:beam.cpp


示例13: Epetra2Ublas

    static void Epetra2Ublas( vector_ptrtype const& u, element_type& x )
    {
        epetra_vector_ptrtype const& _v( dynamic_cast<epetra_vector_ptrtype const&>( u ) );
        Epetra_Map v_map( _v->Map() );

        vector_type v = *u;

        //DVLOG(2) << "Initial EpetraVector " << v << "\n";

        const size_type L = v.localSize();

        for ( size_type i=0; i<L; i++ )
        {
            DVLOG(2) << "x(" << x.firstLocalIndex() + i  << ")="
                           << "v[" << v_map.GID( i ) << "] = "
                           << v( i ) << "\n";

            x( x.firstLocalIndex() + i ) = v( i );
        }

        DVLOG(2) << "Epetra2Ublas:" << x << "\n";
    }
开发者ID:TrojanXu,项目名称:feelpp,代码行数:22,代码来源:backendtrilinos.hpp


示例14: LOG

void
Microphone::exportResults( element_type& U )
{
    if ( M_do_export )
    {
        LOG(INFO) << "exportResults starts\n";

        exporter->step( 0 )->setMesh( U.functionSpace()->mesh() );

        exporter->step( 0 )->add( "u", U );

        exporter->save();
    }
} // Microphone::export
开发者ID:ChaliZhg,项目名称:feelpp,代码行数:14,代码来源:mic.hpp


示例15: LOG

void
AnisotropicWavespeed::exportResults( element_type& U )
{
    if ( M_do_export )
    {
        LOG(INFO) << "exportResults starts\n";

        exporter->step( 0 )->setMesh( U.functionSpace()->mesh() );

        exporter->step( 0 )->add( "u", U );

        exporter->save();
    }
} // AnisotropicWavespeed::export
开发者ID:ChaliZhg,项目名称:feelpp,代码行数:14,代码来源:aw.hpp


示例16: markedfaces

void DrivenCavity<Dim>::exportResults( element_type const& U )
{
    auto uex=unitX();
    auto u_exact=vf::project(Vh->template functionSpace<0>(), markedfaces(mesh, "wall2"), uex );

    if ( exporter->doExport() )
    {
        exporter->step( 0 )->setMesh( U.functionSpace()->mesh() );
        exporter->step( 0 )->addRegions();
        exporter->step( 0 )->add( "u", U.template element<0>() );
        exporter->step( 0 )->add( "p", U.template element<1>() );
        exporter->step( 0 )->add( "uex", u_exact);
        exporter->save();
    }

}
开发者ID:LANTZT,项目名称:feelpp,代码行数:16,代码来源:drivencavity_impl.hpp


示例17: create_boundary_elements

      static void create_boundary_elements(element_type & element, inserter_type & inserter)
      {
        BoundaryElementType boundary_element( inserter.get_physical_container_collection() );
        int index = 0;

        boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(0), 0 );
        boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(1), 1 );
        element.set_boundary_element( boundary_element, inserter.template insert<true, true>(boundary_element), index++ );

        boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(0), 0 );
        boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(2), 1 );
        element.set_boundary_element( boundary_element, inserter.template insert<true, true>(boundary_element), index++ );

        boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(1), 0 );
        boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(3), 1 );
        element.set_boundary_element( boundary_element, inserter.template insert<true, true>(boundary_element), index++ );

        boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(2), 0 );
        boundary_element.container(dimension_tag<0>()).set_handle( element.container( dimension_tag<0>() ).handle_at(3), 1 );
        element.set_boundary_element( boundary_element, inserter.template insert<true, true>(boundary_element), index++ );
      }
开发者ID:rollingstone,项目名称:viennamos-dev,代码行数:21,代码来源:quadrilateral.hpp


示例18: visit

bool transaction_order_calculator::visit(element_type element)
{
    bool reenter = false;
    transaction_entry::list required;
    for (auto& parent : element->parents())
        if (!parent->is_anchor() && !has_encountered(parent))
            required.push_back(parent);

    if (required.size() > 0)
    {
        reenter = true;
        enqueue(element);
        for (auto entry : required)
            enqueue(entry);
    }
    else
        ordered_.push_back(element);

    return !reenter;
}
开发者ID:evoskuil,项目名称:libbitcoin-blockchain,代码行数:20,代码来源:transaction_order_calculator.cpp


示例19: operator

 // apply the functional
 virtual value_type
 operator()( const element_type& x ) const
 {
     M_vector->close();
     return M_backend->dot( *M_vector, x.container() );
 }
开发者ID:LANTZT,项目名称:feelpp,代码行数:7,代码来源:fsfunctionallinear.hpp


示例20: search

			std::vector<element_type const *> search(element_type const & elem) const
			{
				std::vector<element_type const *> R;
			
				typedef std::pair<uint64_t,uint64_t> upair;
				typedef std::pair<int,upair> q_element;
				
				std::deque< q_element > todo; 
				
				if ( elem.getTo() > elem.getFrom() )
					todo.push_back(q_element(k,upair(elem.getFrom(),elem.getTo())));
			
				while ( todo.size() )
				{
					q_element q = todo.front();
					todo.pop_front();
					
					int const level = k-q.first;

					uint64_t const basebin = (1ull << level)-1;
					uint64_t const div = (1ull<<(q.first+1));
					
					uint64_t const mask = (q.first >= 0) ? (1<<q.first) : 0;

					uint64_t const low = q.second.first;
					uint64_t const high = q.second.second;
					uint64_t const bin = basebin + low/div;
					
					if ( bins.find(bin) != bins.end() )
					{
						std::vector<element_type> const & V = bins.find(bin)->second;
						for ( uint64_t i = 0; i < V.size(); ++i )
						{
							libmaus2::math::IntegerInterval<uint64_t> I0(elem.getFrom(),elem.getTo()-1);
							libmaus2::math::IntegerInterval<uint64_t> I1(V[i].getFrom(),V[i].getTo()-1);
							if ( !I0.intersection(I1).isEmpty() )
								R.push_back(&V[i]);
						}
							
					}

					// std::cerr << level << "," << q.first << "," << q.second.first << "," << q.second.second << "," << basebin << "," << div << "," << bin << std::endl;
					
					assert ( high > low );
					
					bool const cross = ((high-1)&mask) != (low & mask);
					
					if ( cross )
					{
						uint64_t const mid = ((low >> q.first)+1)<<q.first;
						
						// std::cerr << "low=" << low << ",mid=" << mid << ",high=" << high << std::endl;
						
						assert ( mid > low );
						assert ( high > mid );
						
						todo.push_back(q_element(q.first-1,upair(low,mid)));
						todo.push_back(q_element(q.first-1,upair(mid,high)));
					}
					else if ( q.first >= 0 )
					{
						todo.push_back(q_element(q.first-1,upair(low,high)));
					}
					else
					{
						// std::cerr << "base " << low << "," << high << " bin " << bin << std::endl;
					}
				}
开发者ID:jameslz,项目名称:libmaus2,代码行数:68,代码来源:RangeSet.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ emu_file类代码示例发布时间:2022-05-31
下一篇:
C++ element类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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