コード例 #1
0
    void StringFunction::operator()(MDArray& input_phy_points, MDArray& output_values,
                                    const stk::mesh::Bucket& bucket, const MDArray& parametric_coordinates, double time_value_optional) 
    {
      PRINT("tmp srk StringFunction::operator(bucket) getName()= " << getName() << " input_phy_points= " << input_phy_points << " output_values= " << output_values);

      VERIFY_OP(input_phy_points.rank(), ==, 3, "StringFunction::operator() must pass in input_phy_points(numCells, numPointsPerCell, spaceDim)");
      int nPoints = input_phy_points.dimension(1);
      int nSpaceDim = input_phy_points.dimension(2);
      int nOutDim = output_values.dimension(2);
      MDArray input_phy_points_one(1, nPoints, nSpaceDim);
      MDArray output_values_one   (1, nPoints, nOutDim);
      const unsigned num_elements_in_bucket = bucket.size();
      for (unsigned iElement = 0; iElement < num_elements_in_bucket; iElement++)
        {
          stk::mesh::Entity& element = bucket[iElement];
          for (int iPoint = 0; iPoint<nPoints; iPoint++)
            {
              for (int iSpaceDim=0; iSpaceDim < nSpaceDim; iSpaceDim++)
                {
                  input_phy_points_one(0, iPoint, iSpaceDim) = input_phy_points(iElement, iPoint, iSpaceDim);
                }
            }
          (*this)(input_phy_points_one, output_values_one, element, parametric_coordinates, time_value_optional);
          for (int iPoint = 0; iPoint<nPoints; iPoint++)
            {
              for (int iDOF = 0; iDOF < nOutDim; iDOF++)
                {
                  output_values(iElement, iPoint, iDOF) = output_values_one(0, iPoint, iDOF);
                }
            }
        }
    }
コード例 #2
0
ファイル: KokkosFieldBLAS.C プロジェクト: mhoemmen/Trilinos
 inline
 int field_length(NgpFieldVector<Scalar> & xField, const stk::mesh::Bucket & b)
 {
     const stk::mesh::Bucket::size_type length = b.size();
     const unsigned int fieldSize = field_scalars_per_entity(xField.get_field(), b);
     return length * fieldSize;
 }
コード例 #3
0
    BucketArray( const field_type & f , const stk::mesh::Bucket & k )
    {
        if (k.field_data_is_allocated(f)) {
            array_type::assign( (ScalarType*)( k.field_data_location(f) ) ,
                                k.size() );

        }
    }
コード例 #4
0
      bool helperSubDim(const stk::mesh::Bucket& bucket, stk::mesh::FieldBase *field,  const mesh::BulkData& bulkData)
      {
        const unsigned num_elements_in_bucket = bucket.size();

        for (unsigned iElement = 0; iElement < num_elements_in_bucket; iElement++)
          {
            stk::mesh::Entity& element = bucket[iElement];
            helperSubDim(element, field, bulkData);
          }
        return false;
      }
コード例 #5
0
    BucketArray( const field_type & f , const stk::mesh::Bucket & b )
    {
        if ( b.field_data_is_allocated(f) ) {
            int stride[4];
            if (f.field_array_rank() == 1) {
                stride[0] = stk::mesh::field_scalars_per_entity(f, b);
            }
            else if (f.field_array_rank() == 2) {
                int dim0 = stk::mesh::find_restriction(f, b.entity_rank(), b.supersets()).dimension();
                stride[0] = dim0;
                stride[1] = stk::mesh::field_scalars_per_entity(f, b);
            }
            else if (f.field_array_rank() == 3) {
                int dim0 = stk::mesh::find_restriction(f, b.entity_rank(), b.supersets()).dimension();
                stride[0] = dim0;
                stride[1] = get_size<Tag2>(b) * dim0;
                stride[2] = stk::mesh::field_scalars_per_entity(f, b);
            }
            else if (f.field_array_rank() == 4) {
                int dim0 = stk::mesh::find_restriction(f, b.entity_rank(), b.supersets()).dimension();
                stride[0] = dim0;
                stride[1] = get_size<Tag2>(b) * dim0;
                stride[2] = get_size<Tag3>(b) * stride[1];
                stride[3] = stk::mesh::field_scalars_per_entity(f, b);
            }
            else {
                assert(false);
            }

            array_type::assign_stride(
                (ScalarType*)( b.field_data_location(f) ),
                stride,
                (typename array_type::size_type) b.size() );

        }
    }