swarmutils.c (a171b6ef1192a8f5f3031330339aaab2ded4c8fb) swarmutils.c (4d00b080eb3f95d2e04e55c0ff369c5c847bb288)
1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8#include "../include/swarmutils.h"

--- 77 unchanged lines hidden (view full) ---

86 // Create Q data
87 {
88 CeedQFunction qf_setup;
89 CeedOperator op_setup;
90 CeedVector x_coord;
91
92 {
93 Vec X_loc;
1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3//
4// SPDX-License-Identifier: BSD-2-Clause
5//
6// This file is part of CEED: http://github.com/ceed
7
8#include "../include/swarmutils.h"

--- 77 unchanged lines hidden (view full) ---

86 // Create Q data
87 {
88 CeedQFunction qf_setup;
89 CeedOperator op_setup;
90 CeedVector x_coord;
91
92 {
93 Vec X_loc;
94 CeedInt len;
94 PetscInt len;
95 const PetscScalar *x;
96
97 PetscCall(DMGetCoordinatesLocal(dm_mesh, &X_loc));
98 PetscCall(VecGetLocalSize(X_loc, &len));
99 CeedVectorCreate((*ctx)->ceed, len, &x_coord);
100
101 PetscCall(VecGetArrayRead(X_loc, &x));
102 CeedVectorSetArray(x_coord, CEED_MEM_HOST, CEED_COPY_VALUES, (CeedScalar *)x);

--- 480 unchanged lines hidden (view full) ---

583// ------------------------------------------------------------------------------------------------
584// BP setup
585// ------------------------------------------------------------------------------------------------
586PetscErrorCode SetupProblemSwarm(DM dm_swarm, Ceed ceed, BPData bp_data, CeedData data, PetscBool setup_rhs, Vec rhs, Vec target) {
587 DM dm_mesh, dm_coord;
588 CeedElemRestriction elem_restr_u_mesh, elem_restr_x_mesh, elem_restr_x_points, elem_restr_u_points, elem_restr_q_data_points;
589 CeedBasis basis_u, basis_x;
590 CeedVector x_coord, x_ref_points, q_data_points;
95 const PetscScalar *x;
96
97 PetscCall(DMGetCoordinatesLocal(dm_mesh, &X_loc));
98 PetscCall(VecGetLocalSize(X_loc, &len));
99 CeedVectorCreate((*ctx)->ceed, len, &x_coord);
100
101 PetscCall(VecGetArrayRead(X_loc, &x));
102 CeedVectorSetArray(x_coord, CEED_MEM_HOST, CEED_COPY_VALUES, (CeedScalar *)x);

--- 480 unchanged lines hidden (view full) ---

583// ------------------------------------------------------------------------------------------------
584// BP setup
585// ------------------------------------------------------------------------------------------------
586PetscErrorCode SetupProblemSwarm(DM dm_swarm, Ceed ceed, BPData bp_data, CeedData data, PetscBool setup_rhs, Vec rhs, Vec target) {
587 DM dm_mesh, dm_coord;
588 CeedElemRestriction elem_restr_u_mesh, elem_restr_x_mesh, elem_restr_x_points, elem_restr_u_points, elem_restr_q_data_points;
589 CeedBasis basis_u, basis_x;
590 CeedVector x_coord, x_ref_points, q_data_points;
591 CeedInt num_comp, q_data_size = bp_data.q_data_size, dim, X_loc_len;
591 PetscInt X_loc_len, dim;
592 CeedInt num_comp, q_data_size = bp_data.q_data_size;
592 CeedScalar R = 1; // radius of the sphere
593 CeedScalar l = 1.0 / PetscSqrtReal(3.0); // half edge of the inscribed cube
594 Vec X_loc;
595 PetscMemType X_mem_type;
596
597 PetscFunctionBeginUser;
598 PetscCall(DMSwarmGetCellDM(dm_swarm, &dm_mesh));
599 PetscCall(DMGetCoordinateDM(dm_mesh, &dm_coord));

--- 187 unchanged lines hidden ---
593 CeedScalar R = 1; // radius of the sphere
594 CeedScalar l = 1.0 / PetscSqrtReal(3.0); // half edge of the inscribed cube
595 Vec X_loc;
596 PetscMemType X_mem_type;
597
598 PetscFunctionBeginUser;
599 PetscCall(DMSwarmGetCellDM(dm_swarm, &dm_mesh));
600 PetscCall(DMGetCoordinateDM(dm_mesh, &dm_coord));

--- 187 unchanged lines hidden ---