コード例 #1
0
void Albany::MultiSTKFieldContainer<Interleaved>::saveSolnMultiVector(const Tpetra_MultiVector& solnT,
    stk::mesh::Selector& sel, const Teuchos::RCP<const Tpetra_Map>& node_mapT) {


  typedef typename AbstractSTKFieldContainer::VectorFieldType VFT;
  typedef typename AbstractSTKFieldContainer::ScalarFieldType SFT;

  // Iterate over the on-processor nodes by getting node buckets and iterating over each bucket.
  stk::mesh::BucketVector const& all_elements = this->bulkData->get_buckets(stk::topology::NODE_RANK, sel);


  this->numNodes = node_mapT->getNodeNumElements(); // Needed for the getDOF function to work correctly
  // This is either numOwnedNodes or numOverlapNodes, depending on
  // which map is passed in

   for(stk::mesh::BucketVector::const_iterator it = all_elements.begin() ; it != all_elements.end() ; ++it) {

    const stk::mesh::Bucket& bucket = **it;

    for(int vector_component = 0; vector_component < solnT.getNumVectors(); vector_component++){

      int offset = 0;

      for(int k = 0; k < sol_index[vector_component].size(); k++) {

        if(sol_index[vector_component][k] == 1) { // Scalar

          SFT* field = this->metaData->template get_field<SFT>(
                            stk::topology::NODE_RANK, sol_vector_name[vector_component][k]);
          this->saveMultiVectorHelper(solnT, field, node_mapT, bucket, vector_component, offset);

        }

        else {

          VFT* field = this->metaData->template get_field<VFT>(
                            stk::topology::NODE_RANK, sol_vector_name[vector_component][k]);
          this->saveMultiVectorHelper(solnT, field, node_mapT, bucket, vector_component, offset);

        }

        offset += sol_index[vector_component][k];

      }

    }

  }
}
コード例 #2
0
void Albany::OrdinarySTKFieldContainer<Interleaved>::fillSolnMultiVector(Tpetra_MultiVector &solnT,
       stk::mesh::Selector &sel, const Teuchos::RCP<const Tpetra_Map>& node_mapT){

  typedef typename AbstractSTKFieldContainer::VectorFieldType VFT;

  // Iterate over the on-processor nodes by getting node buckets and iterating over each bucket.
  stk::mesh::BucketVector const& all_elements = this->bulkData->get_buckets(stk::topology::NODE_RANK, sel);
  this->numNodes = node_mapT->getNodeNumElements(); // Needed for the getDOF function to work correctly
                                        // This is either numOwnedNodes or numOverlapNodes, depending on
                                        // which map is passed in

   for(stk::mesh::BucketVector::const_iterator it = all_elements.begin() ; it != all_elements.end() ; ++it) {

    const stk::mesh::Bucket& bucket = **it;

    for(int vector_component = 0; vector_component < solnT.getNumVectors(); vector_component++)

      this->fillMultiVectorHelper(solnT, solution_field[vector_component], node_mapT, bucket, vector_component, 0);

  }
}