本文整理汇总了C++中ARRAY::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ ARRAY::Append方法的具体用法?C++ ARRAY::Append怎么用?C++ ARRAY::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARRAY
的用法示例。
在下文中一共展示了ARRAY::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: e
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: 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]);
}
示例3:
//#####################################################################
// Function Cubic_MN_Weights
//#####################################################################
template<class T,class T2> ARRAY<T> CUBIC_MN_INTERPOLATION<T,T2>::
Cubic_MN_Weights(const T alpha) const
{
T alpha2=alpha*alpha;
T alpha3=alpha2*alpha;
ARRAY<T> weights;
weights.Append(-alpha3/2.+alpha2-.5*alpha); //f_k-1
weights.Append(alpha3/2.-5*alpha2/2.+1); //f_k
weights.Append(-alpha3/2.+2*alpha2+alpha/2.); //f_k+1
weights.Append(alpha3/2.-alpha2/2.); //f_k+2
for(int i=1;i<=weights.m;i++) weights(i)=max((T)0.,min((T)1.,weights(i)));
return weights;
}
示例4: GenericSample
// Template method that works for BaseArray, BlockArray, PointerArray or BaseList
template <class ARRAY, typename T> void GenericSample(ARRAY& test, const T& aValue, const T& bValue)
{
const Int ARRAY_TEST_SIZE = 1024;
Int i;
// append ARRAY_TEST_SIZE elements (all initialized by the default constructor)
for (i = 0; i < ARRAY_TEST_SIZE; i++)
test.Append();
// use an AutoIterator to iterate over the whole array and assign aValue to every element
for (AutoIterator<ARRAY> it(test); it; ++it)
*it = aValue;
// insert an element with bValue at index 10
test.Insert(10, bValue);
// erase the element at index 11
test.Erase(11);
// just a quick check: we should still have the same number of elements
if (test.GetCount() != ARRAY_TEST_SIZE)
GeBoom();
// using an Iterator: assign bValue to all elements from test[25] to test[49]
typename ARRAY::Iterator end = test.Begin() + 50;
for (typename ARRAY::Iterator it = test.Begin() + 25; it != end; it++)
*it = bValue;
}
示例5: RegisterUserFormats
void RegisterUserFormats (ARRAY<const char*> & names)
{
char *types[] =
{
"Neutral Format",
"Surface Mesh Format" ,
"DIFFPACK Format",
"TecPlot Format",
"Tochnog Format",
"Abaqus Format",
"Fluent Format",
"Permas Format",
"FEAP Format",
"Elmer Format",
"STL Format",
"VRML Format",
"Gmsh Format",
"JCMwave Format",
"TET Format",
// { "Chemnitz Format" },
0
};
for (int i = 0; types[i]; i++)
names.Append (types[i]);
}
示例6: Add
void Add (int ind)
{
if (!flags.Test(ind))
{
set.Append (ind);
flags.Set (ind);
}
}
示例7: 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));
}
示例8: 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]);
}
示例9: LineIntersections
void SplineSeg3<D> :: LineIntersections (const double a, const double b, const double c,
ARRAY < Point<D> > & points, const double eps) const
{
points.SetSize(0);
double t;
const double c1 = a*p1(0) - sqrt(2.)*a*p2(0) + a*p3(0)
+ b*p1(1) - sqrt(2.)*b*p2(1) + b*p3(1)
+ (2.-sqrt(2.))*c;
const double c2 = -2.*a*p1(0) + sqrt(2.)*a*p2(0) -2.*b*p1(1) + sqrt(2.)*b*p2(1) + (sqrt(2.)-2.)*c;
const double c3 = a*p1(0) + b*p1(1) + c;
if(fabs(c1) < 1e-20)
{
if(fabs(c2) < 1e-20)
return;
t = -c3/c2;
if((t > -eps) && (t < 1.+eps))
points.Append(GetPoint(t));
return;
}
const double discr = c2*c2-4.*c1*c3;
if(discr < 0)
return;
if(fabs(discr/(c1*c1)) < 1e-14)
{
t = -0.5*c2/c1;
if((t > -eps) && (t < 1.+eps))
points.Append(GetPoint(t));
return;
}
t = (-c2 + sqrt(discr))/(2.*c1);
if((t > -eps) && (t < 1.+eps))
points.Append(GetPoint(t));
t = (-c2 - sqrt(discr))/(2.*c1);
if((t > -eps) && (t < 1.+eps))
points.Append(GetPoint(t));
}
示例10:
//#####################################################################
// Function Compute_Level_Set_Helper
//#####################################################################
template<class T> void LEVELSET_MAKER_UNIFORM_2D<T>::
Compute_Level_Set_Helper(const TV_INT& index,T next,ARRAY<TV_INT>& next_todo,ARRAY<T,TV_INT>& phi)
{
if(!phi.Valid_Index(index)) return;
T& p=phi(index);
if(p!=FLT_MAX) return;
p=next;
next_todo.Append(index);
}
示例11: assert
//#####################################################################
// Function Simplices_On_Subsimplex
//#####################################################################
template<int d> template<int d2> void SIMPLEX_MESH<d>::
Simplices_On_Subsimplex(const VECTOR<int,d2>& subsimplex_nodes,ARRAY<int>& simplices_on_subsimplex) const
{
assert(incident_elements);
const ARRAY<int>& incident=(*incident_elements)(subsimplex_nodes[1]);
VECTOR<int,d2-1> other_nodes=subsimplex_nodes.Remove_Index(1);
for(int i=1;i<=incident.m;i++){
int simplex=incident(i);
if(Nodes_In_Simplex(other_nodes,simplex)) simplices_on_subsimplex.Append(simplex);}
}
示例12:
//#####################################################################
// Function Get_Simplex_Bounding_Boxes
//#####################################################################
template<class T> void RIGID_COLLISION_GEOMETRY<VECTOR<T,3> >::
Get_Simplex_Bounding_Boxes(ARRAY<RANGE<TV> >& bounding_boxes,const bool with_body_motion,const T extra_thickness,const T body_thickness_factor) const
{
if(!rigid_geometry.simplicial_object->triangle_list) rigid_geometry.simplicial_object->Update_Triangle_List();
for(int t=1;t<=rigid_geometry.simplicial_object->mesh.elements.m;t++){
RANGE<TV> box=rigid_geometry.World_Space_Simplex_Bounding_Box(t);
if(with_body_motion) box.Enlarge_To_Include_Box(rigid_geometry.World_Space_Simplex_Bounding_Box(t,saved_states(1).x));
box.Change_Size(extra_thickness+body_thickness_factor*collision_thickness);
bounding_boxes.Append(box);}
}
示例13: sstream
//#####################################################################
// Function Command_Prompt_Response
//#####################################################################
template<class T,class RW> void OPENGL_COMPONENT_DEBUG_PARTICLES_2D<T,RW>::
Command_Prompt_Response()
{
if(!OPENGL_WORLD::Singleton()->prompt_response.empty()){
std::string command;
std::istringstream sstream(OPENGL_WORLD::Singleton()->prompt_response);
sstream>>command;
if(command=="s"){
ARRAY<int> indices;
int index;
while(sstream>>index) indices.Append(index);
opengl_particles.Clear_Selection();
opengl_particles.Select_Points(indices);}}
示例14: if
//#####################################################################
// Function Get_All_Face_Neighbors
//#####################################################################
template<class T> void QUADTREE_CELL<T>::
Get_All_Face_Neighbors(int face_index,ARRAY<QUADTREE_CELL<T>*>& face_neighbors,const QUADTREE_GRID<T>* grid) const
{
int face_index_to_offset[][2]={{-1,0},{1,0},{0,-1},{0,1}}; // convertes from face index to x and y offsets for use in neighbor search
QUADTREE_CELL<T>* neighbor=Get_Neighbor(face_index_to_offset[face_index][0],face_index_to_offset[face_index][1],grid,0,false);
if(!neighbor) return;
if(neighbor->Has_Children()){
GET_ALL_FACE_NEIGHBORS_HELPER<T> helper;helper.face_neighbors=&face_neighbors;
if(face_index==0){helper.cell_to_add=0;MAP_QUADTREE_MESH<T>::Map_Face_Process_Face(&helper,neighbor,this,X_AXIS,Get_All_Face_Neighbors_Helper);}
else if(face_index==1){helper.cell_to_add=1;MAP_QUADTREE_MESH<T>::Map_Face_Process_Face(&helper,this,neighbor,X_AXIS,Get_All_Face_Neighbors_Helper);}
else if(face_index==2){helper.cell_to_add=0;MAP_QUADTREE_MESH<T>::Map_Face_Process_Face(&helper,neighbor,this,Y_AXIS,Get_All_Face_Neighbors_Helper);}
else{assert(face_index==3);helper.cell_to_add=1;
MAP_QUADTREE_MESH<T>::Map_Face_Process_Face(&helper,this,neighbor,Y_AXIS,Get_All_Face_Neighbors_Helper);}}
else face_neighbors.Append(neighbor);
}
示例15: GetPrimitiveData
void Polyhedra :: GetPrimitiveData (const char *& classname,
ARRAY<double> & coeffs) const
{
classname = "Polyhedra";
coeffs.SetSize(0);
coeffs.Append (points.Size());
coeffs.Append (faces.Size());
coeffs.Append (planes.Size());
/*
int i, j;
for (i = 1; i <= planes.Size(); i++)
{
planes.Elem(i)->Print (*testout);
}
for (i = 1; i <= faces.Size(); i++)
{
(*testout) << "face " << i << " has plane " << faces.Get(i).planenr << endl;
for (j = 1; j <= 3; j++)
(*testout) << points.Get(faces.Get(i).pnums[j-1]);
(*testout) << endl;
}
*/
}