782 {
783
785
788 const double *array;
789 CHKERR VecGetArrayRead(internal, &array);
790
793
794 std::vector<int> ghosts(nb_coefficients);
795 for (
int g = 0;
g != nb_coefficients; ++
g)
797
802 &*ghosts.begin(), &
v);
803
806
807 const int id = it->getMeshsetId();
809 reaction_vec.resize(nb_coefficients);
810 reaction_vec.clear();
811
813 for (int dim = 0; dim != 3; ++dim) {
816 true);
819 verts.insert(nodes.begin(), nodes.end());
820 }
821
822 auto for_each_dof = [&](auto &dof) {
824 reaction_vec[dof->getDofCoeffIdx()] += array[dof->getPetscLocalDofIdx()];
826 };
827
830 verts, for_each_dof);
831
832 double *res_array;
833
834 CHKERR VecGetArray(
v, &res_array);
835 for (
int dd = 0;
dd != reaction_vec.size(); ++
dd)
836 res_array[dd] = reaction_vec[dd];
837 CHKERR VecRestoreArray(
v, &res_array);
838
839 CHKERR VecGetArray(
v, &res_array);
840 for (
int dd = 0;
dd != reaction_vec.size(); ++
dd)
841 reaction_vec[dd] = res_array[dd];
842 CHKERR VecRestoreArray(
v, &res_array);
843 }
844
845 CHKERR VecGhostUpdateBegin(
v, ADD_VALUES, SCATTER_REVERSE);
846 CHKERR VecGhostUpdateEnd(
v, ADD_VALUES, SCATTER_REVERSE);
847 CHKERR VecGhostUpdateBegin(
v, INSERT_VALUES, SCATTER_FORWARD);
848 CHKERR VecGhostUpdateEnd(
v, INSERT_VALUES, SCATTER_FORWARD);
849
851 CHKERR VecRestoreArrayRead(internal, &array);
853}
static MoFEMErrorCode set_numered_dofs_on_ents(const Problem *problem_ptr, const FieldBitNumber bit_number, Range &ents, boost::function< MoFEMErrorCode(const boost::shared_ptr< MoFEM::NumeredDofEntity > &dof)> for_each_dof)
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
virtual const Problem * get_problem(const std::string problem_name) const =0
Get the problem object.
virtual const Field * get_field_structure(const std::string &name, enum MoFEMTypes bh=MF_EXIST) const =0
get field structure
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
const double v
phase velocity of light in medium (cm/ns)
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
virtual FieldBitNumber get_field_bit_number(const std::string name) const =0
get field bit number
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
FieldCoefficientsNumber getNbOfCoeffs() const
Get number of field coefficients.
keeps basic data about problem
ReactionsMap reactionsMap