static void saveFieldData(const Teuchos::RCP<const Tpetra_MultiVector>& overlap_node_vec,
                              const stk::mesh::BucketVector& all_elements,
                              field_type *fld, int offset){


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

        const stk::mesh::Bucket& bucket = **it;
        stk::mesh::BulkData const& bulkData = bucket.mesh();

        BucketArray<field_type> solution_array(*fld, bucket);

        const int num_i_components = solution_array.dimension(0);
        const int num_j_components = solution_array.dimension(1);
        const int num_nodes_in_bucket = solution_array.dimension(2);


        for(std::size_t j = 0; j < num_j_components; j++)
          for(std::size_t k = 0; k < num_i_components; k++){

            Teuchos::ArrayRCP<const ST> const_overlap_node_view = 
                     overlap_node_vec->getVector(offset + j*num_i_components + k)->get1dView();

            for(std::size_t i = 0; i < num_nodes_in_bucket; i++)  {

              const GO global_id = bulkData.identifier(bucket[i]) - 1; // global node in mesh
              const LO local_id =  overlap_node_vec->getMap()->getLocalElement(global_id);
              solution_array(k, j, i) = const_overlap_node_view[local_id];

            }
         }
      }
    }
Exemplo n.º 2
0
void pack_buckets_parts(const stk::mesh::BucketVector& buckets, stk::CommBuffer &buff)
{
    for(size_t i = 0; i < buckets.size(); ++i)
    {
        const stk::mesh::PartVector& parts = buckets[i]->supersets();
        std::string part_names_for_bucket = create_string_from_parts(parts);
        stk::diff::pack_string(buff, part_names_for_bucket);
    }
}
Exemplo n.º 3
0
void check_parts_allowed(const stk::mesh::BucketVector &buckets, const stk::mesh::PartVector &parts_allowed)
{
    for (unsigned i = 0; i < buckets.size(); ++i)
    {
        const stk::mesh::Bucket &bucket = *buckets[i];
        const stk::mesh::PartVector &parts_found = bucket.supersets();

        for (unsigned j = 0; j < parts_found.size(); ++j)
        {
            const stk::mesh::Part *part = parts_found[j];
            bool found = (std::find(parts_allowed.begin(), parts_allowed.end(), part) != parts_allowed.end());
            EXPECT_TRUE(found);
        }
    }
}