本文整理汇总了C++中FlatArray::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ FlatArray::Size方法的具体用法?C++ FlatArray::Size怎么用?C++ FlatArray::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlatArray
的用法示例。
在下文中一共展示了FlatArray::Size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Append
void Append (FlatArray<T2, B2> a2)
{
if (this->size+a2.Size() > allocsize)
ReSize (this->size+a2.Size());
for (int i = 0; i < a2.Size(); i++)
this->data[this->size+i] = a2[i+B2];
this->size += a2.Size();
}
示例2: BubbleSort
inline void BubbleSort (const FlatArray<T> & data)
{
T hv;
for (int i = 0; i < data.Size(); i++)
for (int j = i+1; j < data.Size(); j++)
if (data[i] > data[j])
{
hv = data[i];
data[i] = data[j];
data[j] = hv;
}
}
示例3:
inline ostream & operator<< (ostream & ost, const TABLE<T,BASE> & table)
{
for (int i = BASE; i < table.Size()+BASE; i++)
{
ost << i << ": ";
FlatArray<T> row = table[i];
ost << "(" << row.Size() << ") ";
for (int j = 0; j < row.Size(); j++)
ost << row[j] << " ";
ost << endl;
}
return ost;
}
示例4: MyMPI_IRecv
inline MPI_Request MyMPI_IRecv (FlatArray<T, BASE> s, int dest)
{
MPI_Request request;
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, 1, MPI_COMM_WORLD, &request);
return request;
// MPI_Request_free (&request);
}
示例5: 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]);
}
示例6: data
BASE_TABLE :: BASE_TABLE (const FlatArray<int> & entrysizes, int elemsize)
: data(entrysizes.Size())
{
int i, cnt = 0;
int n = entrysizes.Size();
for (i = 0; i < n; i++)
cnt += entrysizes[i];
oneblock = new char[elemsize * cnt];
// mem_total_alloc_table += elemsize * cnt;
cnt = 0;
for (i = 0; i < n; i++)
{
data[i].maxsize = entrysizes[i];
data[i].size = 0;
data[i].col = &oneblock[elemsize * cnt];
cnt += entrysizes[i];
}
}
示例7: Add
void Add (int blocknr, const FlatArray<int> & dofs)
{
switch (mode)
{
case 1:
if (blocknr+1 > nd) nd = blocknr+1;
break;
case 2:
cnt[blocknr]+=dofs.Size();
break;
case 3:
for (int j = 0; j < dofs.Size(); j++)
(*table)[blocknr][cnt[blocknr]+j] = dofs[j];
cnt[blocknr]+=dofs.Size();
/*
for (int j = 0; j < dofs.Size(); j++)
table->Data()[cnt[blocknr]+j] = dofs[j];
cnt[blocknr]+=dofs.Size();
*/
break;
}
}
示例8: Table
/// Construct table of variable entrysize
INLINE Table (FlatArray<int> entrysize)
{
size_t cnt = 0;
size = entrysize.Size();
index = new size_t[size+1];
for (int i = 0; i < size; i++)
{
index[i] = cnt;
cnt += entrysize[i];
}
index[size] = cnt;
data = new T[cnt];
}
示例9: GetDistantProcs
std::tuple<int,int*> Ngx_Mesh :: GetDistantProcs (int nodetype, int locnum) const
{
switch (nodetype)
{
case 0:
{
FlatArray<int> dn = mesh->GetParallelTopology().GetDistantPNums(locnum);
return std::tuple<int,int*>(dn.Size(), &dn[0]);
}
case 1:
{
FlatArray<int> dn = mesh->GetParallelTopology().GetDistantEdgeNums(locnum);
return std::tuple<int,int*>(dn.Size(), &dn[0]);
}
case 2:
{
FlatArray<int> dn = mesh->GetParallelTopology().GetDistantFaceNums(locnum);
return std::tuple<int,int*>(dn.Size(), &dn[0]);
}
default:
return std::tuple<int,int*>(0,nullptr);
}
}
示例10: MyMPI_ISend
inline void MyMPI_ISend (FlatArray<T, BASE> s, int dest, MPI_Request & request)
{
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, 1, MPI_COMM_WORLD, & request);
}
示例11: MyMPI_Send
inline void MyMPI_Send (FlatArray<T, BASE> s, int dest, int tag)
{
MPI_Send( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD);
}
示例12: 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());
outfile.precision(14);
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";
// setup point-to-surfaceelement table
TABLE<SurfaceElementIndex, PointIndex::BASE> point2sel(np);
for (SurfaceElementIndex sei = 0; sei < nse; sei++)
{
const Element2d & el = mesh[sei];
for (int j = 0; j < el.GetNP(); j++)
point2sel.Add (el[j], sei);
}
for (i = 1; i <= np; i++)
{
const Point3d & p = mesh.Point(i);
outfile.width(12);
outfile << i << " (";
outfile.width(16);
outfile << p.X()/scale << ", ";
outfile.width(16);
outfile << p.Y()/scale << ", ";
outfile.width(16);
outfile << p.Z()/scale << ") ";
if(mesh[PointIndex(i)].Type() != INNERPOINT)
{
BCsinpoint.DeleteAll();
/*
for (j = 1; j <= nse; j++)
*/
FlatArray<SurfaceElementIndex> sels = point2sel[i];
for (int jj = 0; jj < sels.Size(); jj++)
{
for (k = 1; k <= mesh[sels[jj]].GetNP(); k++)
{
if(mesh[sels[jj]].PNum(k)==i)
{
//.........这里部分代码省略.........
示例13: MyMPI_IRecvTag
inline void MyMPI_IRecvTag (FlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
{
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
}
示例14: TABLE
/// Creates fixed element size table
inline TABLE (const FlatArray<int,BASE> & entrysizes)
: BASE_TABLE (FlatArray<int> (entrysizes.Size(), const_cast<int*>(&entrysizes[BASE])),
sizeof(T))
{ ; }
示例15: MyMPI_IRecv
inline MPI_Request MyMPI_IRecv (FlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm = MPI_COMM_WORLD)
{
MPI_Request request;
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request);
return request;
}