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


C++ element_type类代码示例

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


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


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