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


C++ FlatArray类代码示例

本文整理汇总了C++中FlatArray的典型用法代码示例。如果您正苦于以下问题:C++ FlatArray类的具体用法?C++ FlatArray怎么用?C++ FlatArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FlatArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
 }
开发者ID:Micket,项目名称:netgen-mesher-fix,代码行数:7,代码来源:mpi_interface.hpp

示例2: 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

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

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

示例5:

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;
}
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:13,代码来源:table.hpp

示例6: BASE_TABLE

  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];
      }
  }
开发者ID:11235813,项目名称:netgen,代码行数:21,代码来源:table.cpp

示例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;
	}
    }
开发者ID:mliertzer,项目名称:ngsolve,代码行数:22,代码来源:table.hpp

示例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];
  }
开发者ID:mliertzer,项目名称:ngsolve,代码行数:15,代码来源:table.hpp

示例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);
      }
  }
开发者ID:mliertzer,项目名称:netgen-mesher,代码行数:24,代码来源:nginterface_v2.cpp

示例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);
 }
开发者ID:Micket,项目名称:netgen-mesher-fix,代码行数:4,代码来源:mpi_interface.hpp

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

示例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)
			{
//.........这里部分代码省略.........
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:101,代码来源:writediffpack.cpp

示例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);
 }
开发者ID:Micket,项目名称:netgen-mesher-fix,代码行数:4,代码来源:mpi_interface.hpp

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

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


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