本文整理汇总了C++中XVector类的典型用法代码示例。如果您正苦于以下问题:C++ XVector类的具体用法?C++ XVector怎么用?C++ XVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XVector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: loadQImage
void SyImageBase::loadQImage(const QImage &imageIn)
{
SProfileFunction
int width = imageIn.width();
int height = imageIn.height();
XVector<float> data;
data.resize(width * height);
xsize bytesPerPixel = imageIn.depth()/8;
const quint8 *pixel = imageIn.bits();
for(int i = 0; i < height; ++i )
{
xsize rowPos = i * width;
for(int j = 0; j < width; ++j)
{
data[rowPos+j] = (float)*pixel/255.0f;
pixel += bytesPerPixel;
}
}
image.set(width, height, data);
postSet();
}
开发者ID:davidmueller13,项目名称:vexx,代码行数:25,代码来源:syimagebase.cpp
示例2: GetSizeFinal
void XWndPrivateRaidSpot::Update()
{
XWndSpot::Update();
// 도전마크를 스팟위에 그림
const auto size = GetSizeFinal();
XVector<XWnd*> aryChild;
XE::VEC2 vlPos = XE::VEC2( -8, -size.h );
for( int i = 0; i < 2; ++i ) {
const bool bOn = !(i < m_pSpot->GetnumWins());
const std::string ids = XE::Format( "img.mark%d", i );
auto pImg = XWndImage::sUpdateCtrl( this, ids );
if( pImg ) {
if( i == 0 ) {
//vlPos.y -= pImg->GetSizeLocal().h;
}
aryChild.push_back( pImg );
if( bOn ) {
pImg->SetSurfaceRes( PATH_UI("chall_mark_on.png") );
} else {
pImg->SetSurfaceRes( PATH_UI( "chall_mark_off.png" ) );
}
pImg->SetPosLocal( vlPos );
vlPos.x += pImg->GetSizeLocal().w;
}
}
// AutoLayoutHCenterWithAry( aryChild, 0.f );
}
开发者ID:xahgo,项目名称:tama,代码行数:28,代码来源:XWndSpots.cpp
示例3: XBREAK
/**
@brief 효과 시전
pEffect의 효과를 기준타겟(pBaseTarget)을 기준으로 시전대상을 선정하여 시전한다.
현재 _vPos는 사용하지 않는다
*/
xtError XSkillUser::UseEffect( const XSkillDat *pDat,
EFFECT *pEffect,
int level,
XSkillReceiver *pBaseTarget,
const XE::VEC2& vBaseTarget, // 기준타겟이 좌표형일경우.
ID idCallerSkill )
{
// 좌표에 값이 있으면 타겟은 널이어야 한다.,
XBREAK( vBaseTarget.IsNotZero() && pBaseTarget != nullptr );
XVector<XSkillReceiver*> aryCastTargets; // 시전대상
// 기준타겟이나 기준좌표로 시전대상을 얻는다.
XBREAK( pBaseTarget == nullptr && vBaseTarget.IsZero() );
//
XE::VEC2 vCastTarget;
GetCastingTargetList( &aryCastTargets,
&vCastTarget,
pEffect->castTarget,
pDat,
pEffect,
level,
pBaseTarget,
vBaseTarget );
//
if( vCastTarget.IsZero() && aryCastTargets.empty() ) {
return xERR_NOT_FOUND_CASTING_TARGET; // 시전대상을 찾지 못함
}
if( aryCastTargets.size() ) {
// 캐스팅 대상들에게 효과를 시전한다.
for( auto pCastingTarget : aryCastTargets ) {
// 즉시시전 or 버프방식
const XE::VEC2 vZero;
CastEffToCastTarget( pDat,
pEffect,
level,
// pBaseTarget,
pCastingTarget,
vZero,
idCallerSkill );
}
} else
if( vCastTarget.IsNotZero() ) {
// 시전대상이 좌표형
CastEffToCastTarget( pDat,
pEffect,
level,
nullptr,
vCastTarget,
idCallerSkill );
} else {
XBREAK(1);
}
return xOK;
}
开发者ID:xahgo,项目名称:tama,代码行数:58,代码来源:XSkillUser.cpp
示例4: V_AddVector
RVector V_AddVector( const RVector & r,const typename XVector::scalar_type &av,const XVector & x,
const typename XVector::scalar_type &bv, const YVector & y)
{
V_AddVectorFunctor<RVector,XVector,YVector,doalpha,dobeta> f(r,av,x,bv,y);
parallel_for(x.dimension_0(),f);
return r;
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例5: MV_Add
RVector MV_Add( const RVector & r, const XVector & x, const YVector & y)
{
KokkosArray::View<typename XVector::value_type* , KokkosArray::LayoutRight, typename XVector::device_type> dummy;
if(x.dimension(1)>16)
return MV_AddVector( r,dummy,x,dummy,y,1,1);
return MV_AddUnroll( r,dummy,x,dummy,y,1,1);
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例6: CastEffToCastTargetByDirect
/**
@brief 즉시시전형태(비버프형)의 효과를 시전대상에게 시전한다.
*/
xtError XSkillUser::CastEffToCastTargetByDirect( const XSkillDat *pDat,
const EFFECT *pEffect,
int level,
XSkillReceiver *pCastingTarget,
const XE::VEC2& vCastTarget )
{
XVector<XSkillReceiver*> aryInvokeTarget;
// 1회성이기때문에 루아도 쓰고 바로 파괴되는걸로 함
// 시전대상자(pCastingTarget)기준 발동대상 얻음
XE::VEC2 vIvkTarget; // 발동대상이 좌표형태일때 여기로 좌표가 담긴다.
int numInvoke = GetInvokeTarget( &aryInvokeTarget,
&vIvkTarget,
pDat,
level,
pEffect->invokeTarget,
pEffect,
pCastingTarget,
vCastTarget );
if( numInvoke > 0 || vIvkTarget.IsNotZero() ) {
bool bCreateSfx = ( pEffect->m_invokeTargetEff.m_strSpr.empty() ) ? false : true;
if( aryInvokeTarget.size() ) {
for( auto pInvokeTarget : aryInvokeTarget ) {
// 발동대상들에게 효과 적용
ApplyInvokeEffToIvkTarget( pInvokeTarget,
vIvkTarget,
pDat,
pEffect,
GetThisRecv(), // invoker
bCreateSfx,
level,
nullptr ); // pBuff
} // for
} else
if( vIvkTarget.IsNotZero() ) {
// 발동좌표에 효과적용
ApplyInvokeEffToIvkTarget( nullptr,
vIvkTarget,
pDat,
pEffect,
GetThisRecv(), // invoker
bCreateSfx,
level,
nullptr ); // pBuff
}
}
return xOK;
} // CastEffToCastTargetByDirect
开发者ID:xahgo,项目名称:tama,代码行数:50,代码来源:XSkillUser.cpp
示例7: team_axpby
static KOKKOS_INLINE_FUNCTION void team_axpby (const TeamType& team,
const typename XVector::non_const_value_type& a, const XVector& x,
const typename YVector::non_const_value_type& b, const YVector& y) {
const int N = x.extent(0);
Kokkos::parallel_for(Kokkos::TeamThreadRange(team,N), [&] (const int& i) {
y(i) = b*y(i) + a*x(i);
});
}
开发者ID:giorgiobornia,项目名称:trilinos,代码行数:8,代码来源:KokkosBlas1_team_axpby_spec.hpp
示例8: dot
/// \brief Return the dot product of x and y.
///
/// \param x [in] First vector.
/// \param y [in] Second vector.
/// \param label [in] This is passed into Kokkos::parallel_for, as a
/// label for profiling.
static dot_type
dot (const std::string& label, const XVector& x, const YVector& y)
{
dot_type result;
if (x.dimension_0 () < typename XVector::size_type (INT_MAX)) {
Kokkos::RangePolicy<typename XVector::execution_space, int> policy (0, x.dimension_0 ());
typedef DotFunctor<XVector, YVector, int> functor_type;
Kokkos::parallel_reduce (label, policy, functor_type (x, y), result);
}
else {
typedef typename XVector::size_type size_type;
Kokkos::RangePolicy<typename XVector::execution_space, size_type> policy (0, x.dimension_0 ());
typedef DotFunctor<XVector, YVector, size_type> functor_type;
Kokkos::parallel_reduce (label, policy, functor_type (x, y), result);
}
return result;
}
开发者ID:mhoemmen,项目名称:Trilinos,代码行数:23,代码来源:Kokkos_Blas1_impl.hpp
示例9: V_MulScalar
RVector V_MulScalar( const RVector & r, const typename KokkosArray::View<DataType,Layout,Device,MemoryManagement,Specialisation> & a, const XVector & x)
{
typedef typename KokkosArray::View<DataType,Layout,Device,MemoryManagement> aVector;
if(r==x) {
V_MulScalarFunctorSelf<aVector,XVector> op ;
op.m_x = x ;
op.m_a = a ;
KokkosArray::parallel_for( x.dimension(0) , op );
return r;
}
V_MulScalarFunctor<RVector,aVector,XVector> op ;
op.m_r = r ;
op.m_x = x ;
op.m_a = a ;
KokkosArray::parallel_for( x.dimension(0) , op );
return r;
}
开发者ID:,项目名称:,代码行数:18,代码来源:
示例10: GetResIdxByCheckSum
// int XMain::GetResIdxByCheckSum( XArrayLinear<XPatch::XRES_INFO> &ary, XUINT64 llCheckSum )
int XMain::GetResIdxByCheckSum( const XVector<XPatch::XRES_INFO> &ary, XUINT64 llCheckSum )
{
int max = ary.size();
for( int i = 0; i < max; ++i ) {
if( ary[ i ].llChecksum == llCheckSum )
return i;
}
return -1;
}
开发者ID:,项目名称:,代码行数:10,代码来源:
示例11: MV_MulScalar
RVector MV_MulScalar( const RVector & r, const typename XVector::scalar_type &a, const XVector & x)
{
if(r==x) {
MV_MulScalarFunctorSelf<typename XVector::scalar_type,XVector> op ;
op.m_x = x ;
op.m_a = a ;
op.n = x.dimension(1);
KokkosArray::parallel_for( x.dimension(0) , op );
return r;
}
MV_MulScalarFunctor<RVector,typename XVector::scalar_type,XVector> op ;
op.m_r = r ;
op.m_x = x ;
op.m_a = a ;
op.n = x.dimension(1);
KokkosArray::parallel_for( x.dimension(0) , op );
return r;
}
开发者ID:,项目名称:,代码行数:19,代码来源:
示例12: setAttribute
void XGeometry::setAttribute( const QString &n, const XVector<XVector4D> &v )
{
if( v.size() )
{
_attr4[n] = v;
if( _attr4[n].size() != _attributeSize )
{
_attributeSize = _attr4[n].size();
_attributeSizeChanged = true;
}
}
else
{
_attr1.remove(n);
}
_changedA4 << n;
_changedAttrs = true;
}
开发者ID:davidmueller13,项目名称:vexx,代码行数:18,代码来源:XGeometry.cpp
示例13: WriteFullList
// full_list.txt를 쓴다.
// int XMain::WriteFullList( XArrayLinear<XPatch::XRES_INFO>& aryAll )
int XMain::WriteFullList( const XVector<XPatch::XRES_INFO>& aryAll )
{
char cPath[ 1024 ];
strcpy_s( cPath, SZ2C( XE::_GetPathPackageRoot() ) );
strcat_s( cPath, "full_list.txt" );
FILE *fp = NULL;
fopen_s( &fp, cPath, "wt" );
if( fp == NULL )
return 0;
char cBuff[ 1024 ];
// XARRAYLINEAR_LOOP( aryAll, XPatch::XRES_INFO, info )
for( auto& info : aryAll ) {
strcpy_s( cBuff, SZ2C( info.strFile.c_str() ) );
strReplace( cBuff, '\\', '/' );
fprintf_s( fp, "\"%s\"\t%d\t%llu\n", cBuff, info.size, info.llChecksum );
}
fprintf_s( fp, "// num files %d \n", aryAll.size() );
fclose( fp );
return 1;
}
开发者ID:,项目名称:,代码行数:22,代码来源:
示例14: WriteCoreList
// core_list.txt를 쓴다.
//int XMain::WriteCoreList( XArrayLinear<_tstring>& aryCore )
int XMain::WriteCoreList( const XVector<_tstring>& aryCore )
{
char cPath[ 1024 ];
strcpy_s( cPath, SZ2C( XE::_GetPathPackageRoot() ) );
strcat_s( cPath, "core_list.txt" );
FILE *fp = NULL;
fopen_s( &fp, cPath, "wt" );
if( fp == NULL )
return 0;
char cBuff[ 1024 ];
// XARRAYLINEAR_LOOP( aryCore, _tstring, strRes )
for( auto& strRes : aryCore ) {
strcpy_s( cBuff, SZ2C( strRes.c_str() ) );
strReplace( cBuff, '\\', '/' );
fprintf_s( fp, "\"%s\"\n", cBuff );
// fprintf_s( fp, "\"%s\"\n", SZ2C( strRes.c_str() ) );
}
fprintf_s( fp, "// num files %d \n", aryCore.size() );
fclose( fp );
return 1;
}
开发者ID:,项目名称:,代码行数:23,代码来源:
示例15: MV_AddUnroll
RVector MV_AddUnroll( const RVector & r,const aVector &av,const XVector & x,
const bVector &bv, const YVector & y,
int a=2,int b=2)
{
switch (x.dimension(1)){
case 1: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 1>( r,av,x,bv,y,a,b);
break;
case 2: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 2>( r,av,x,bv,y,a,b);
break;
case 3: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 3>( r,av,x,bv,y,a,b);
break;
case 4: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 4>( r,av,x,bv,y,a,b);
break;
case 5: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 5>( r,av,x,bv,y,a,b);
break;
case 6: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 6>( r,av,x,bv,y,a,b);
break;
case 7: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 7>( r,av,x,bv,y,a,b);
break;
case 8: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 8>( r,av,x,bv,y,a,b);
break;
case 9: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 9>( r,av,x,bv,y,a,b);
break;
case 10: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 10>( r,av,x,bv,y,a,b);
break;
case 11: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 11>( r,av,x,bv,y,a,b);
break;
case 12: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 12>( r,av,x,bv,y,a,b);
break;
case 13: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 13>( r,av,x,bv,y,a,b);
break;
case 14: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 14>( r,av,x,bv,y,a,b);
break;
case 15: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 15>( r,av,x,bv,y,a,b);
break;
case 16: MV_AddUnroll<RVector, aVector, XVector, bVector, YVector, 16>( r,av,x,bv,y,a,b);
break;
}
return r;
}
开发者ID:,项目名称:,代码行数:40,代码来源:
示例16: spmv
void
spmv(const char mode[],
const AlphaType& alpha_in,
const AMatrix& A,
const XVector& x,
const BetaType& beta_in,
const YVector& y,
const RANK_TWO) {
typedef typename Impl::GetCoeffView<AlphaType, typename XVector::device_type>::view_type alpha_view_type;
typedef typename Impl::GetCoeffView<BetaType, typename XVector::device_type>::view_type beta_view_type;
//alpha_view_type alpha = Impl::GetCoeffView<AlphaType, typename XVector::device_type>::get_view(alpha_in,x.dimension_1());
//beta_view_type beta = Impl::GetCoeffView<AlphaType, typename XVector::device_type>::get_view(beta_in, x.dimension_1());
#ifdef KOKKOS_HAVE_CXX11
// Make sure that both x and y have the same rank.
static_assert (XVector::rank == YVector::rank, "KokkosBlas::spmv: Vector ranks do not match.");
// Make sure that y is non-const.
static_assert (Kokkos::Impl::is_same<typename YVector::value_type,
typename YVector::non_const_value_type>::value,
"KokkosBlas::spmv: Output Vector must be non-const.");
#else
// We prefer to use C++11 static_assert, because it doesn't give
// "unused typedef" warnings, like the constructs below do.
//
// Make sure that both x and y have the same rank.
typedef typename
Kokkos::Impl::StaticAssert<XVector::rank == YVector::rank>::type Blas1_spmv_vector_ranks_do_not_match;
#endif // KOKKOS_HAVE_CXX11
// Check compatibility of dimensions at run time.
if((mode[0]==NoTranspose[0])||(mode[0]==Conjugate[0])) {
if ((x.dimension_1 () != y.dimension_1 ()) ||
(static_cast<size_t> (A.numCols ()) > static_cast<size_t> (x.dimension_0 ())) ||
(static_cast<size_t> (A.numRows ()) > static_cast<size_t> (y.dimension_0 ()))) {
std::ostringstream os;
os << "KokkosBlas::spmv: Dimensions do not match: "
<< ", A: " << A.numRows () << " x " << A.numCols()
<< ", x: " << x.dimension_0 () << " x " << x.dimension_1 ()
<< ", y: " << y.dimension_0 () << " x " << y.dimension_1 ();
Kokkos::Impl::throw_runtime_exception (os.str ());
}
} else {
if ((x.dimension_1 () != y.dimension_1 ()) ||
(static_cast<size_t> (A.numCols ()) > static_cast<size_t> (y.dimension_0 ())) ||
(static_cast<size_t> (A.numRows ()) > static_cast<size_t> (x.dimension_0 ()))) {
std::ostringstream os;
os << "KokkosBlas::spmv: Dimensions do not match (transpose): "
<< ", A: " << A.numRows () << " x " << A.numCols()
<< ", x: " << x.dimension_0 () << " x " << x.dimension_1 ()
<< ", y: " << y.dimension_0 () << " x " << y.dimension_1 ();
Kokkos::Impl::throw_runtime_exception (os.str ());
}
}
typedef KokkosSparse::CrsMatrix<typename AMatrix::const_value_type,
typename AMatrix::const_ordinal_type,
typename AMatrix::device_type,
typename AMatrix::memory_traits,
typename AMatrix::const_size_type> AMatrix_Internal;
AMatrix_Internal A_i = A;
// Call single vector version if appropriate
if( x.dimension_1() == 1) {
typedef Kokkos::View<typename XVector::const_value_type*,
typename Kokkos::Impl::if_c<Kokkos::Impl::is_same<typename YVector::array_layout,Kokkos::LayoutLeft>::value,
Kokkos::LayoutLeft,Kokkos::LayoutStride>::type,
typename XVector::device_type,
Kokkos::MemoryTraits<Kokkos::Unmanaged|Kokkos::RandomAccess> > XVector_SubInternal;
typedef Kokkos::View<typename YVector::non_const_value_type*,
typename Kokkos::Impl::if_c<Kokkos::Impl::is_same<typename YVector::array_layout,Kokkos::LayoutLeft>::value,
Kokkos::LayoutLeft,Kokkos::LayoutStride>::type,
typename YVector::device_type,
Kokkos::MemoryTraits<Kokkos::Unmanaged> > YVector_SubInternal;
XVector_SubInternal x_i = Kokkos::subview(x,Kokkos::ALL(),0);
YVector_SubInternal y_i = Kokkos::subview(y,Kokkos::ALL(),0);
alpha_view_type alpha = Impl::GetCoeffView<AlphaType, typename XVector::device_type>::get_view(alpha_in,x.dimension_1());
beta_view_type beta = Impl::GetCoeffView<BetaType, typename XVector::device_type>::get_view(beta_in, x.dimension_1());
typename alpha_view_type::non_const_type::HostMirror h_alpha =
Kokkos::create_mirror_view(alpha);
Kokkos::deep_copy(h_alpha,alpha);
typename beta_view_type::non_const_type::HostMirror h_beta =
Kokkos::create_mirror_view(beta);
Kokkos::deep_copy(h_beta,beta);
spmv(mode,h_alpha(0),A,x_i,h_beta(0),y_i);
return;
} else {
typedef Kokkos::View<typename XVector::const_value_type**,
typename XVector::array_layout,
typename XVector::device_type,
Kokkos::MemoryTraits<Kokkos::Unmanaged|Kokkos::RandomAccess> > XVector_Internal;
typedef Kokkos::View<typename YVector::non_const_value_type**,
typename YVector::array_layout,
typename YVector::device_type,
//.........这里部分代码省略.........
开发者ID:jdbooth,项目名称:Trilinos,代码行数:101,代码来源:Kokkos_Sparse_MV.hpp
示例17: V_Dot
typename XVector::scalar_type V_Dot( const XVector & x, const YVector & y)
{
V_DotFunctor<XVector,YVector> f(x,y);
return parallel_reduce(x.dimension_0(),f);
}
开发者ID:,项目名称:,代码行数:5,代码来源:
示例18: _T
/**
full_list.txt를 만든다.
core_list.txt를 만든다.(apk50메가선을 유지하도록)
*/
void XMain::DoExtract( void )
{
// 일단 모든 리소스 파일의 목록을 뽑는다.
// XArrayLinear<XSYSTEM::XFILE_INFO> aryAll;
XVector<XSYSTEM::XFILE_INFO> aryAll;
// XSYSTEM::CreateFileList( XE::_GetPathPackageRoot(), _T("*.*"), &aryAll );
XSYSTEM::GetFileList( XE::_GetPathPackageRoot(), _T("*.*"), &aryAll, _T("") );
if( aryAll.Size() > 1500 ) {
}
// full_list.txt를 만든다.
{
// XArrayLinear<XPatch::XRES_INFO> ary;
// ary.Create( aryAll.size() );
XVector<XPatch::XRES_INFO> ary;
int cnt = 1;
// 파일별로 체크섬을 뽑아 둔다.
// XARRAYLINEAR_LOOP( aryAll, XSYSTEM::XFILE_INFO, info )
for( auto& info : aryAll ) {
XPatch::XRES_INFO resInfo;
resInfo.strFile = info.strFile;
resInfo.size = info.size;
resInfo.llChecksum = XE::CalcCheckSum( info.strFile.c_str() );
_tstring strFilename = XE::GetFileName( resInfo.strFile.c_str() );
int idxDuplicate = GetResIdxByCheckSum( ary, resInfo.llChecksum );
if( idxDuplicate != -1 ) {
XALERT( "duplicate checksum file: idx=%d,%d", idxDuplicate, cnt );
}
ary.Add( resInfo );
CONSOLE( "%d:%s.... %d byte ....checksum=0x%I64x",
cnt++,
strFilename.c_str(),
resInfo.size,
resInfo.llChecksum );
}
// full_list.txt를 생성한다.
WriteFullList( ary );
}
// core_list.txt를 뽑아낸다.
{
// XArrayLinear<_tstring> aryCore;
// aryCore.Create( aryAll.size() );
XVector<_tstring> aryCore;
int i = 0;
// XARRAYLINEAR_LOOP( aryAll, XSYSTEM::XFILE_INFO, info )
for( auto& info : aryAll ) {
// TCHAR szFlename[ 256 ];
// _tcscpy_s( szFlename, XE::GetFileName( info.strFile.c_str() ) );
const _tstring strFileName = XE::GetFileName( info.strFile );
// 테마에 속하지 않는 몬스터중에 mob_ 으로 시작하는 몬스터는
// 제작은 되었으나 아직 테마에 반영이 안된 몬스터이므로 제외시킨다.
BOOL bCore = TRUE;
// TCHAR szExt[ 16 ];
// _tcscpy_s( szExt, XE::GetFileExt( strFileName ) );
const _tstring strExt = XE::GetFileExt( strFileName );
// 다음 단어가 포함되어 있는 파일은 모두 제외
// if( _tcsstr( szFlename, _T( "treant" ) ) ||
// _tcsstr( szFlename, _T( "rock" ) ) )
// bCore = FALSE;
// 액셀 파일 제외
// if( XE::IsSame( szExt, _T("xlsx") ) )
if( strExt == _T("xlsx") )
bCore = FALSE;
// if( XE::IsSame( szFlename, _T("core_list.txt") ) ||
// XE::IsSame( szFlename, _T("full_list.txt") ) )
// bCore = FALSE;
if( strFileName == _T("core_list.txt")
|| strFileName == _T("full_list.txt") )
bCore = FALSE;
if( _tcsstr( strFileName.c_str(), _T("sample")) )
bCore = FALSE;
//
if( bCore )
{
aryCore.Add( info.strFile );
XTRACE( "%d: %s", i ++, info.strFile.c_str() );
} else
{
// 제외된 파일명
XTRACE( "-----------%s", info.strFile.c_str() );
}
}
// core_list.txt로 저장한다.
WriteCoreList( aryCore );
}
}
开发者ID:,项目名称:,代码行数:92,代码来源:
示例19: pCenter
/**
@brief pCenter(or vCenter)를 중심으로 radius범위내의 유닛들을 얻어 어레이에 담는다.
@return 얻어낸 타겟수
@param pCenter 중심타겟. null이면 vCenter를 사용한다.
@param vCenter 중심좌표. pCenter가 있다면 사용되지 않는다.
@param pixelRadius 픽셀단위 반지름.
@param bitSideFilter 검색해야할 진영
@param numCost 총 코스트값. 각 유닛은 크기 코스트가 있으며 타겟이 검색될때마다 numCost에서 차감한다. 0이되면 더이상 담지 않는다. 차감한 코스값이 마이너스가 될수는 없다.
0은 코스트에 관계없이 무조건 타겟1개만 검색. -1은 무효값.
@param bIncludeCenter 중심타겟(pCenter가 있을경우)을 대상에 포함할지 말지. pCenter가 없다면 이 옵션은 무시된다.
*/
int XEObjMngWithType::GetListUnitRadius2( XVector<XSPUnit> *pOutAry,
XEBaseWorldObj *pCenter,
const XE::VEC2& vCenter,
float pixelRadius,
BIT bitSideFilter,
int numCost,
bool bIncludeCenter,
BIT bitFlag ) const // 생존필터
{
if( numCost < 0 )
return 0;
//
XVector<XSPUnit> aryInNew; // pOutAry에 이미 타겟이 있는채로 들어왔을때 그것은 제한 리스트
XVector<XSPUnit> aryIn = *pOutAry; // 기존타겟에 반경검사타겟까지 포함.
int costSum = 0;
for( auto spUnit : m_listUnits ) {
if( spUnit->IsDestroy() )
continue;
XBREAK( spUnit == nullptr );
if( (spUnit->GetCamp() & bitSideFilter) == 0 )
continue;
if( (bitFlag & XSKILL::xTF_LIVE) == 0 && spUnit->IsLive() )
continue;
if( (bitFlag & XSKILL::xTF_DEAD) == 0 && spUnit->IsDead() )
continue;
// 시전대상을 포함하지 않는 조건일때 유닛이 시전대상이면 스킵
if( pCenter
&& pCenter->GetsnObj() == spUnit->GetsnObj() // spUnit이 중심타겟일때
&& bIncludeCenter == false ) // 중심타겟안포함 옵션이면 스킵한다.
continue;
if( bitFlag & XSKILL::xTF_DIFF_SQUAD ) {
// spUnit이 이미 찾은 유닛과 같은 부대면 스킵
bool bExisted = false;
for( auto& spFinded : aryIn ) {
if( spUnit->GetpSquadObj()->GetsnSquadObj() == spFinded->GetpSquadObj()->GetsnSquadObj() ) {
bExisted = true;
break;
}
}
if( bExisted )
continue;
}
const XE::VEC2 vDist = spUnit->GetvwPos().ToVec2() - vCenter;
const float distsq = vDist.Lengthsq();
// 코스트와 관계없이 일단 범위안에 들어가는 타겟은 모두 담은후 거기서 다시 코스트에 따라 랜덤으로 꺼낸다.
if( distsq <= pixelRadius * pixelRadius ) {
aryIn.Add( spUnit );
aryInNew.Add( spUnit );
costSum += spUnit->GetSizeCost(); // 배열에 들어간 유닛들의 토탈코스트
} // in radius
} // for
// 목표코스트를 다 채우지 못했거나 딱맞게 채웠을때는 전체 리스트에서 랜덤으로 뽑을필요가 없으므로 그냥 검색된 리스트를 모두 리턴한다.
if( costSum <= numCost ) {
*pOutAry = aryIn;
return pOutAry->Size();
}
int currCost = numCost;
// XVector<XSPUnit> ary = *pOutAry;
// pOutAry->Clear();
// 영역안에 들어온 타겟들을 대상으로 다시 코스트에 따라 실제 타겟을 선정한다.
while( aryInNew.Size() > 0 ) {
auto spUnit = aryInNew.PopFromRandom();
if( numCost == 0 ) {
if( pOutAry->Size() == 0 )
pOutAry->Add( spUnit );
return 1;
} else {
const auto costUnit = spUnit->GetSizeCost();
if( costUnit <= currCost ) {
// 유닛 코스트가 남은 코스트를 깔수 있을때만.
currCost -= costUnit;
XBREAK( currCost < 0 );
pOutAry->Add( spUnit );
if( currCost == 0 ) // 코스트를 다 채웠으면 리턴.
return pOutAry->Size();
}
}
}
return pOutAry->size();
}
开发者ID:xahgo,项目名称:tama,代码行数:91,代码来源:XEObjMngWithType.cpp
示例20: spmv
void
spmv(const char mode[],
const AlphaType& alpha,
const AMatrix& A,
const XVector& x,
const BetaType& beta,
const YVector& y,
const RANK_ONE)
{
#ifdef KOKKOS_HAVE_CXX11
// Make sure that both x and y have the same rank.
static_assert ((int) XVector::rank == (int) YVector::rank,
"KokkosBlas::spmv: Vector ranks do not match.");
// Make sure that x (and therefore y) is rank 1.
static_assert ((int) XVector::rank == 1, "KokkosBlas::spmv: "
"Both Vector inputs must have rank 1 or 2.");
// Make sure that y is non-const.
static_assert (Kokkos::Impl::is_same<typename YVector::value_type,
typename YVector::non_const_value_type>::value,
"KokkosBlas::spmv: Output Vector must be non-const.");
#else
// We prefer to use C++11 static_assert, because it doesn't give
// "unused typedef" warnings, like the constructs below do.
//
// Make sure that both x and y have the same rank.
typedef typename
Kokkos::Impl::StaticAssert<(int) XVector::rank == (int) YVector::rank>::type
Blas1_spmv_vector_ranks_do_not_match;
// Make sure that x (and therefore y) is rank 1.
typedef typename
Kokkos::Impl::StaticAssert<(int) XVector::rank == 1 >::type
Blas1_spmv_vector_rank_not_one;
#endif // KOKKOS_HAVE_CXX11
// Check compatibility of dimensions at run time.
if((mode[0]==NoTranspose[0])||(mode[0]==Conjugate[0])) {
if ((x.dimension_1 () != y.dimension_1 ()) ||
(static_cast<size_t> (A.numCols ()) > static_cast<size_t> (x.dimension_0 ())) ||
(static_cast<size_t> (A.numRows ()) > static_cast<size_t> (y.dimension_0 ()))) {
std::ostringstream os;
os << "KokkosBlas::spmv: Dimensions do not match: "
<< ", A: " << A.numRows () << " x " << A.numCols()
<< ", x: " << x.dimension_0 () << " x " << x.dimension_1()
<< ", y: " << y.dimension_0 () << " x " << y.dimension_1()
;
Kokkos::Impl::throw_runtime_exception (os.str ());
}
} else {
if ((x.dimension_1 () != y.dimension_1 ()) ||
(static_cast<size_t> (A.numCols ()) > static_cast<size_t> (y.dimension_0 ())) ||
(static_cast<size_t> (A.numRows ()) > static_cast<size_t> (x.dimension_0()))) {
std::ostringstream os;
os << "KokkosBlas::spmv: Dimensions do not match (transpose): "
<< ", A: " << A.numRows () << " x " << A.numCols()
<< ", x: " << x.dimension_0 () << " x " << x.dimension_1()
<< ", y: " << y.dimension_0 () << " x " << y.dimension_1()
;
Kokkos::Impl::throw_runtime_exception (os.str ());
}
}
typedef KokkosSparse::CrsMatrix<typename AMatrix::const_value_type,
typename AMatrix::non_const_ordinal_type,
typename AMatrix::device_type,
Kokkos::MemoryTraits<Kokkos::Unmanaged>,
typename AMatrix::const_size_type> AMatrix_Internal;
typedef Kokkos::View<typename XVector::const_value_type*,
typename XVector::array_layout,
typename XVector::device_type,
Kokkos::MemoryTraits<Kokkos::Unmanaged|Kokkos::RandomAccess> > XVector_Internal;
typedef Kokkos::View<typename YVector::non_const_value_type*,
typename YVector::array_layout,
typename YVector::device_type,
Kokkos::MemoryTraits<Kokkos::Unmanaged> > YVector_Internal;
AMatrix_Internal A_i = A;
XVector_Internal x_i = x;
YVector_Internal y_i = y;
return Impl::SPMV<typename AMatrix_Internal::value_type,
typename AMatrix_Internal::ordinal_type,
typename AMatrix_Internal::device_type,
typename AMatrix_Internal::memory_traits,
typename AMatrix_Internal::size_type,
typename XVector_Internal::value_type*,
typename XVector_Internal::array_layout,
typename XVector_Internal::device_type,
typename XVector_Internal::memory_traits,
typename YVector_Internal::value_type*,
typename YVector_Internal::array_layout,
typename YVector_Internal::device_type,
typename YVector_Internal::memory_traits>::spmv(mode,alpha,A,x,beta,y);
}
开发者ID:agrippa,项目名称:Trilinos,代码行数:96,代码来源:Kokkos_Sparse.hpp
注:本文中的XVector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论