本文整理汇总了C++中ARRAY类的典型用法代码示例。如果您正苦于以下问题:C++ ARRAY类的具体用法?C++ ARRAY怎么用?C++ ARRAY使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ARRAY类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Convert_To_Tetrahedralized_Volume
template<class T> void Convert_To_Tetrahedralized_Volume( tetgenio& out,
TETRAHEDRALIZED_VOLUME<T>& volume )
{
ARRAY<VECTOR<T,3> > X;
for( int i=0; i < out.numberofpoints; i++){
VECTOR<T,3> p;
p.x = out.pointlist[ i*out.mesh_dim + 0 ];
p.y = out.pointlist[ i*out.mesh_dim + 1 ];
p.z = out.pointlist[ i*out.mesh_dim + 2 ];
X.Append(p);
//LOG::cout << "V" << i+1 << " : " << p << std::endl;
}
ARRAY<VECTOR<int,4> > elements;
for( int i=0; i < out.numberoftetrahedra; i++){
VECTOR<int,4> e;
e(1) = out.tetrahedronlist[ i*out.numberofcorners + 0 ];
e(2) = out.tetrahedronlist[ i*out.numberofcorners + 1 ];
e(3) = out.tetrahedronlist[ i*out.numberofcorners + 2 ];
e(4) = out.tetrahedronlist[ i*out.numberofcorners + 3 ];
elements.Append(e);
//LOG::cout << "T" << i+1 << " : " << e << std::endl;
}
int m = X.m;
int n = elements.m;
volume.mesh.Initialize_Mesh(m,elements);
volume.particles.array_collection->Resize(m);
volume.particles.X=X;
}
示例2: FindFirstConflict
bool CHotKeys::FindFirstConflict(ARRAY& keys, INT_PTR* pX, INT_PTR* pY)
{
bool bConflict = false;
INT_PTR i, j;
INT_PTR count = keys.GetSize();
DWORD key;
for(i = 0; i < count && !bConflict; i++)
{
key = keys.ElementAt(i);
// only check valid keys
if(key == 0)
continue;
// scan the array for a duplicate
for(j = i+1; j < count; j++ )
{
if(keys.ElementAt(j) == key)
{
bConflict = true;
break;
}
}
}
if(bConflict)
{
if(pX)
*pX = i-1;
if(pY)
*pY = j;
}
return bConflict;
}
示例3: SetElementVector
void BaseVector :: SetElementVector (const ARRAY<INDEX> & pnum,
const BaseVector & elvec)
{
int i;
for (i = 1; i <= pnum.Size(); i++)
(*this)(pnum.Get(i)) = elvec(i);
}
示例4: err_mesg
/////////////////////////////////////
// get_visibility()
/////////////////////////////////////
void
HatchingGroupFixed::get_visibility(TAGformat &d)
{
err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::get_visibility()");
BMESH *m = _patch->mesh();
if (LMESH::isa(m))
m = ((LMESH*)m)->cur_mesh();
int k, ctr=0;
ARRAY<int> indices;
CBface_list& faces = m->faces();
*d >> indices;
for (k=0; k<indices.num(); k++)
{
HatchingSimplexDataFixed *hsdf =
HatchingSimplexDataFixed::find(faces[indices[k]]);
if (!hsdf)
{
hsdf = new HatchingSimplexDataFixed(faces[indices[k]]);
ctr++;
}
hsdf->add(this);
}
err_mesg(ERR_LEV_SPAM, "HatchingGroupFixed::get_visibility() - Flagged %d tris and added %d new simplex data.", indices.num(), ctr);
}
示例5: DeleteFormats
BOOL DeleteFormats(int parentID, ARRAY& formatIDs)
{
if(formatIDs.GetSize() <= 0)
return TRUE;
try
{
//Delete the requested data formats
INT_PTR count = formatIDs.GetSize();
for(int i = 0; i < count; i++)
{
theApp.m_db.execDMLEx(_T("DELETE FROM Data WHERE lID = %d;"), formatIDs[i]);
}
CClip clip;
if(clip.LoadFormats(parentID))
{
DWORD CRC = clip.GenerateCRC();
//Update the main table with new size
theApp.m_db.execDMLEx(_T("UPDATE Main SET CRC = %d WHERE lID = %d"), CRC, parentID);
}
}
CATCH_SQLITE_EXCEPTION
return TRUE;
}
示例6: GetElementVector
void BaseVector :: GetElementVector (const ARRAY<INDEX> & pnum,
BaseVector & elvec) const
{
int i;
for (i = 1; i <= pnum.Size(); i++)
elvec(i) = (*this)(pnum.Get(i));
}
示例7: LoadCopyOrCutToClipboard
void CQListCtrl::LoadCopyOrCutToClipboard()
{
ARRAY arr;
GetSelectionItemData(arr);
INT_PTR count = arr.GetSize();
if(count <= 0)
return;
CProcessPaste paste;
//Don't send the paste just load it into memory
paste.m_bSendPaste = false;
if(count > 1)
paste.GetClipIDs().Copy(arr);
else
paste.GetClipIDs().Add(arr[0]);
//Don't move these to the top
BOOL bItWas = g_Opt.m_bUpdateTimeOnPaste;
g_Opt.m_bUpdateTimeOnPaste = FALSE;
paste.DoPaste();
g_Opt.m_bUpdateTimeOnPaste = bItWas;
}
示例8: SetFlag
void Flags :: SetFlag (const char * name, const ARRAY<double> & val)
{
ARRAY<double> * numarray = new ARRAY<double>;
for (int i = 1; i <= val.Size(); i++)
numarray->Append (val.Get(i));
numlistflags.Set (name, numarray);
}
示例9: AddElementVector
void Vector :: AddElementVector (const ARRAY<INDEX> & pnum,
const BaseVector & elvec)
{
int i;
const Vector & helvec = elvec.CastToVector();
for (i = 1; i <= pnum.Size(); i++)
Elem(pnum.Get(i)) += helvec.Get(i);
}
示例10: GetRawData
void LineSeg<D> :: GetRawData (ARRAY<double> & data) const
{
data.Append(2);
for(int i=0; i<D; i++)
data.Append(p1[i]);
for(int i=0; i<D; i++)
data.Append(p2[i]);
}
示例11:
void
UVdata::split(CEdgeStrip& strip)
{
ARRAY<Bvert_list> chains;
strip.get_chains(chains);
for (int i=0; i<chains.num(); i++)
split_chain(chains[i]);
}
示例12: GetTangentialSurfaceIndices
void Primitive :: GetTangentialSurfaceIndices (const Point<3> & p,
ARRAY<int> & surfind, double eps) const
{
for (int j = 0; j < GetNSurfaces(); j++)
if (fabs (GetSurface(j).CalcFunctionValue (p)) < eps)
if (!surfind.Contains (GetSurfaceId(j)))
surfind.Append (GetSurfaceId(j));
}
示例13: Intersection
void Intersection (const FlatArray<T> & in1, const FlatArray<T> & in2, const FlatArray<T> & in3,
ARRAY<T> & out)
{
out.SetSize(0);
for(int i=0; i<in1.Size(); i++)
if(in2.Contains(in1[i]) && in3.Contains(in1[i]))
out.Append(in1[i]);
}
示例14: ARRAY
/// array copy
explicit ARRAY (const ARRAY<T> & a2)
: FlatArray<T, BASE> (a2.Size(), a2.Size() ? new T[a2.Size()] : 0)
{
allocsize = this->size;
ownmem = 1;
for (int i = BASE; i < this->size+BASE; i++)
(*this)[i] = a2[i];
}
示例15: delta_f
void Solver::QPSolve(ARRAY<2, double>& a, ARRAY<1, double>& b, ARRAY<1, double>& f) {
int n = f.dim(1);
f.Fill(0);
ARRAY<1, double> c = b;
ARRAY<1, double> delta_f(n), delta_a(n);
set<int> C, NC;
set<int> ad_minus;
for (int i = 1; i <= n; ++i) {
if (c(i) < -1e-4) {
ad_minus.insert(i);
}
}
while (!ad_minus.empty()) {
set<int>::iterator it = ad_minus.begin();
int d = *it;
NC.erase(d);
while (true) {
fdirection(d, a, C, delta_f, delta_a);
pair<double, int> sj = maxstep(f,c,delta_f,delta_a,C,NC,d);
if (sj.first > 1e20) {
return;
}
for (set<int>::iterator it = C.begin(); it != C.end(); ++it)
if (*it != d)
f(*it) += sj.first * delta_f(*it);
f(d) += sj.first * delta_f(d);
for (int i = 1; i <= n; ++i) {
c(i) += delta_a(i) * sj.first;
if (c(i) < -1e-4) {
ad_minus.insert(i);
} else {
if (i == d) {
sj.second = d;
NC.erase(d);
}
ad_minus.erase(i);
}
}
it = C.find(sj.second);
if (it != C.end()) {
NC.insert(*it);
C.erase(it);
} else {
it = NC.find(sj.second);
if (it != NC.end()) {
C.insert(*it);
NC.erase(it);
} else {
C.insert(d);
ad_minus.erase(d);
break;
}
}
}
}
}