typename boost::disable_if< boost::is_same<T, Albany::AbstractSTKFieldContainer::ScalarFieldType>, void >::type
Albany::GenericSTKFieldContainer<Interleaved>::fillVectorHelper(
        Epetra_Vector& field_vector, T* field, const Teuchos::RCP<Epetra_Map>& node_map,
        const stk::mesh::Bucket& bucket, const NodalDOFManager& nodalDofManager, int offset) {

  BucketArray<T> field_array(*field, bucket);
  const int num_nodes_in_bucket = field_array.dimension(1);

  stk::mesh::BulkData& mesh = field->get_mesh();

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

    //      const unsigned node_gid = bucket[i].identifier();
    const int node_gid = mesh.identifier(bucket[i]) - 1;
#ifdef ALBANY_64BIT_INT
    int node_lid = node_map->LID(static_cast<long long int>(node_gid));
#else
    int node_lid = node_map->LID(node_gid);
#endif

    if(node_lid>=0)
      for(std::size_t j = 0; j < (std::size_t)nodalDofManager.numComponents(); j++)
        field_vector[nodalDofManager.getLocalDOF(node_lid,offset+j)] = field_array(j,i);
  }

}
void Albany::GenericSTKFieldContainer<Interleaved>::saveVectorHelper(
        const Epetra_Vector& field_vector, ScalarFieldType* field, const Teuchos::RCP<Epetra_Map>& field_node_map,
        const stk::mesh::Bucket& bucket, const NodalDOFManager& nodalDofManager, int offset) {

  BucketArray<ScalarFieldType> field_array(*field, bucket);
  const int num_nodes_in_bucket = field_array.dimension(0);

  stk::mesh::BulkData& mesh = field->get_mesh();

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

    //      const unsigned node_gid = bucket[i].identifier();
    const int node_gid = mesh.identifier(bucket[i]) - 1;
    int node_lid = field_node_map->LID(node_gid);

    if(node_lid>=0)
      field_array(i)=field_vector[nodalDofManager.getLocalDOF(node_lid,offset)];
  }
}
void Albany::OrdinarySTKFieldContainer<Interleaved>::saveVectorT(const Tpetra_Vector& field_vector, const std::string&  field_name,
    stk::mesh::Selector& field_selection, const Teuchos::RCP<const Tpetra_Map>& field_node_map, const NodalDOFManager& nodalDofManager) {

  // 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, field_selection);

  if(nodalDofManager.numComponents() > 1) {
    AbstractSTKFieldContainer::VectorFieldType* field  = this->metaData->template get_field<AbstractSTKFieldContainer::VectorFieldType>(stk::topology::NODE_RANK, field_name);
    for(stk::mesh::BucketVector::const_iterator it = all_elements.begin() ; it != all_elements.end() ; ++it) {
      const stk::mesh::Bucket& bucket = **it;
      this->saveVectorHelperT(field_vector, field, field_node_map, bucket, nodalDofManager);
    }
  }
  else {
    AbstractSTKFieldContainer::ScalarFieldType* field  = this->metaData->template get_field<AbstractSTKFieldContainer::ScalarFieldType>(stk::topology::NODE_RANK, field_name);
    for(stk::mesh::BucketVector::const_iterator it = all_elements.begin() ; it != all_elements.end() ; ++it) {
      const stk::mesh::Bucket& bucket = **it;
      this->saveVectorHelperT(field_vector, field, field_node_map, bucket, nodalDofManager);
    }
  }
}
void Albany::GenericSTKFieldContainer<Interleaved>::fillVectorHelper(
        Epetra_Vector& field_vector, ScalarFieldType* field, const Teuchos::RCP<Epetra_Map>& node_map,
        const stk::mesh::Bucket& bucket, const NodalDOFManager& nodalDofManager, int offset) {

  BucketArray<ScalarFieldType> field_array(*field, bucket);
  const int num_nodes_in_bucket = field_array.dimension(0);

  stk::mesh::BulkData& mesh = field->get_mesh();

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

    //      const unsigned node_gid = bucket[i].identifier();
    const int node_gid = mesh.identifier(bucket[i]) - 1;
#ifdef ALBANY_64BIT_INT
    int node_lid = node_map->LID(static_cast<long long int>(node_gid));
#else
    int node_lid = node_map->LID(node_gid);
#endif

    if(node_lid>=0)
      field_vector[nodalDofManager.getLocalDOF(node_lid,offset)] = field_array(i);
  }
}