本文整理汇总了C++中boost::array::end方法的典型用法代码示例。如果您正苦于以下问题:C++ array::end方法的具体用法?C++ array::end怎么用?C++ array::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::array
的用法示例。
在下文中一共展示了array::end方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
//--------------------------------------------------------------------------
//! Construct with signed distance function values of the vertices
void create( const boost::array<double,numElementNodes>& signedDistances )
{
// Minimal value of signed distances
const double distMin = *(std::min_element( signedDistances.begin(),
signedDistances.end() ) );
// Maximal value of signed distances
const double distMax = *(std::max_element( signedDistances.begin(),
signedDistances.end() ) );
// Change of signs implies a cut cell
if ( (distMin * distMax) <= 0. ) {
isCut_ = true;
isInside_ = false;
isOutside_ = false;
// get the vertices of the shape
boost::array<VecDim,LinearLagrange::numFun> vertexCoordinates;
LinearLagrange::supportPoints( vertexCoordinates );
boost::array<unsigned,LinearLagrange::numFun> vertexIndices;
// fill nodes with the vertices of this shape
for ( unsigned v = 0; v < vertexCoordinates.size(); v++ ) {
nodes_.push_back( vertexCoordinates[v] );
vertexIndices[v] = v;
}
// create the internal structure of the cut cell
std::map<base::cut::Edge,unsigned> uniqueNodes;
base::cut::MarchingProxy<shape,geomDegree>::apply( signedDistances,
vertexIndices,
nodes_,
uniqueNodes,
surface_,
volumeIn_, volumeOut_,
false );
}
else {
isCut_ = false;
// decide location of cell which is not cut
if ( distMax < 0. ) { isInside_ = false; isOutside_ = true; }
else { isInside_ = true; isOutside_ = false; }
}
}
示例2: setup_covariance
void setup_covariance(boost::array<double, 9> &cov, double stdev) {
std::fill(cov.begin(), cov.end(), 0.0);
if (stdev == 0.0)
cov[0] = -1.0;
else {
cov[0+0] = cov[3+1] = cov[6+2] = std::pow(stdev, 2);
}
}
示例3: Stepper
BOOST_AUTO_TEST_CASE_TEMPLATE( transitivity1 , Stepper , dummy_steppers )
{
typedef times_iterator< Stepper , empty_system , state_type , time_iterator_type > stepper_iterator;
std::cout << "transitivity1" << std::endl;
state_type x = {{ 1.0 }};
stepper_iterator first1( Stepper() , empty_system() , x , times.end() , times.end() , 0.1 );
stepper_iterator last1( Stepper() , empty_system() , x );
stepper_iterator last2( Stepper() , empty_system() , x );
BOOST_CHECK( first1 == last1 );
BOOST_CHECK( first1 == last2 );
BOOST_CHECK( last1 == last2 );
first1 = stepper_iterator( Stepper() , empty_system() , x , times.end()-1 , times.end() , 0.1 );
last1 = stepper_iterator( Stepper() , empty_system() , x );
BOOST_CHECK( first1 != last1 );
BOOST_CHECK( ++first1 == last1 );
}
示例4: HandleReceive
void DiscoveryServer::HandleReceive(const boost::system::error_code& error) {
if (!error &&
std::string(m_recv_buffer.begin(), m_recv_buffer.end()) == DISCOVERY_QUESTION) {
m_socket.send_to(
boost::asio::buffer(DISCOVERY_ANSWER + boost::asio::ip::host_name()),
m_remote_endpoint);
}
Listen();
}
示例5:
~FiberControl(){
AUTO(it, g_stack_pool.begin());
for(;;){
if(it == g_stack_pool.end()){
stack.reset();
break;
}
if(!*it){
stack.swap(*it);
break;
}
++it;
}
}
示例6: FiberControl
explicit FiberControl(Initializer)
: state(FS_READY)
{
AUTO(it, g_stack_pool.begin());
for(;;){
if(it == g_stack_pool.end()){
stack.reset(new StackStorage);
break;
}
if(*it){
stack.swap(*it);
break;
}
++it;
}
}
示例7: first
BOOST_AUTO_TEST_CASE_TEMPLATE( copy_algorithm , Stepper , dummy_steppers )
{
typedef times_iterator< Stepper , empty_system , state_type , time_iterator_type> stepper_iterator;
state_type x = {{ 1.0 }};
std::vector< state_type > res;
stepper_iterator first( Stepper() , empty_system() , x , times.begin() , times.end() , 0.1 );
stepper_iterator last( Stepper() , empty_system() , x );
std::copy( first , last , std::back_insert_iterator< std::vector< state_type > >( res ) );
BOOST_CHECK_EQUAL( res.size() , size_t( 4 ) );
BOOST_CHECK_CLOSE( res[0][0] , 1.0 , 1.0e-13 );
BOOST_CHECK_CLOSE( res[1][0] , 1.25 , 1.0e-13 );
BOOST_CHECK_CLOSE( res[2][0] , 1.5 , 1.0e-13 );
BOOST_CHECK_CLOSE( res[3][0] , 1.75 , 1.0e-13 );
BOOST_CHECK_CLOSE( x[0] , 1.75 , 1.0e-13 ); // the iterator should not iterate over the end
}
示例8: setDimensions
/** @brief Set the dimensions of the image, allocate memory, etc.
\param dims Sizes of each non trival dimension (min=1, max=3), supposed in row major order.
n[0] varies slower than n[1], itself variing slower that n[3]
For a 3D image scanned with x faster than y faster than z, the dimensions must be given in reverse order
n[0]=dimz, n[1]=dimy, n[2]=dimx
*/
void Tracker::setDimensions(const boost::array<size_t,3> &dims)
{
//allocate main memory block for FFT.
// Last dimension has to be padded with extra values to allow real2complex and c2r fft
boost::array<size_t,3> paddedDims = dims;
paddedDims.back()= 2*(paddedDims.back()/2+1);
size_t memsize = 1;
memsize = accumulate(paddedDims.begin(),paddedDims.end(),1,multiplies<size_t>());
cout<<"Allocating a block of "<<sizeof(float) * memsize<<" bytes ... ";
data = (float*)fftwf_malloc(sizeof(float)* memsize);
assert(data);
//allocate memory.
centersMap.resize(dims);
paddedDims.back() = dims.back()/2 + 1;
FFTmask.resize(paddedDims);
//planning fft.
int n[3];
copy(dims.begin(),dims.end(),&(n[0]));
forward_plan = fftwf_plan_dft_r2c(dims.size(), &(n[0]), data, (fftwf_complex *)data, flags);
//n[2] = 2*(n[2]/2 +1);
backward_plan = fftwf_plan_dft_c2r(dims.size(), &(n[0]), (fftwf_complex *)data, data, flags);
}
示例9: end
const_iterator end() const
{
return values.end();
}
示例10: toBools
Bools toBools( boost::array<bool,nb> const & t )
{
Bools b;
b.insert (b.end(), t.begin(), t.end());
return b;
}
示例11: trigger_path_names
typedef std::vector<std::string> Strings;
typedef std::vector<Strings> VStrings;
typedef std::vector<bool> Bools;
typedef std::vector<Bools> VBools;
// Name all our paths. We have as many paths as there are trigger
// bits.
size_t const num_trig_paths = 8;
boost::array<char const*, num_trig_paths> cpaths =
{{
"ap1", "ap2", "aq1", "aq2",
"bp1", "bp2", "bq1", "bq2",
}};
Strings trigger_path_names(cpaths.begin(),cpaths.end());
struct PathSpecifiers {
Strings path;
PathSpecifiers (std::string const & s0,
std::string const & s1 = "",
std::string const & s2 = "",
std::string const & s3 = "",
std::string const & s4 = "",
std::string const & s5 = "",
std::string const & s6 = "",
std::string const & s7 = "",
std::string const & s8 = "",
std::string const & s9 = "" ) : path()
{
示例12:
BOOST_AUTO_TEST_CASE_TEMPLATE( stepper_iterator_factory , Stepper , dummy_steppers )
{
std::cout << "factory" << std::endl;
Stepper stepper;
empty_system system;
state_type x = {{ 1.0 }};
std::for_each(
make_times_iterator_begin( stepper , boost::ref( system ) , x , times.begin(), times.end() , 0.1 ) ,
make_times_iterator_end<time_iterator_type>( stepper , boost::ref( system ) , x ) ,
dummy_observer() );
// dummy_steppers just add 0.25 at each step, the above for_each leads to 3 do_step calls so x should be 1.75
BOOST_CHECK_CLOSE( x[0] , 1.75 , 1.0e-13 );
}