25 for (
int i = 0; i < D.
Size(); i++)
40 for (
int i = 0; i < D.
Size(); i++)
52 int dim, ndof1, ndof2, ndof, ndoftotal;
60 ndof1 : ndof1 + ndof2;
69 marker1 = (*elem_marker)[elem1];
83 marker2 = (*elem_marker)[elem2];
89 if (marker1 == ShiftedFaceMarker::SBElementType::INSIDE &&
97 marker2 == ShiftedFaceMarker::SBElementType::INSIDE)
111 (marker2 == ShiftedFaceMarker::SBElementType::OUTSIDE ||
117 else if (marker1 == ShiftedFaceMarker::SBElementType::OUTSIDE &&
129 ndof = elem1f ? ndof1 : ndof2;
142 Vector dshapephysdd(ndof);
171 for (
int i = 0; i <
dim; i++)
174 grad_phys_dir[i]->CopyRows(grad_phys, i*ndof, (i+1)*ndof-1);
178 grad_phys_work.
SetSize(ndof, ndof*dim);
182 for (
int i = 0; i <
nterms; i++)
184 int sz1 =
static_cast<int>(pow(dim, i+1));
185 dkphi_dxk[i] =
new DenseMatrix(ndof, ndof*sz1*dim);
186 int loc_col_per_dof = sz1;
187 int tot_col_per_dof = loc_col_per_dof*
dim;
188 for (
int k = 0; k <
dim; k++)
190 grad_work.
SetSize(ndof, ndof*sz1);
196 Mult(*grad_phys_dir[k], grad_phys_work, grad_work);
200 Mult(*grad_phys_dir[k], *dkphi_dxk[i-1], grad_work);
204 for (
int j = 0; j < ndof; j++)
206 for (
int d = 0; d < loc_col_per_dof; d++)
209 grad_work.
GetColumn(j*loc_col_per_dof+d, col);
210 dkphi_dxk[i]->SetCol(j*tot_col_per_dof+k*loc_col_per_dof+d, col);
216 for (
int i = 0; i < grad_phys_dir.
Size(); i++)
218 delete grad_phys_dir[i];
223 for (
int i = 1; i <
nterms; i++)
225 Factorial(i) = Factorial(i-1)*(i+2);
231 Vector q_hess_dot_d(ndof);
251 nor(0) = 2*eip1.
x - 1.0;
262 if (!elem1f) {
nor *= -1; }
291 for (
int i = 0; i <
nterms; i++)
293 int sz1 =
static_cast<int>(pow(dim, i+1));
296 dkphi_dxk[i]->MultTranspose(
shape, T1_wrk);
300 for (
int j = 0; j < i+1; j++)
302 int sz2 =
static_cast<int>(pow(dim, i-j));
308 Vector q_hess_dot_d_work(ndof);
310 q_hess_dot_d_work *= 1./Factorial(i);
311 q_hess_dot_d += q_hess_dot_d_work;
328 int offset = elem1f ? 0 : ndof1;
329 elmat.
CopyMN(temp_elmat, offset, offset);
331 for (
int i = 0; i < dkphi_dxk.
Size(); i++)
341 mfem_error(
"SBM2DirichletLFIntegrator::AssembleRHSElementVect");
354 int dim, ndof1, ndof2, ndof, ndoftotal;
361 ndoftotal = ndof1 + ndof2;
374 marker1 = (*elem_marker)[elem1];
388 marker2 = (*elem_marker)[elem2];
394 if ( marker1 == ShiftedFaceMarker::SBElementType::INSIDE &&
403 marker2 == ShiftedFaceMarker::SBElementType::INSIDE)
418 (marker2 == ShiftedFaceMarker::SBElementType::OUTSIDE ||
425 else if (marker1 == ShiftedFaceMarker::SBElementType::OUTSIDE &&
438 int offset = elem1f ? 0 : ndof1;
477 for (
int i = 0; i <
dim; i++)
480 grad_phys_dir[i]->CopyRows(grad_phys, i*ndof, (i+1)*ndof-1);
485 grad_phys_work.
SetSize(ndof, ndof*dim);
489 for (
int i = 0; i <
nterms; i++)
491 int sz1 =
static_cast<int>(pow(dim, i+1));
492 dkphi_dxk[i] =
new DenseMatrix(ndof, ndof*sz1*dim);
493 int loc_col_per_dof = sz1;
494 for (
int k = 0; k <
dim; k++)
496 grad_work.
SetSize(ndof, ndof*sz1);
502 Mult(*grad_phys_dir[k], grad_phys_work, grad_work);
506 Mult(*grad_phys_dir[k], *dkphi_dxk[i-1], grad_work);
510 for (
int j = 0; j < ndof; j++)
512 for (
int d = 0; d < loc_col_per_dof; d++)
515 int tot_col_per_dof = loc_col_per_dof*
dim;
516 grad_work.
GetColumn(j*loc_col_per_dof+d, col);
517 dkphi_dxk[i]->SetCol(j*tot_col_per_dof+k*loc_col_per_dof+d, col);
523 for (
int i = 0; i < grad_phys_dir.
Size(); i++)
525 delete grad_phys_dir[i];
530 for (
int i = 1; i <
nterms; i++)
532 Factorial(i) = Factorial(i-1)*(i+2);
538 Vector q_hess_dot_d(ndof);
558 nor(0) = 2*eip.
x - 1.0;
567 if (!elem1f) {
nor *= -1; }
610 for (
int i = 0; i <
nterms; i++)
612 int sz1 =
static_cast<int>(pow(dim, i+1));
615 dkphi_dxk[i]->MultTranspose(
shape, T1_wrk);
619 for (
int j = 0; j < i+1; j++)
621 int sz2 =
static_cast<int>(pow(dim, i-j));
627 Vector q_hess_dot_d_work(ndof);
629 q_hess_dot_d_work *= 1./Factorial(i);
630 q_hess_dot_d += q_hess_dot_d_work;
636 temp_elvect.
Add(w, wrk);
639 for (
int i = 0; i < dkphi_dxk.
Size(); i++)
650 int dim, ndof1, ndof2, ndof, ndoftotal;
658 ndof1 : ndof1 + ndof2;
667 marker1 = (*elem_marker)[elem1];
682 marker2 = (*elem_marker)[elem2];
688 if (marker1 == ShiftedFaceMarker::SBElementType::INSIDE &&
696 marker2 == ShiftedFaceMarker::SBElementType::INSIDE)
710 (marker2 == ShiftedFaceMarker::SBElementType::OUTSIDE ||
716 else if (marker1 == ShiftedFaceMarker::SBElementType::OUTSIDE &&
728 ndof = elem1f ? ndof1 : ndof2;
768 for (
int i = 0; i <
dim; i++)
771 grad_phys_dir[i]->CopyRows(grad_phys, i*ndof, (i+1)*ndof-1);
775 grad_phys_work.
SetSize(ndof, ndof*dim);
779 for (
int i = 0; i <
nterms; i++)
781 int sz1 =
static_cast<int>(pow(dim, i+1));
782 dkphi_dxk[i] =
new DenseMatrix(ndof, ndof*sz1*dim);
783 int loc_col_per_dof = sz1;
784 int tot_col_per_dof = loc_col_per_dof*
dim;
785 for (
int k = 0; k <
dim; k++)
787 grad_work.
SetSize(ndof, ndof*sz1);
793 Mult(*grad_phys_dir[k], grad_phys_work, grad_work);
797 Mult(*grad_phys_dir[k], *dkphi_dxk[i-1], grad_work);
801 for (
int j = 0; j < ndof; j++)
803 for (
int d = 0; d < loc_col_per_dof; d++)
806 grad_work.
GetColumn(j*loc_col_per_dof+d, col);
807 dkphi_dxk[i]->SetCol(j*tot_col_per_dof+k*loc_col_per_dof+d, col);
813 for (
int i = 0; i < grad_phys_dir.
Size(); i++)
815 delete grad_phys_dir[i];
820 for (
int i = 1; i <
nterms; i++)
822 Factorial(i) = Factorial(i-1)*(i+1);
829 Vector q_hess_dot_d_nhat(ndof);
848 nor(0) = 2*eip1.
x - 1.0;
857 vN->
Eval(Nhat, Trans, ip, D);
860 if (!elem1f) {
nor *= -1; }
887 double n_dot_ntilde =
nor*Nhat;
894 q_hess_dot_d_nhat = 0.;
895 for (
int i = 0; i <
nterms; i++)
897 int sz1 =
static_cast<int>(pow(dim, i+1));
900 dkphi_dxk[i]->MultTranspose(
shape, T1_wrk);
904 for (
int j = 0; j < i+1; j++)
906 int sz2 =
static_cast<int>(pow(dim, i-j));
912 Vector q_hess_dot_d_work(ndof);
914 q_hess_dot_d_work *= 1./Factorial(i);
915 q_hess_dot_d_nhat += q_hess_dot_d_work;
918 wrk = q_hess_dot_d_nhat;
919 wrk *= ip.
weight * n_dot_ntilde;
923 int offset = elem1f ? 0 : ndof1;
924 elmat.
CopyMN(temp_elmat, offset, offset);
926 for (
int i = 0; i < dkphi_dxk.
Size(); i++)
935 mfem_error(
"SBM2NeumannLFIntegrator::AssembleRHSElementVect");
948 int dim, ndof1, ndof2, ndof, ndoftotal;
955 ndoftotal = ndof1 + ndof2;
968 marker1 = (*elem_marker)[elem1];
982 marker2 = (*elem_marker)[elem2];
987 if ( marker1 == ShiftedFaceMarker::SBElementType::INSIDE &&
996 marker2 == ShiftedFaceMarker::SBElementType::INSIDE)
1011 (marker2 == ShiftedFaceMarker::SBElementType::OUTSIDE ||
1018 else if (marker1 == ShiftedFaceMarker::SBElementType::OUTSIDE &&
1031 int offset = elem1f ? 0 : ndof1;
1062 nor(0) = 2*eip.
x - 1.0;
1069 vN->
Eval(Nhat, Tr, ip, D);
1072 if (!elem1f) {
nor *= -1; }
1085 double n_dot_ntilde =
nor*Nhat;
1088 temp_elvect.
Add(1., wrk);
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for all finite elements.
int Size() const
Return the logical size of the array.
int GetDim() const
Returns the reference space dimension for the finite element.
Class for an integration rule - an Array of IntegrationPoint.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
void SetSize(int s)
Resize the vector to size s.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
ShiftedVectorFunctionCoefficient * vN
void CalcAdjugate(const DenseMatrix &a, DenseMatrix &adja)
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Data type dense matrix using column-major storage.
int Size() const
Returns the size of the vector.
double * GetData() const
Returns the matrix data array.
virtual void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
double * GetData() const
Return a pointer to the beginning of the Vector data.
void CalcOrtho(const DenseMatrix &J, Vector &n)
std::function< void(const Vector &, Vector &)> Function
int par_shared_face_count
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
void MultTranspose(const double *x, double *y) const
Multiply a vector with the transpose matrix.
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
ShiftedFunctionCoefficient * uN
void AddMult_a_VWt(const double a, const Vector &v, const Vector &w, DenseMatrix &VWt)
VWt += a * v w^t.
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
void AddMult_a_VVt(const double a, const Vector &v, DenseMatrix &VVt)
VVt += a * v v^t.
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
void CalcPhysDShape(ElementTransformation &Trans, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in physical space at the poi...
int GetVDim()
Returns dimension of the vector.
ShiftedVectorFunctionCoefficient * vN
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
void GetColumn(int c, Vector &col) const
double p(const Vector &x, double t)
int par_shared_face_count
int GetDof() const
Returns the number of degrees of freedom in the finite element.
int Find(const T &el) const
Return the first index where 'el' is found; return -1 if not found.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
Evaluate the coefficient in the element described by T at the point ip.
void SetDataAndSize(double *d, int s)
Set the Vector data and size.
Vector & Set(const double a, const Vector &x)
(*this) = a * x
std::function< double(const Vector &)> Function
Vector & Add(const double a, const Vector &Va)
(*this) += a * Va
Class for integration point with weight.
virtual void AssembleFaceMatrix(const FiniteElement &el1, const FiniteElement &el2, FaceElementTransformations &Trans, DenseMatrix &elmat)
void Mult(const double *x, double *y) const
Matrix vector multiplication.
int par_shared_face_count
void CopyMN(const DenseMatrix &A, int m, int n, int Aro, int Aco)
Copy the m x n submatrix of A at row/col offsets Aro/Aco to *this.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
int par_shared_face_count
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
virtual void AssembleRHSElementVect(const FiniteElement &el, ElementTransformation &Tr, Vector &elvect)
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
ShiftedFunctionCoefficient * uD