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


C++ ARRAY类代码示例

本文整理汇总了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;
}
开发者ID:uwgraphics,项目名称:Phoenix_Rendering,代码行数:31,代码来源:main.cpp

示例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;
}
开发者ID:wilsonr990,项目名称:Ditto-clipboard-manager,代码行数:34,代码来源:HotKeys.cpp

示例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);
}
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:7,代码来源:vector.cpp

示例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); 


}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:34,代码来源:hatching_group_fixed.C

示例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;
}
开发者ID:CyberShadow,项目名称:Ditto,代码行数:27,代码来源:Misc.cpp

示例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));
}
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:7,代码来源:vector.cpp

示例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;
}
开发者ID:erdincay,项目名称:ditto-clipboard,代码行数:26,代码来源:QListCtrl.cpp

示例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);
 }
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:7,代码来源:flags.cpp

示例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);
}
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:8,代码来源:vector.cpp

示例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]);
}
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:8,代码来源:spline.hpp

示例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]);
}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:8,代码来源:uv_data.C

示例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));
}
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:8,代码来源:surface.cpp

示例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]);
}
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:8,代码来源:array.hpp

示例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];
 }
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:9,代码来源:array.hpp

示例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;
                }
            }
        }
    }
}
开发者ID:hjwdzh,项目名称:level-set,代码行数:57,代码来源:Solver.cpp


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