本文整理汇总了C++中Array::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::Get方法的具体用法?C++ Array::Get怎么用?C++ Array::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcPositionCosts
int CalcPositionCosts (const INDEX & ind) const
{
int i = HashValue(ind);
int costs = 1;
for (;;)
{
if (hash.Get(i) == ind) return costs;
if (hash.Get(i) == invalid) return costs;
i++;
if (i > hash.Size()) i = 1;
costs++;
}
}
示例2: ToPlain
void referencetransform :: ToPlain (const Array<Point3d> & p,
Array<Point3d> & pp) const
{
Vec3d v;
int i;
pp.SetSize (p.Size());
for (i = 1; i <= p.Size(); i++)
{
v = p.Get(i) - rp;
pp.Elem(i).X() = (ex_h * v);
pp.Elem(i).Y() = (ey_h * v);
pp.Elem(i).Z() = (ez_h * v);
}
}
示例3: DBOperationHelper_NonVO
void DBOperationHelper_NonVO(Handle<Object> spec, KeyOperation & op) {
HandleScope scope;
Local<Value> v;
Local<Object> o;
setKeysInOp(spec, op);
v = spec->Get(HELPER_ROW_BUFFER);
if(! v->IsNull()) {
o = v->ToObject();
op.row_buffer = V8BINDER_UNWRAP_BUFFER(o);
}
v = spec->Get(HELPER_ROW_RECORD);
if(! v->IsNull()) {
o = v->ToObject();
const Record * record = unwrapPointer<const Record *>(o);
op.row_record = record;
v = spec->Get(HELPER_BLOBS);
if(v->IsObject()) {
if(op.opcode == 1) {
op.nblobs = op.createBlobReadHandles(record);
} else {
op.nblobs = op.createBlobWriteHandles(v->ToObject(), record);
}
}
}
v = spec->Get(HELPER_LOCK_MODE);
if(! v->IsNull()) {
int intLockMode = v->Int32Value();
op.lmode = static_cast<NdbOperation::LockMode>(intLockMode);
}
v = spec->Get(HELPER_COLUMN_MASK);
if(! v->IsNull()) {
Array *maskArray = Array::Cast(*v);
for(unsigned int m = 0 ; m < maskArray->Length() ; m++) {
Local<Value> colId = maskArray->Get(m);
op.useColumn(colId->Int32Value());
}
}
DEBUG_PRINT("Non-VO %s -- mask: %u lobs: %d", op.getOperationName(),
op.u.maskvalue, op.nblobs);
}
示例4: setKeysInOp
Handle<Value> DBOperationHelper_NonVO(const Arguments &args) {
HandleScope scope;
Operation op;
const Local<Object> spec = args[0]->ToObject();
Local<Value> v;
Local<Object> o;
setKeysInOp(spec, op);
v = spec->Get(HELPER_ROW_BUFFER);
if(! v->IsNull()) {
o = v->ToObject();
op.row_buffer = V8BINDER_UNWRAP_BUFFER(o);
}
v = spec->Get(HELPER_ROW_RECORD);
if(! v->IsNull()) {
o = v->ToObject();
op.row_record = unwrapPointer<const Record *>(o);
}
v = spec->Get(HELPER_LOCK_MODE);
if(! v->IsNull()) {
int intLockMode = v->Int32Value();
op.lmode = static_cast<NdbOperation::LockMode>(intLockMode);
}
v = spec->Get(HELPER_COLUMN_MASK);
if(! v->IsNull()) {
Array *maskArray = Array::Cast(*v);
for(unsigned int m = 0 ; m < maskArray->Length() ; m++) {
Local<Value> colId = maskArray->Get(m);
op.useColumn(colId->Int32Value());
}
}
int opcode = args[1]->Int32Value();
NdbTransaction *tx = unwrapPointer<NdbTransaction *>(args[2]->ToObject());
DEBUG_PRINT("Non-VO opcode: %d mask: %u", opcode, op.u.maskvalue);
return scope.Close(buildNdbOperation(op, opcode, tx));
}
示例5: Ng_GetPrimitiveData
int Ng_GetPrimitiveData (ClientData clientData,
Tcl_Interp * interp,
int argc, tcl_const char *argv[])
{
CSGeometry * geometry = dynamic_cast<CSGeometry*> (ng_geometry.get());
if (!geometry)
{
Tcl_SetResult (interp, err_needscsgeometry, TCL_STATIC);
return TCL_ERROR;
}
tcl_const char * name = argv[1];
tcl_const char * classnamevar = argv[2];
tcl_const char * valuevar = argv[3];
const char * classname;
Array<double> coeffs;
geometry->GetSolid (name)->GetPrimitive()->GetPrimitiveData (classname, coeffs);
ostringstream vst;
for (int i = 1; i <= coeffs.Size(); i++)
vst << coeffs.Get(i) << " ";
cout << "GetPrimitiveData, name = " << name
<< ", classnamevar = " << classnamevar
<< ", classname = " << classname << endl
<< " valuevar = " << valuevar
<< ", values = " << vst.str() << endl;
Tcl_SetVar (interp, classnamevar, (char*)classname, 0);
Tcl_SetVar (interp, valuevar, (char*)vst.str().c_str(), 0);
return TCL_OK;
}
示例6: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
cout << "7 LABOR WORK" << endl;
Array<int> Ar1;
Array<int> Ar2;
Ar1.Set(1);
Ar1.Set(2);
Ar1.Set(3);
Ar2.Set(4);
Ar2.Set(5);
Ar2.Set(6);
cout << endl << "Size Ar1= " << Ar1.getSize() << endl;
cout << "Size Ar2= " << Ar2.getSize() << endl;
cout << "Get Ar1: ";
Ar1.Get();
cout << "Get Ar2: ";
Ar2.Get();
Array<double> Ar3;
Array<double> Ar4;
Ar3.Set(1.1);
Ar3.Set(2.2);
Ar3.Set(3.3);
Ar4.Set(4.4);
Ar4.Set(5.5);
Ar4.Set(6.6);
cout << "Size Ar3= " << Ar3.getSize() << endl;
cout << "Size Ar4= " << Ar4.getSize() << endl;
cout << "Get Ar3: ";
Ar3.Get();
cout << "Get Ar4: ";
Ar4.Get();
Array<Person> Ar5;
Ar5.Set(Person("Ivan", 4));
Ar5.Set(Person("Petr", 5));
cout << "Size Ar5= " << Ar5.getSize() << endl;
cout << "Get Ar5: ";
Ar5.Get();
cout << endl;
cout << "8 LABOR WORK" << endl;
Array<int> oldArr;
int k = 6;
for (int i = 0; i < 5; i++)
{
oldArr.Set(k);
k--;
}
oldArr.Get();
sortik(oldArr);
oldArr.Get();
cout << endl;
Array<double> oldArr1;
double d = 6.6;
for (int i = 0; i < 5; i++)
{
oldArr1.Set(d);
d = d - 1.1;
}
oldArr1.Get();
sortik(oldArr1);
oldArr1.Get();
cout << endl;
Array<Person>oldArr2;
oldArr2.Set(Person("Sidor", 10));
oldArr2.Set(Person("Viktor", 8));
oldArr2.Set(Person("Nikolay", 7));
oldArr2.Get();
sortik(oldArr2);
oldArr2.Get();
return 0;
}
示例7: GetIntersecting
void ADTree3Div :: GetIntersecting (const float * bmin,
const float * bmax,
Array<int> & pis) const
{
static Array<ADTreeNode3Div*> stack(1000);
static Array<int> stackdir(1000);
ADTreeNode3Div * node;
int dir, i, stacks;
stack.SetSize (1000);
stackdir.SetSize(1000);
pis.SetSize(0);
stack.Elem(1) = root;
stackdir.Elem(1) = 0;
stacks = 1;
while (stacks)
{
node = stack.Get(stacks);
dir = stackdir.Get(stacks);
stacks--;
if (node->pi)
{
if (node->data[0] >= bmin[0] && node->data[0] <= bmax[0] &&
node->data[1] >= bmin[1] && node->data[1] <= bmax[1] &&
node->data[2] >= bmin[2] && node->data[2] <= bmax[2])
pis.Append (node->pi);
}
int ndir = dir+1;
if (ndir == 3)
ndir = 0;
int mini = int ( (bmin[dir] - node->minx) / node->dist );
int maxi = int ( (bmax[dir] - node->minx) / node->dist );
// (*testout) << "get int, mini, maxi = " << mini << ", " << maxi << endl;
if (mini < 0) mini = 0;
if (maxi >= ADTN_DIV) maxi = ADTN_DIV-1;
for (i = mini; i <= maxi; i++)
if (node->childs[i])
{
stacks++;
stack.Elem(stacks) = node->childs[i];
stackdir.Elem(stacks) = ndir;
}
/*
if (node->left && bmin[dir] <= node->sep)
{
stacks++;
stack.Elem(stacks) = node->left;
stackdir.Elem(stacks) = ndir;
}
if (node->right && bmax[dir] >= node->sep)
{
stacks++;
stack.Elem(stacks) = node->right;
stackdir.Elem(stacks) = ndir;
}
*/
}
}
示例8: GetLineNP
int GetLineNP(int nr) const {return lines.Get(nr)->NP();}
示例9: GetLine
STLLine* GetLine(int nr) const {return lines.Get(nr);}
示例10: GetMarker
int GetMarker(int i) const
{ return chartmark.Get(i); }
示例11: DrawScene
void VisualSceneSpecPoints :: DrawScene ()
{
if (!mesh)
{
VisualScene::DrawScene();
return;
}
if (changeval != specpoints.Size())
BuildScene();
changeval = specpoints.Size();
glClearColor(backcolor, backcolor, backcolor, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable (GL_COLOR_MATERIAL);
glColor3f (1.0f, 1.0f, 1.0f);
glLineWidth (1.0f);
glPushMatrix();
glMultMatrixd (transformationmat);
// glEnable (GL_COLOR);
// glDisable (GL_COLOR_MATERIAL);
if (vispar.drawedtangents)
{
glColor3d (1, 0, 0);
glBegin (GL_LINES);
for (int i = 1; i <= specpoints.Size(); i++)
{
const Point3d p1 = specpoints.Get(i).p;
const Point3d p2 = specpoints.Get(i).p + len * specpoints.Get(i).v;
glVertex3d (p1.X(), p1.Y(), p1.Z());
glVertex3d (p2.X(), p2.Y(), p2.Z());
}
glEnd();
}
if (vispar.drawededges)
{
glColor3d (1, 0, 0);
glBegin (GL_LINES);
for (int i = 1; i <= mesh->GetNSeg(); i++)
{
const Segment & seg = mesh -> LineSegment (i);
glVertex3dv ( (*mesh)[seg[0]] );
glVertex3dv ( (*mesh)[seg[1]] );
// glVertex3dv ( &(*mesh)[seg[0]].X() );
// glVertex3dv ( &(*mesh)[seg[1]].X() );
}
glEnd();
}
glColor3d (1, 0, 0);
glBegin (GL_LINES);
int edges[12][2] =
{ { 0, 1 },
{ 2, 3 },
{ 4, 5 },
{ 6, 7 },
{ 0, 2 },
{ 1, 3 },
{ 4, 6 },
{ 5, 7 },
{ 0, 4 },
{ 1, 5 },
{ 2, 6 },
{ 3, 7 } };
for (int i = 0; i < boxes.Size(); i++)
{
for (int j = 0; j < 12; j++)
{
glVertex3dv ( boxes[i].GetPointNr(edges[j][0]) );
glVertex3dv ( boxes[i].GetPointNr(edges[j][1]) );
}
/*
glVertex3dv ( boxes[i].PMin() );
glVertex3dv ( boxes[i].PMax() );
*/
}
glEnd();
if (vispar.drawededgenrs)
{
glEnable (GL_COLOR_MATERIAL);
GLfloat textcol[3] = { GLfloat(1 - backcolor),
GLfloat(1 - backcolor),
GLfloat(1 - backcolor) };
glColor3fv (textcol);
glNormal3d (0, 0, 1);
glPushAttrib (GL_LIST_BIT);
// glListBase (fontbase);
char buf[20];
for (int i = 1; i <= mesh->GetNSeg(); i++)
{
//.........这里部分代码省略.........
示例12: GetMarkedSeg
void GetMarkedSeg(int i, Point<3> & ap1, Point<3> & ap2)
{
ap1=markedsegs.Get(i*2-1);
ap2=markedsegs.Get(i*2);
}
示例13: main
int main(int argc, char ** argv)
{
#ifdef PARALLEL
// parallel profiling
#pragma pomp inst init
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &netgen::ntasks);
MPI_Comm_rank(MPI_COMM_WORLD, &netgen::id);
MPI_Group MPI_GROUP_WORLD;
int n_ho = netgen::ntasks - 1;
int * process_ranks = new int[netgen::ntasks-1];
for ( int i = 0; i < netgen::ntasks-1; i++ )
process_ranks[i] = i+1;
MPI_Comm_group ( MPI_COMM_WORLD, &MPI_GROUP_WORLD);
MPI_Group_incl ( MPI_GROUP_WORLD, n_ho, process_ranks, & netgen::MPI_HIGHORDER_WORLD);
MPI_Comm_create ( MPI_COMM_WORLD, netgen::MPI_HIGHORDER_WORLD, & netgen::MPI_HIGHORDER_COMM);
#pragma pomp inst begin(main)
#endif
if ( netgen::id == 0 )
{
cout << "NETGEN-" << PACKAGE_VERSION << endl;
cout << "Developed at RWTH Aachen University, Germany" << endl
<< "and Johannes Kepler University Linz, Austria" << endl;
#ifdef OCCGEOMETRY
cout << "Including OpenCascade geometry kernel" << endl;
#endif
#ifdef ACIS
cout << "Including ACIS geometry kernel" << endl;
#endif
#ifdef LINUX
//feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
//feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW);
//cout << "Handle Floating Point Exceptions: " << fegetexcept() << endl;
#endif
#ifdef DEBUG
cout << "You are running the debug version !" << endl;
#endif
#ifdef USE_SUPERLU
cout << "Including sparse direct solver SuperLU by Lawrence Berkeley National Laboratory" << endl;
#endif
#ifdef PARALLEL
cout << "Including MPI " << endl;
cout << "Using " << netgen::ntasks << " processor"
<< ((netgen::ntasks > 1) ? "s " : " ") << endl;
#endif
}
else
{
;// nodisplay = true;
}
// command line arguments:
for (int i = 1; i < argc; i++)
{
if (argv[i][0] == '-')
parameters.SetCommandLineFlag (argv[i]);
else
parameters.SetFlag ("geofile", argv[i]);
}
if (getenv ("NETGENDIR") && strlen (getenv ("NETGENDIR")))
ngdir = getenv ("NETGENDIR");
else
ngdir = ".";
verbose = parameters.GetDefineFlag ("V");
if (verbose)
cout << "NETGENDIR = " << ngdir << endl;
if ( netgen::id == 0 )
{
if (parameters.StringFlagDefined ("testout"))
netgen::testout = new ofstream (parameters.GetStringFlag ("testout", "test.out"));
#ifdef SOCKETS
Ng_ServerSocketManagerInit(static_cast<int>(parameters.GetNumFlag("serversocket",-1)));
if(parameters.GetNumFlag("serversocket",-1) > 0 && !parameters.GetDefineFlag("display"))
nodisplay = true;
//.........这里部分代码省略.........
示例14: WriteJCMFormat
void WriteJCMFormat (const Mesh & mesh,
const NetgenGeometry & geom,
const string & filename)
{
if (mesh.GetDimension() != 3)
{
cout <<"\n Error: Dimension 3 only supported by this output format!"<<endl;
return;
}
int bc_at_infinity = 0;
int i, j, jj, ct(0), counter;
double dx1, dx2, dx3, dy1, dy2, dy3, dz1, dz2, dz3, vol;
// number of points
int np = mesh.GetNP();
// Identic points
Array<int,1> identmap1, identmap2, identmap3;
mesh.GetIdentifications().GetMap(1, identmap1);
mesh.GetIdentifications().GetMap(2, identmap2);
mesh.GetIdentifications().GetMap(3, identmap3);
// number of volume elements
int ne = mesh.GetNE();
int ntets = 0;
int nprisms = 0;
for (i = 1; i <= ne; i++)
{
Element el = mesh.VolumeElement(i);
if (el.GetNP() == 4)
{
ntets++;
// Check that no two points on a tetrahedron are identified with each other
for (j = 1; j <= 4; j++)
for (jj = 1; jj <=4; jj++)
{
if (identmap1.Elem(el.PNum(j)) == el.PNum(jj))
{
cout << "\n Error: two points on a tetrahedron identified (1) with each other"
<< "\n REFINE MESH !" << endl;
return;
}
if (identmap2.Elem(el.PNum(j)) == el.PNum(jj))
{
cout << "\n Error: two points on a tetrahedron identified (2) with each other"
<< "\n REFINE MESH !" << endl;
return;
}
if (identmap3.Elem(el.PNum(j)) == el.PNum(jj))
{
cout << "\n Error: two points on a tetrahedron identified (3) with each other"
<< "\n REFINE MESH !" << endl;
return;
}
}
}
else if (el.GetNP() == 6)
nprisms++;
}
if ( ne != (ntets+nprisms))
{
cout<< "\n Error in determining number of volume elements!\n"
<< "\n Prisms and tetrahedra only implemented in the JCMwave format!\n"<<endl;
return;
}
if (nprisms > 0)
cout << " Please note: Boundaries at infinity have to carry the bc-attribute '-bc="
<< bc_at_infinity <<"'."<<endl;
// number of surface elements
int nse = mesh.GetNSE();
// number of boundary triangles
int nbtri = 0;
// number of boundary quadrilaterals
int nbquad = 0;
// array with 1 if point on any tetra, 0 else
// this is needed in order to arrange the prism points in the right order
Array<int,1> pointsOnTetras;
pointsOnTetras.SetSize (mesh.GetNP());
pointsOnTetras = 0;
for (i = 1; i <= ne; i++)
{
Element el = mesh.VolumeElement(i);
if (el.GetNP() == 4)
{
for (j = 1; j <= 4; j++)
pointsOnTetras.Set(int (el.PNum(j)),1);
}
}
// number of boundary triangles and boundary quadrilaterals
for (i = 1; i <= nse; i++)
{
Element2d el = mesh.SurfaceElement(i);
if (el.GetNP() == 3 &&
( mesh.GetFaceDescriptor (el.GetIndex()).DomainIn()==0 ||
mesh.GetFaceDescriptor (el.GetIndex()).DomainOut()==0 ) )
//.........这里部分代码省略.........
示例15: WriteDiffPackFormat
void WriteDiffPackFormat (const Mesh & mesh,
const CSGeometry & geom,
const string & filename)
{
// double scale = globflags.GetNumFlag ("scale", 1);
double scale = 1;
ofstream outfile(filename.c_str());
if (mesh.GetDimension() == 3)
{
// Output compatible to Diffpack grid format
// Bartosz Sawicki <[email protected]>
int np = mesh.GetNP();
int ne = mesh.GetNE();
int nse = mesh.GetNSE();
Array <int> BIname;
Array <int> BCsinpoint;
int i, j, k, l;
outfile.precision(6);
outfile.setf (ios::fixed, ios::floatfield);
outfile.setf (ios::showpoint);
const Element & eldummy = mesh.VolumeElement((int)1);
outfile << "\n\n"
"Finite element mesh (GridFE):\n\n"
" Number of space dim. = 3\n"
" Number of elements = " << ne << "\n"
" Number of nodes = " << np << "\n\n"
" All elements are of the same type : dpTRUE\n"
" Max number of nodes in an element: "<< eldummy.GetNP() << "\n"
" Only one subdomain : dpFALSE\n"
" Lattice data ? 0\n\n\n\n";
for (i = 1; i <= nse; i++)
{
int BI=mesh.GetFaceDescriptor(mesh.SurfaceElement(i).GetIndex()).BCProperty();
int nbi=BIname.Size();
int found=0;
for (j = 1; j <= nbi; j++)
if(BI == BIname.Get(j)) found = 1;
if( ! found ) BIname.Append(BI);
}
outfile << " " << BIname.Size() << " Boundary indicators: ";
for (i =1 ; i <= BIname.Size(); i++)
outfile << BIname.Get(i) << " ";
outfile << "\n\n\n";
outfile << " Nodal coordinates and nodal boundary indicators,\n"
" the columns contain:\n"
" - node number\n"
" - coordinates\n"
" - no of boundary indicators that are set (ON)\n"
" - the boundary indicators that are set (ON) if any.\n"
"#\n";
for (i = 1; i <= np; i++)
{
const Point3d & p = mesh.Point(i);
outfile.width(4);
outfile << i << " (";
outfile.width(10);
outfile << p.X()/scale << ", ";
outfile.width(9);
outfile << p.Y()/scale << ", ";
outfile.width(9);
outfile << p.Z()/scale << ") ";
if(mesh[PointIndex(i)].Type() != INNERPOINT)
{
BCsinpoint.DeleteAll();
for (j = 1; j <= nse; j++)
{
for (k = 1; k <= mesh.SurfaceElement(j).GetNP(); k++)
{
if(mesh.SurfaceElement(j).PNum(k)==i)
{
int BC=mesh.GetFaceDescriptor(mesh.SurfaceElement(j).GetIndex()).BCProperty();
int nbcsp=BCsinpoint.Size();
int found = 0;
for (l = 1; l <= nbcsp; l++)
if(BC == BCsinpoint.Get(l)) found = 1;
if( ! found ) BCsinpoint.Append(BC);
}
}
}
int nbcsp = BCsinpoint.Size();
outfile << "[" << nbcsp << "] ";
for (j = 1; j <= nbcsp; j++)
outfile << BCsinpoint.Get(j) << " ";
outfile << "\n";
}
else outfile << "[0]\n";
//.........这里部分代码省略.........