本文整理汇总了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);
}
示例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);
}
}
示例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;
}
}
}
示例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';
}
}
示例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);
}
示例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;
}
示例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();
}