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

C++ dimensions函数代码示例

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

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



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

示例1:

std::vector<std::string> petabricks::IterationDefinition::packedargs() const {
  std::string t[] = {
    "IndexT "COORD_BEGIN_STR"["+jalib::XToString(dimensions())+"]",
    "IndexT "COORD_END_STR"["+jalib::XToString(dimensions())+"]"
  };
  return std::vector<std::string>(t, t+2);
}
开发者ID:AikidoGuy,项目名称:petabricks,代码行数:7,代码来源:iterationorders.cpp


示例2: dimensions

/**
 * See also constructor that takes a std::istream.
 */
bool HaarWavelet::write(std::ostream &output) const
{
    if (dimensions() == 0) //won't store a meaningless wavelet
    {
        return false;
    }

    output << dimensions() << ' ';

    bool first = true;
    for (unsigned int i = 0; i < dimensions(); i++)
    {
        if (first)
        {
            first = false;
        }
        else
        {
            output << ' ';
        }
        output << rects[i].x << ' '
               << rects[i].y << ' '
               << rects[i].width << ' '
               << rects[i].height << ' '
               << weights[i];
    }

    return true;
}
开发者ID:ramiromagalhaes,项目名称:haarcommon,代码行数:32,代码来源:haarwavelet.cpp


示例3: user_assert

Expr ImageParam::operator()() const {
    user_assert(dimensions() == 0)
        << "Zero-argument access to Buffer " << name()
        << ", which has " << dimensions() << "dimensions.\n";
    std::vector<Expr> args;
    return Internal::Call::make(param, args);
}
开发者ID:AheadIO,项目名称:Halide,代码行数:7,代码来源:Param.cpp


示例4: return

int QPushButton::baselinePosition(int height) const
{
    // Button text is centered vertically, with a fudge factor to account for the shadow.

    return (int)ceil(-dimensions()[topMargin]
        + ((height + dimensions()[topMargin] + dimensions()[bottomMargin])) / 2.0
        - dimensions()[baselineFudgeFactor]);
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:8,代码来源:KWQPushButton.cpp


示例5: fprintf

 int DynImage::size(int i) const {
     if (i >= dimensions()) {
         fprintf(stderr,
                 "ERROR: accessing size of dim %d of %d-dimensional image %s\n",
                 i, dimensions(), name().c_str());
         assert(i < dimensions());
     }
     return contents->size[i];
 }
开发者ID:gabriel-kent,项目名称:Halide,代码行数:9,代码来源:Image.cpp


示例6: indexSize

void Grid::__init() {
	gSize = indexSize();

	if (trueDimensions() != dimensions())
		cout << gridName << ": dim = " << dimensions() << ", trueDim = "
				<< trueDimensions() << ", index range = " << String(getN())
				<< ", index size = " << indexSize() << endl;

}
开发者ID:blake0701,项目名称:terrainBlockMesher,代码行数:9,代码来源:Grid.cpp


示例7: read

bool MyHaarWavelet::read(std::istream &input)
{
    if ( !HaarWavelet::read(input) )
    {
        return false;
    }

    means.resize(dimensions());
    for (unsigned int i = 0; i < dimensions(); i++)
    {
        input >> means[i];
    }

    return true;
}
开发者ID:ramiromagalhaes,项目名称:haarcommon,代码行数:15,代码来源:haarwavelet.cpp


示例8: assert

SequenceDataPtr TransposeTransformer::TypedApply(SequenceDataPtr sequence,
                                                 const StreamDescription &inputStream,
                                                 const StreamDescription &outputStream)
{
    assert(inputStream.m_storageType == StorageType::dense);
    auto inputSequence = static_cast<DenseSequenceData&>(*sequence.get());
    assert(inputSequence.m_numberOfSamples == 1);
    assert(inputStream.m_sampleLayout->GetNumElements() == outputStream.m_sampleLayout->GetNumElements());

    size_t count = inputStream.m_sampleLayout->GetNumElements() * GetSizeByType(inputStream.m_elementType);

    auto result = std::make_shared<DenseSequenceWithBuffer>();
    result->m_buffer.resize(count);

    ImageDimensions dimensions(*inputStream.m_sampleLayout, ImageLayoutKind::HWC);
    size_t rowCount = dimensions.m_height * dimensions.m_width;
    size_t channelCount = dimensions.m_numChannels;

    auto src = reinterpret_cast<TElemType*>(inputSequence.m_data);
    auto dst = reinterpret_cast<TElemType*>(result->m_buffer.data());

    for (size_t irow = 0; irow < rowCount; irow++)
    {
        for (size_t icol = 0; icol < channelCount; icol++)
        {
            dst[icol * rowCount + irow] = src[irow * channelCount + icol];
        }
    }

    result->m_sampleLayout = outputStream.m_sampleLayout;
    result->m_data = result->m_buffer.data();
    result->m_numberOfSamples = inputSequence.m_numberOfSamples;
    return result;
}
开发者ID:JohnCraigPublic,项目名称:CNTK,代码行数:34,代码来源:ImageTransformers.cpp


示例9: config

void TransposeTransformer::Initialize(TransformerPtr next,
                                      const ConfigParameters &readerConfig)
{
    TransformerBase::Initialize(next, readerConfig);

    // Currently we only support a single stream.
    ImageConfigHelper config(readerConfig);
    size_t featureStreamId = config.GetFeatureStreamId();
    m_appliedStreamIds.push_back(featureStreamId);

    const auto &inputStreams = GetInputStreams();
    m_outputStreams.resize(inputStreams.size());
    std::copy(inputStreams.begin(), inputStreams.end(), m_outputStreams.begin());

    for (auto id : m_appliedStreamIds)
    {
        auto &stream = inputStreams[id];

        ImageDimensions dimensions(*stream->m_sampleLayout, HWC);

        // Changing from NHWC to NCHW
        auto changedStream = std::make_shared<StreamDescription>(*stream);
        changedStream->m_sampleLayout = std::make_shared<TensorShape>(dimensions.AsTensorShape(CHW));
        m_outputStreams[id] = changedStream;
    }
}
开发者ID:6779660,项目名称:CNTK,代码行数:26,代码来源:ImageTransformers.cpp


示例10: dimensions

void Player::init(b2World* world, const glm::vec2& position, taengine::SoundEffect jumpEffect) {
	m_hitbox = new Box;
	glm::vec2 dimensions(1.0f, 2.5f);
	static_cast<Box*> (m_hitbox)->init(world, b2_dynamicBody, position, true, false,
		dimensions, 1.0f, 1.0f, 0.0f, false, FixtureTag::PLAYER_BODY, FixtureTag::ALL);

	m_hitbox->getBody()->SetLinearDamping(2.0f);
	m_hitbox->getBody()->SetUserData(this);

	//add foot sensor fixture
	b2PolygonShape polygonShape;
	polygonShape.SetAsBox(0.45f, 0.2f, b2Vec2(0, -1.25f), 0);
	b2FixtureDef fixtureDef;
	fixtureDef.isSensor = true;
	fixtureDef.shape = &polygonShape;
	fixtureDef.filter.categoryBits = FixtureTag::PLAYER_FOOT;
	fixtureDef.filter.maskBits = FixtureTag::WALL | FixtureTag::ENEMY_BODY;
	b2Fixture* footSensorFixture = m_hitbox->getBody()->CreateFixture(&fixtureDef);
	footSensorFixture->SetUserData((void*)3);

	m_tileSheet.init(taengine::ResourceManager::getTexture("Sprites/anya.png"), glm::ivec2(7, 4));
	m_drawDimensions = glm::vec2(3.0f, 3.0f);

	m_jumpEffect = jumpEffect;

	m_animationSpeed = 0.15f;
	m_animationTime = 0.0f;

	m_direction = 1;

	m_footContacts = 0;

	m_killCount = 0;
	m_moveState = PlayerMoveState::STANDING;
}
开发者ID:NihilAleph,项目名称:ElvenBlood,代码行数:35,代码来源:Player.cpp


示例11: paper_set_units

void paper_set_units(paper_s *p, units_t ut)
{
    // Sanity check parameters.
  assert(p);
  p->units = ut;
  dimensions(p);
}
开发者ID:PatrickHead,项目名称:blue,代码行数:7,代码来源:paper.c


示例12: resize_implement

void
TexelStoreGL::
resize_implement(int new_num_layers)
{
  fastuidraw::ivec3 dims(dimensions());
  int old_num_layers(dims.z());

  if(m_texture_as_r8 != 0)
    {
      /* a resize generates a new texture which then has
         a new backing store. The texture view would then
         be using the old backing store which is useless.
         We delete the old texture view and let texture()
         recreate the view on demand.
       */
      glDeleteTextures(1, &m_texture_as_r8);
      m_texture_as_r8 = 0;
    }

  dims.z() = new_num_layers;
  m_backing_store.resize(dims);

  std::vector<uint8_t> right(dims.y(), 0), bottom(dims.x(), 0);
  for(int layer = old_num_layers; layer < new_num_layers; ++layer)
    {
      set_data(dims.x() - 1, 0, layer, //top right
               1, dims.y(), //entire height
               fastuidraw::make_c_array(right));

      set_data(0, dims.y() - 1, layer, //bottom left
               dims.x() - 1, 1, //entire width
               fastuidraw::make_c_array(bottom));
    }
}
开发者ID:cjcappel,项目名称:fastuidraw,代码行数:34,代码来源:glyph_atlas_gl.cpp


示例13: resize_implement

void
BackingStore::
resize_implement(int new_num_layers)
{
  fastuidraw::ivec2 dims(dimensions());
  m_backing_store.resize(dimensions_for_store(dims.x(), new_num_layers));
}
开发者ID:01org,项目名称:fastuidraw,代码行数:7,代码来源:colorstop_atlas_gl.cpp


示例14: configHelper

ImageDataDeserializer::ImageDataDeserializer(const ConfigParameters& config)
{
    ImageConfigHelper configHelper(config);
    m_streams = configHelper.GetStreams();
    assert(m_streams.size() == 2);
    const auto& label = m_streams[configHelper.GetLabelStreamId()];
    const auto& feature = m_streams[configHelper.GetFeatureStreamId()];

    // Expect data in HWC.
    ImageDimensions dimensions(*feature->m_sampleLayout, configHelper.GetDataFormat());
    feature->m_sampleLayout = std::make_shared<TensorShape>(dimensions.AsTensorShape(HWC));

    label->m_storageType = StorageType::sparse_csc;
    feature->m_storageType = StorageType::dense;

    m_featureElementType = feature->m_elementType;
    size_t labelDimension = label->m_sampleLayout->GetDim(0);

    if (label->m_elementType == ElementType::tfloat)
    {
        m_labelGenerator = std::make_shared<TypedLabelGenerator<float>>();
    }
    else if (label->m_elementType == ElementType::tdouble)
    {
        m_labelGenerator = std::make_shared<TypedLabelGenerator<double>>();
    }
    else
    {
        RuntimeError("Unsupported label element type '%d'.", label->m_elementType);
    }

    CreateSequenceDescriptions(configHelper.GetMapPath(), labelDimension);
}
开发者ID:wgapl,项目名称:CNTK,代码行数:33,代码来源:ImageDataDeserializer.cpp


示例15: SummaryConfig

SummaryConfig::SummaryConfig( const Deck& deck, const EclipseState& es , const ParseContext& parseContext)
    : SummaryConfig( deck,
                        *es.getSchedule(),
                        es.get3DProperties(),
                        parseContext,
                        dimensions( *es.getInputGrid() ) )
{}
开发者ID:magnesj,项目名称:ResInsight,代码行数:7,代码来源:SummaryConfig.cpp


示例16: dimensions

 /// Evaluate gradients of all basis functions associated with
 /// cell at x, writing to grad_f_x. The array grad_f_x must
 /// have size numBasisFunc() * dimensions().  The dimensions()
 /// components of the first basis function gradient come
 /// before the components of the second etc.
 void DGBasisMultilin::evalGrad(const int cell,
                                const double* x,
                                double* grad_f_x) const
 {
     const int dim = dimensions();
     const int num_basis = numBasisFunc();
         const double* cc = grid_.cell_centroids + dim*cell;
         switch (degree_) {
         case 0:
             std::fill(grad_f_x, grad_f_x + num_basis*dim, 0.0);
             break;
         case 1:
             std::fill(grad_f_x, grad_f_x + num_basis*dim, 1.0);
             for (int dd = 0; dd < dim; ++dd) {
                 const double f[2] = { 0.5 - x[dd] + cc[dd],  0.5 + x[dd] - cc[dd] };
                 const double fder[2] = { -1.0,  1.0 };
                 const int divi = 1 << (dim - dd - 1); // { 4, 2, 1 } for 3d, for example.
                 for (int ix = 0; ix < num_basis; ++ix) {
                     const int ind = (ix/divi) % 2;
                     for (int dder = 0; dder < dim; ++dder) {
                         grad_f_x[ix*dim + dder] *= (dder == dd ? fder[ind] : f[ind]);
                     }
                 }
             }
             break;
         default:
             OPM_THROW(std::runtime_error, "Maximum degree is 1 for now.");
         }
 }
开发者ID:OPM,项目名称:opm-core,代码行数:34,代码来源:DGBasis.cpp


示例17: tl

void Bloom::captureBackBuffer()
{
	DX::Viewport vp;

	vp.X = vp.Y = 0;
	vp.MinZ = 0;
	vp.MaxZ = 1;
	vp.Width = bbWidth_;
	vp.Height = bbHeight_;

	if ( wasteOfMemory_->valid() && wasteOfMemory_->push() )
	{
		Moo::rc().setViewport( &vp );
		colourScaleParameters_.setTexture( "diffuseMap", FullScreenBackBuffer::renderTarget().pTexture() );	

		if (colourScale_->begin())
		{
			for ( uint32 i=0; i<colourScale_->nPasses(); i++ )
			{
				colourScale_->beginPass(i);
				// note bbc_ always applies pixel-texel alignment correction
				Vector2 tl(0,0);
				Vector2 dimensions((float)bbWidth_,(float)bbHeight_);
				bbc_->draw( tl, dimensions, tl, dimensions, true);
				colourScale_->endPass();
			}
			colourScale_->end();
		}
		
			
		wasteOfMemory_->pop();
	}
}
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:33,代码来源:bloom_effect.cpp


示例18: tgtAssert

void VolumeResample::resampleVolume() {
    tgtAssert(inport_.hasData(), "Inport has not data");
    forceUpdate_ = false;

    if (inport_.getData()->getRepresentation<Volume>()) {

        Volume::Filter filter;
        if (filteringMode_.isSelected("nearest"))
            filter = Volume::NEAREST;
        else if (filteringMode_.isSelected("linear"))
            filter = Volume::LINEAR;
        else if (filteringMode_.isSelected("cubic"))
            filter = Volume::CUBIC;
        else {
            LERROR("Unknown filter mode: " << filteringMode_.get());
            return;
        }        

        tgt::ivec3 dimensions(resampleDimensionX_.get(), resampleDimensionY_.get(), resampleDimensionZ_.get());
        try {
            VolumeHandle* v = VolumeOperatorResample::APPLY_OP(inport_.getData(), dimensions, filter, progressBar_);
            outport_.setData(v);
        }
        catch (const std::bad_alloc&) {
            LERROR("resampleVolume(): bad allocation");
            outport_.setData(0);
        }
    }
    else {
        outport_.setData(0);
    }
}
开发者ID:bsmr-opengl,项目名称:voreen,代码行数:32,代码来源:volumeresample.cpp


示例19: paper_set_orientation

void paper_set_orientation(paper_s *p, paper_orientation_t o)
{
    // Sanity check parameters.
  assert(p);
  p->orientation = o;
  dimensions(p);
}
开发者ID:PatrickHead,项目名称:blue,代码行数:7,代码来源:paper.c


示例20: assert

			void PixelBufferGL15::blitFrom(AE::Graphics::ColorBuffer *source, AE::Math::Point2<AE::uint> srcOffset, AE::Math::Point2<AE::uint> srcDimensions, AE::Math::Point2<AE::int32> const &destPosition)
			{
				assert(srcDimensions.x >= srcOffset.x && 
					   srcDimensions.y >= srcOffset.y);

				void *pixels = source->getData();

				glBindTexture(GL_TEXTURE_2D, mTextureGL);

				AE::int32 y;
				AE::Math::Point2<AE::uint> dimensions(srcDimensions.x - srcOffset.x, srcDimensions.y - srcOffset.y);

				if(AE::Graphics::AxesConvention2d::verticalDirection == AE::Graphics::VD_BOTTOM_TO_TOP)
					y = mDimensions.y - destPosition.y - dimensions.y;
				else
					y = destPosition.y;

				glTexSubImage2D(GL_TEXTURE_2D, 0, 
								destPosition.x, y, 
								dimensions.x, dimensions.y, 
								static_cast<AE::Graphics::Device::PixelBufferGL15 *>(source)->mPixelFormatGL, 
								static_cast<AE::Graphics::Device::PixelBufferGL15 *>(source)->mTypeGL, 
								pixels);

				GLenum error = glGetError();
				assert(error == 0);
			}
开发者ID:edamiani,项目名称:Anima-Engine,代码行数:27,代码来源:PixelBufferGL15.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ dimof函数代码示例发布时间:2022-05-30
下一篇:
C++ dimensionedScalar函数代码示例发布时间: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