Esempio n. 1
0
 void getWeightsView(const scalar_t *&wgt, int &stride, int idx = 0) const {
   if (getPrimaryEntityType() == GRAPH_VERTEX)
     getVertexWeightsView(wgt, stride, idx);
   else {
     // TODO:  Need getEdgeWeightsView that lets Edges be primary object?
     // TODO:  That is, get edge weights based on some Edge ID.
     std::ostringstream emsg;
     emsg << __FILE__ << "," << __LINE__
          << " error:  getWeightsView not yet supported for graph edges."
          << std::endl;
     throw std::runtime_error(emsg.str());
   }
 }
Esempio n. 2
0
 void getIDsView(const gno_t *&Ids) const {
   if (getPrimaryEntityType() == GRAPH_VERTEX)
     getVertexIDsView(Ids);
   else {
     // TODO:  Need getEdgeIDsView?  What is an Edge ID?
     // TODO:  std::pair<gno_t, gno_t>?
     std::ostringstream emsg;
     emsg << __FILE__ << "," << __LINE__
          << " error:  getIDsView not yet supported for graph edges."
          << std::endl;
     throw std::runtime_error(emsg.str());
   }
 }
Esempio n. 3
0
 int getNumWeightsPerID() const
 {
   switch (getPrimaryEntityType()) {
   case MATRIX_ROW:
     return getNumWeightsPerRow();
   case MATRIX_COLUMN:
     return getNumWeightsPerColumn();
   case MATRIX_NONZERO:
     return 0;  //TODO: weights not yet supported for nonzeros
   default:   // Shouldn't reach default; just making compiler happy
     return 0;
   }
 }
Esempio n. 4
0
 // Functions from the BaseAdapter interface
 size_t getLocalNumIDs() const
 {
   switch (getPrimaryEntityType()) {
   case MATRIX_ROW:
     return getLocalNumRows();
   case MATRIX_COLUMN:
     return getLocalNumColumns();
   case MATRIX_NONZERO:
     return getLocalNumEntries();
   default:   // Shouldn't reach default; just making compiler happy
     return 0;
   }
 }
Esempio n. 5
0
 void getIDsView(const gno_t *&Ids) const
 {
   switch (getPrimaryEntityType()) {
   case MATRIX_ROW:
     getRowIDsView(Ids);
     break;
   case MATRIX_COLUMN:
     getColumnIDsView(Ids);
     break;
   case MATRIX_NONZERO: {
     // TODO:  Need getNonzeroIDsView?  What is a Nonzero ID?
     // TODO:  std::pair<gno_t, gno_t>?
     std::ostringstream emsg;
     emsg << __FILE__ << "," << __LINE__
          << " error:  getIDsView not yet supported for matrix nonzeros."
          << std::endl;
     throw std::runtime_error(emsg.str());
     }
   default:   // Shouldn't reach default; just making compiler happy
     break;
   }
 }
Esempio n. 6
0
 void getWeightsView(const scalar_t *&wgt, int &stride, int idx = 0) const
 {
   switch (getPrimaryEntityType()) {
   case MATRIX_ROW:
     getRowWeightsView(wgt, stride, idx);
     break;
   case MATRIX_COLUMN:
     getColumnWeightsView(wgt, stride, idx);
     break;
   case MATRIX_NONZERO:
     {
     // TODO:  Need getNonzeroWeightsView with Nonzeros as primary object?
     // TODO:  That is, get Nonzeros' weights based on some nonzero ID?
     std::ostringstream emsg;
     emsg << __FILE__ << "," << __LINE__
          << " error:  getWeightsView not yet supported for matrix nonzeros."
          << std::endl;
     throw std::runtime_error(emsg.str());
     }
   default:   // Shouldn't reach default; just making compiler happy
     break;
   }
 }
void StkMeshZoltanAdapter::debuggingInfo(int proc_id, std::ofstream& out) const
{
    int stride = 0;
    const scalar_t** coords = new const scalar_t*[this->getDimension()]; // int *vect = new int[num];

    for(int coordim = 0; coordim < this->getDimension(); ++coordim)
    {
        this->getCoordinatesViewOf(getPrimaryEntityType(), coords[coordim], stride, coordim);
    }

    // vertex weights
    const scalar_t** weights = new const scalar_t*[getNumWeightsPerOf(getPrimaryEntityType())]; // int *vect = new int[num];
    int weightstride = 0;
    for(int weightdim = 0; weightdim < getNumWeightsPerOf(getPrimaryEntityType()); ++weightdim)
    {
        this->getWeightsViewOf(getPrimaryEntityType(), weights[weightdim], weightstride, weightdim);
    }

    std::ostringstream os;
    os << "Output of coordinates on processor " << proc_id << std::endl;
    for(size_t i=0;i<getLocalNumOf(getPrimaryEntityType());++i)
    {
        os << "[" << proc_id << "] Vertex " << i << " has coordinates: ";
        for(int coordim = 0; coordim < this->getDimension(); ++coordim)
        {
            os << coords[coordim][stride*i] << "\t";
        }

        os << " with weights: ";
        for(int weightdim = 0; weightdim < getNumWeightsPerOf(getPrimaryEntityType()); ++weightdim)
        {
            os << weights[weightdim][weightstride*i] << "\t";
        }
        os << std::endl;
    }

    out << os.str();

    delete [] weights;
    delete [] coords;
}
Esempio n. 8
0
 int getNumWeightsPerID() const {
   if (getPrimaryEntityType() == GRAPH_VERTEX)
     return getNumWeightsPerVertex();
   else
     return getNumWeightsPerEdge();
 }
Esempio n. 9
0
 // Functions from the BaseAdapter interface
 size_t getLocalNumIDs() const {
   if (getPrimaryEntityType() == GRAPH_VERTEX)
     return getLocalNumVertices();
   else
     return getLocalNumEdges();
  }