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


C++ ArrayT::Pointer方法代码示例

本文整理汇总了C++中ArrayT::Pointer方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayT::Pointer方法的具体用法?C++ ArrayT::Pointer怎么用?C++ ArrayT::Pointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArrayT的用法示例。


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

示例1: WaitReceive

/* return the index the next receive */
void CommunicatorT::WaitReceive(const ArrayT<MPI_Request>& requests, int& index, int& source) const
{
	const char caller[] = "CommunicatorT::WaitReceive";
	Log(kModerate, caller, "waiting for 1 of %d", requests.Length());

	index = source = -1;

#ifdef __TAHOE_MPI__
	/* grab completed receive */
	MPI_Status status;
	int ret = MPI_Waitany(requests.Length(), (MPI_Request*) requests.Pointer(), &index, &status);

#ifdef CHECK_MPI_RETURN
	if (ret != MPI_SUCCESS) Log(kFail, caller, "MPI_Waitany failed");
#endif

#ifdef CHECK_MPI_STATUS
	if (status.MPI_ERROR != MPI_SUCCESS) Log(kFail, caller, "bad status: %d", status.MPI_ERROR);
#endif
	
	source = status.MPI_SOURCE;
#endif

	Log(kModerate, caller, "received request at index %d from %d", index, source);
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:26,代码来源:CommunicatorT.cpp

示例2: WaitSends

/* block until all sends posted with CommunicatorT::PostSend have completed */
void CommunicatorT::WaitSends(const ArrayT<MPI_Request>& requests)
{
	const char caller[] = "CommunicatorT::WaitSends";
	Log(kModerate, caller, "waiting for 1 of %d", requests.Length());

	/* complete all sends */
	for (int i = 0; i < requests.Length(); i++)
	{
		int index = -1;

#ifdef __TAHOE_MPI__
		/* grab completed receive */
		MPI_Status status;
		int ret = MPI_Waitany(requests.Length(), (MPI_Request*) requests.Pointer(), &index, &status);

#ifdef CHECK_MPI_RETURN
		if (ret != MPI_SUCCESS) Log(kFail, caller, "MPI_Waitany failed");
#endif

#ifdef CHECK_MPI_STATUS
		if (status.MPI_ERROR != MPI_SUCCESS) {
			WriteStatus(Log(), caller, status);
			Log(kFail, caller, "bad status: %d", status.MPI_ERROR);
		}
#endif

#endif

		Log(kLow, caller, "completing send at index %d", index);
	}
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:32,代码来源:CommunicatorT.cpp

示例3: bprimeVectorToMatrix

void SS_SCNIMFT::bprimeVectorToMatrix(dMatrixT *bprimeVector, ArrayT<dMatrixT>& BprimeJ)
{
  int nsd = NumSD();
  dMatrixT* BJptr = BprimeJ.Pointer();
  dArrayT bprime(nsd);
  
  for (int i = 0; i < nsd ; i++, BJptr++) {
    double* Bptr = BJptr->Pointer();
    bprimeVector->CopyColumn(i,bprime);
    double* bVector = bprime.Pointer();
    Bptr[0] = *bVector;
    if (nsd == 2) {
      Bptr[5] = *bVector++;
      Bptr[4] = *bVector;
      Bptr[3] = 0.;
      Bptr[2] = *bVector;
      Bptr[1] = 0.;
    } 
    else { // nsd == 3
      Bptr[11] = Bptr[16] = *bVector++;
      Bptr[7] = *bVector;
      Bptr[5] = Bptr[15] = *bVector++;
      Bptr[14] = *bVector;
      Bptr[4] = Bptr[9] = *bVector;
    }
  }
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:27,代码来源:SS_SCNIMFT.cpp

示例4: Broadcast

/* broadcast character array */
void CommunicatorT::Broadcast(int source, ArrayT<char>& data)
{
	if (source == Rank())
	{
		Log(kModerate, "Broadcast", "sending %d", data.Length());
		if (LogLevel() == kLow) Log() << setw(10) << "data: " << data.Pointer() << '\n';
	}

#ifdef __TAHOE_MPI__
	int ret = MPI_Bcast(data.Pointer(), data.Length(), MPI_CHAR, source, fComm);

#ifdef CHECK_MPI_RETURN
	if (ret != MPI_SUCCESS) Log(kFail, "CommunicatorT::Broadcast", "MPI_Bcast failed");
#endif

#endif

	if (source != Rank())
	{
		Log(kModerate, "Broadcast", "received %d", data.Length());
		if (LogLevel() == kLow) Log() << setw(10) << "data: " << data.Pointer() << '\n';
	}
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:24,代码来源:CommunicatorT.cpp

示例5: SortByMinDegree

/* sort edges by minimum degree */
void CMReLabellerT::SortByMinDegree(ArrayT<int>& edges)
{
	int numedges = edges.Length();
	
	// array with degrees of edges
	iArrayT edgedegrees(numedges);
	
	for( int i = 0; i < numedges; i++)
	{
		edgedegrees[i] = fGraph.Degree(edges[i]);
	}
	
	// sort edges by degree in ascending order
	AZ_sort(edgedegrees.Pointer(), numedges, edges.Pointer(), NULL);
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:16,代码来源:CMReLabellerT.cpp

示例6: RemoveRepeats

// maybe someday this will be added to iArrayT ?
void NodeManagerPrimitive::RemoveRepeats (ArrayT<int>& n) const
{
      iArrayT nodes;
      nodes.Swap (n);
      nodes.SortAscending();

      // determine number of nodes
      int count = 1;
      for (int m=1; m < nodes.Length(); m++)
	if (nodes[m] != nodes[m-1]) count++;

      // collect nodes, only once
      n.Allocate (count);
      int *pnew = n.Pointer();
      int *pold = nodes.Pointer();
      *pnew++ = *pold++;
      for (int ni=1; ni < nodes.Length(); ni++, *pold++)
	if (*pold != nodes[ni-1]) 
	  *pnew++ = *pold;
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:21,代码来源:NodeManagerPrimitive.cpp

示例7: Set

void PartitionT::Set(int num_parts, int id, const ArrayT<int>& part_map,
	const ArrayT<int>& node_map,
	const ArrayT<const iArray2DT*>& connects_1,
	const ArrayT<const RaggedArray2DT<int>*>& connects_2)
{
	const char caller[] = "PartitionT::Set";

	/* check */
	if (part_map.Length() != node_map.Length())
		ExceptionT::SizeMismatch(caller, "part map length %d must equal node map length %d",
			part_map.Length(), node_map.Length());

	/* total number of partitions */
	fNumPartitions = num_parts;
	if (fNumPartitions < 1) ExceptionT::GeneralFail(caller, "bad size %d", fNumPartitions);

	/* set ID */
	fID = id;
	if (fID < 0 || fID >= fNumPartitions) ExceptionT::OutOfRange(caller, "bad id %d", fID);
		
	/* numbering is global */
	fScope = kLocal;

	/* resolve internal/boundary nodes */
	ClassifyNodes(part_map, connects_1, connects_2);

	/* set node map */
	fNodeMap_man.SetLength(node_map.Length(), false);
	int nnd = fNodes_i.Length() + fNodes_b.Length() + fNodes_e.Length();
	if (fNodeMap.Length() != nnd)
		ExceptionT::GeneralFail(caller, "expecting %d entries in node map %d", nnd, fNodeMap.Length());
	fNodeMap.Copy(node_map.Pointer());

	/* set send information */
	SetReceive(part_map);
	
	/* clear inverse maps */
	fInvNodeMap.Free();
	for (int i = 0; i < fInvElementMap.Length(); i++)
		fInvElementMap.Free();
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:41,代码来源:PartitionT.cpp


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