52 {
53 PetscFunctionBegin;
54
55 try {
56 if(row_data.getIndices().size()==0) PetscFunctionReturn(0);
57 if(col_data.getIndices().size()==0) PetscFunctionReturn(0);
58 if(col_type==MBVERTEX){
59
60
65
66 int num_nodes;
68 double coords_face[9];
69 EntityHandle face_tri = getNumeredEntFiniteElementPtr()->getEnt();
70
71
74
75 for(int nn=0; nn<3; nn++){
76 Mat_face(0,3*nn+1)=-coords_face[3*nn+2];
Mat_face(0,3*nn+2)= coords_face[3*nn+1];
77 Mat_face(1,3*nn+0)= coords_face[3*nn+2];
Mat_face(1,3*nn+2)=-coords_face[3*nn+0];
78 Mat_face(2,3*nn+0)=-coords_face[3*nn+1];
Mat_face(2,3*nn+1)= coords_face[3*nn+0];
79 }
80
81
82 int nb_rows=row_data.getIndices().size();
83 int nb_cols=col_data.getIndices().size();
85 Aij,nb_rows,&row_data.getIndices()[0],nb_cols,&col_data.getIndices()[0],&
Mat_face(0,0),ADD_VALUES
87
88
91 Aij,nb_cols,&col_data.getIndices()[0],nb_rows,&row_data.getIndices()[0],&
Mat_face_Tran(0,0),ADD_VALUES
93
94 }
95
96 } catch (const std::exception& ex) {
97 ostringstream ss;
98 ss << "throw in method: " << ex.what() << endl;
99 SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
100 }
101 PetscFunctionReturn(0);
102 }
static PetscErrorCode ierr
#define CHKERRQ_MOAB(a)
check error code of MoAB function
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
MatrixDouble Mat_face_Tran
virtual moab::Interface & get_moab()=0