v0.9.0
Public Member Functions | Public Attributes | List of all members
AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL > Struct Template Reference

Rhs operaetar used to build matrix. More...

#include <users_modules/helmholtz/src/AnalyticalDirihlet_obsolete.hpp>

Inherits UserDataOperator.

Collaboration diagram for AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >:
[legend]

Public Member Functions

 OpRhs (const string field_name, Range tris, MatrixDouble &ho_coords, boost::shared_ptr< FUNEVAL > function_evaluator, int field_number)
 
PetscErrorCode doWork (int side, EntityType type, DataForcesAndSurcesCore::EntData &data)
 

Public Attributes

Range tRis
 
MatrixDoublehoCoords
 
boost::shared_ptr< FUNEVAL > functionEvaluator
 
int fieldNumber
 
VectorDouble NTf
 
VectorInt iNdices
 

Detailed Description

template<typename FUNEVAL>
struct AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >

Rhs operaetar used to build matrix.

Definition at line 225 of file AnalyticalDirihlet_obsolete.hpp.

Constructor & Destructor Documentation

◆ OpRhs()

template<typename FUNEVAL >
AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >::OpRhs ( const string  field_name,
Range  tris,
MatrixDouble ho_coords,
boost::shared_ptr< FUNEVAL >  function_evaluator,
int  field_number 
)

Member Function Documentation

◆ doWork()

template<typename FUNEVAL >
PetscErrorCode AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >::doWork ( int  side,
EntityType  type,
DataForcesAndSurcesCore::EntData data 
)

Definition at line 242 of file AnalyticalDirihlet_obsolete.hpp.

243  {
244  PetscFunctionBegin;
245  PetscErrorCode ierr;
246 
247  try {
248 
249  unsigned int nb_row = data.getIndices().size();
250  if(nb_row==0) PetscFunctionReturn(0);
251  if(tRis.find(getMoFEMFEPtr()->get_ent()) == tRis.end()) {
252  PetscFunctionReturn(0);
253  }
254 
255  const FENumeredDofMoFEMEntity *dof_ptr;
256  ierr = getMoFEMFEPtr()->get_row_dofs_by_petsc_gloabl_dof_idx(data.getIndices()[0],&dof_ptr); CHKERRQ(ierr);
257  unsigned int rank = dof_ptr->get_max_rank();
258 
259  NTf.resize(nb_row/rank);
260  iNdices.resize(nb_row/rank);
261 
262  for(unsigned int gg = 0;gg<data.getN().size1();gg++) {
263 
264  double x,y,z;
265  double val = getGaussPts()(2,gg);
266  if(hoCoords.size1() == data.getN().size1()) {
267  double area = norm_2(getNormals_at_GaussPt(gg))*0.5;
268  val *= area;
269  x = hoCoords(gg,0);
270  y = hoCoords(gg,1);
271  z = hoCoords(gg,2);
272  } else {
273  val *= getArea();
274  x = getCoordsAtGaussPts()(gg,0);
275  y = getCoordsAtGaussPts()(gg,1);
276  z = getCoordsAtGaussPts()(gg,2);
277  }
278 
279  VectorDouble a;
280  try {
281 
282  a = (*functionEvaluator)(x,y,z)[fieldNumber];
283 
284  } catch (exception& ex) {
285  ostringstream ss;
286  ss << "thorw in method: " << ex.what() << " at line " << __LINE__ << " in file " << __FILE__;
287  SETERRQ(PETSC_COMM_SELF,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
288  }
289  if(a.size()!=rank) {
290  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCT,"data inconsistency");
291  }
292 
293 
294  for(unsigned int rr = 0;rr<rank;rr++) {
295 
296  ublas::noalias(iNdices) = ublas::vector_slice<VectorInt >
297  (data.getIndices(), ublas::slice(rr, rank, data.getIndices().size()/rank));
298 
299  noalias(NTf) = data.getN(gg,nb_row/rank)*a[rr]*val;
300  ierr = VecSetValues(getFEMethod()->snes_f,iNdices.size(),
301  &iNdices[0],&*NTf.data().begin(),ADD_VALUES); CHKERRQ(ierr);
302 
303  }
304 
305  }
306 
307 
308  } catch (const std::exception& ex) {
309  ostringstream ss;
310  ss << "throw in method: " << ex.what() << endl;
311  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
312  }
313 
314  PetscFunctionReturn(0);
315  }
CHKERRQ(ierr)
MoFEMErrorCode VecSetValues(Vec V, const DataForcesAndSourcesCore::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
ublas::vector< double, DoubleAllocator > VectorDouble
Definition: Types.hpp:72

Member Data Documentation

◆ fieldNumber

template<typename FUNEVAL >
int AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >::fieldNumber

Definition at line 230 of file AnalyticalDirihlet_obsolete.hpp.

◆ functionEvaluator

template<typename FUNEVAL >
boost::shared_ptr<FUNEVAL> AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >::functionEvaluator

Definition at line 229 of file AnalyticalDirihlet_obsolete.hpp.

◆ hoCoords

template<typename FUNEVAL >
MatrixDouble& AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >::hoCoords

Definition at line 228 of file AnalyticalDirihlet_obsolete.hpp.

◆ iNdices

template<typename FUNEVAL >
VectorInt AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >::iNdices

Definition at line 240 of file AnalyticalDirihlet_obsolete.hpp.

◆ NTf

template<typename FUNEVAL >
VectorDouble AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >::NTf

Definition at line 239 of file AnalyticalDirihlet_obsolete.hpp.

◆ tRis

template<typename FUNEVAL >
Range AnalyticalDirihletBC::ApproxField::OpRhs< FUNEVAL >::tRis

Definition at line 227 of file AnalyticalDirihlet_obsolete.hpp.


The documentation for this struct was generated from the following file: