29 const int bufflen = 256;
34 input.getline(buff, bufflen);
35 if (strcmp(buff,
"FiniteElementSpace"))
37 " input stream is not a GridFunction!");
38 input.getline(buff, bufflen,
' ');
40 input.getline(buff, bufflen);
42 input.getline(buff, bufflen,
' ');
44 input.getline(buff, bufflen,
' ');
47 input.getline(buff, bufflen);
74 int g_nddofs = g_ndofs - (g_nvdofs + g_nedofs + g_nfdofs);
76 vi = ei = fi = di = 0;
77 for (
int i = 0; i < num_pieces; i++)
84 int l_nddofs = l_ndofs - (l_nvdofs + l_nedofs + l_nfdofs);
85 const double *l_data = gf_array[i]->
GetData();
86 double *g_data =
data;
89 for (
int d = 0; d < vdim; d++)
91 memcpy(g_data+vi, l_data, l_nvdofs*
sizeof(
double));
94 memcpy(g_data+ei, l_data, l_nedofs*
sizeof(
double));
97 memcpy(g_data+fi, l_data, l_nfdofs*
sizeof(
double));
100 memcpy(g_data+di, l_data, l_nddofs*
sizeof(
double));
107 memcpy(g_data+vdim*vi, l_data, vdim*l_nvdofs*
sizeof(
double));
108 l_data += vdim*l_nvdofs;
109 g_data += vdim*g_nvdofs;
110 memcpy(g_data+vdim*ei, l_data, vdim*l_nedofs*
sizeof(
double));
111 l_data += vdim*l_nedofs;
112 g_data += vdim*g_nedofs;
113 memcpy(g_data+vdim*fi, l_data, vdim*l_nfdofs*
sizeof(
double));
114 l_data += vdim*l_nfdofs;
115 g_data += vdim*g_nfdofs;
116 memcpy(g_data+vdim*di, l_data, vdim*l_nddofs*
sizeof(
double));
117 l_data += vdim*l_nddofs;
118 g_data += vdim*g_nddofs;
182 int dof = FElem->
GetDof();
192 for (k = 0; k < n; k++)
195 nval[k] = shape * ((
const double *)loc_data + dof * vdim);
202 for (k = 0; k < n; k++)
206 nval[k] = loc_data * (&vshape(0,vdim));
221 return (DofVal * LocVec);
228 int dof = FElem->
GetDof();
239 for (
int k = 0; k < vdim; k++)
241 val(k) = shape * ((
const double *)loc_data + dof * k);
246 int dim = FElem->
GetDim();
265 int dof = FElem->
GetDof();
266 Vector DofVal(dof), loc_data(dof);
268 for (
int k = 0; k < n; k++)
271 vals(k) = DofVal * loc_data;
333 int dof = FElem->
GetDof();
344 for (
int j = 0; j < nip; j++)
348 for (
int k = 0; k < vdim; k++)
350 vals(k,j) = shape * ((
const double *)loc_data + dof * k);
356 int dim = FElem->
GetDim();
360 for (
int j = 0; j < nip; j++)
423 Vector shape, loc_values, orig_loc_values;
424 int i, j, d, ne, dof, odof, vdim;
428 for (i = 0; i < ne; i++)
437 loc_values.
SetSize(dof * vdim);
440 for (j = 0; j < dof; j++)
444 for (d = 0; d < vdim; d++)
446 loc_values(d*dof+j) =
447 shape * ((
const double *)orig_loc_values + d * odof) ;
460 Vector shape, loc_values, orig_loc_values;
461 int i, j, d, nbe, dof, odof, vdim;
465 for (i = 0; i < nbe; i++)
474 loc_values.
SetSize(dof * vdim);
477 for (j = 0; j < dof; j++)
481 for (d = 0; d < vdim; d++)
483 loc_values(d*dof+j) =
484 shape * ((
const double *)orig_loc_values + d * odof);
498 int d, j, k, n, dim, dof, ind;
505 int *dofs = &vdofs[comp*dof];
511 for (k = 0; k < n; k++)
516 for (d = 0; d < dim; d++)
519 for (j = 0; j < dof; j++)
520 if ( (ind=dofs[j]) >= 0 )
521 a += vshape(j, d) *
data[ind];
523 a -= vshape(j, d) *
data[-1-ind];
537 double *temp =
new double[
size];
540 for (j = 0; j < ndofs; j++)
541 for (i = 0; i < vdim; i++)
542 temp[j+i*ndofs] =
data[k++];
544 for (i = 0; i <
size; i++)
570 val(vertices[k]) += vals(k, comp);
571 overlap[vertices[k]]++;
575 for (i = 0; i < overlap.Size(); i++)
576 val(i) /= overlap[i];
583 int d, i, k, ind, dof;
591 for (i = 0; i < new_fes->
GetNE(); i++)
598 for (d = 0; d < fe->
GetDim(); d++)
599 for (k = 0; k < dof; k++)
601 if ( (ind=new_vdofs[dof*d+k]) < 0 )
602 ind = -1-ind, vals(k, d) = - vals(k, d);
603 vec_field(ind) += vals(k, d);
608 for (i = 0; i < overlap.Size(); i++)
609 vec_field(i) /= overlap[i];
620 int i, j, k, dim, dof, der_dof, ind;
623 for (i = 0; i < overlap.Size(); i++)
628 for (i = 0; i < der_fes->
GetNE(); i++)
637 der_dof = der_fe->
GetDof();
643 for (j = 0; j < dof; j++)
644 loc_func(j) = ( (ind=vdofs[comp*dof+j]) >= 0 ) ?
646 for (k = 0; k < der_dof; k++)
654 for (j = 0; j < dim; j++)
655 a += inv_jac(j, der_comp) * pt_grad(j);
656 der(der_dofs[k]) += a;
657 overlap[der_dofs[k]]++;
661 for (i = 0; i < overlap.Size(); i++)
662 der(i) /= overlap[i];
682 MultAtB(loc_data_mat, dshape, gh);
698 for (
int i = 0; i < Jinv.Width(); i++)
699 for (
int j = 0; j < Jinv.Height(); j++)
700 div_v += grad_hat(i, j) * Jinv(j, i);
710 div_v = (loc_data * divshape) / tr.
Weight();
728 dshape.MultTranspose(lval, gh);
749 dshape.MultTranspose(lval, gh);
753 Jinv.MultTranspose(gh, gcol);
766 Mult(grad_hat, Jinv, grad);
774 Vector loc_avgs, loc_this;
779 for (
int i = 0; i <
fes->
GetNE(); i++)
784 avgs.FESpace()->GetElementDofs(i, te_dofs);
787 loc_mass.
Mult(loc_this, loc_avgs);
788 avgs.AddElementVector(te_dofs, loc_avgs);
790 loc_mass.
Mult(loc_this, loc_avgs);
791 int_psi.AddElementVector(te_dofs, loc_avgs);
793 for (
int i = 0; i < avgs.Size(); i++)
794 avgs(i) /= int_psi(i);
810 mfem_error(
"GridFunction::ProjectGridFunction() :"
811 " incompatible vector dimensions!");
815 for (
int i = 0; i < mesh->
GetNE(); i++)
819 for (
int vd = 0; vd < vdim; vd++)
832 Vector vals, new_vals(size);
835 MFEM_ASSERT(weights.
Size() ==
size,
"Different # of weights and dofs.");
836 MFEM_ASSERT(_lo.
Size() ==
size,
"Different # of lower bounds and dofs.");
837 MFEM_ASSERT(_hi.
Size() ==
size,
"Different # of upper bounds and dofs.");
848 slbqp.
Mult(vals, new_vals);
854 double _min,
double _max)
859 Vector vals, new_vals(size);
862 double max_val = vals.
Max();
863 double min_val = vals.
Min();
872 if(_min <= min_val && max_val <= _max)
875 Vector minv(size), maxv(size);
876 minv = (_min > min_val) ? _min : min_val;
877 maxv = (_max < max_val) ? _max : max_val;
896 for (j = 0; j < vertices.
Size(); j++)
898 nval(vertices[j]) += values[j];
899 overlap[vertices[j]]++;
902 for (i = 0; i < overlap.Size(); i++)
903 nval(i) /= overlap[i];
917 const double *center = delta_coeff.
Center();
919 double min_dist, dist;
923 min_dist =
Distance(center, vert, dim);
924 for (
int i = 0; i < mesh->
GetNV(); i++)
938 if (min_dist >= delta_coeff.
Tol())
945 Vector vals, loc_mass_vals;
946 for (
int i = 0; i < mesh->
GetNE(); i++)
949 for (
int j = 0; j < vertices.
Size(); j++)
950 if (vertices[j] == v_idx)
960 loc_mass.Mult(vals, loc_mass_vals);
961 integral += loc_mass_vals.
Sum();
976 for (
int i = 0; i <
fes->
GetNE(); i++)
990 (*this) *= (delta_c->
Scale() / integral);
1001 for (
int i = 0; i < dofs.
Size(); i++)
1014 (*this)(vdof) = coeff.
Eval(*T, ip);
1035 int i, j, fdof, d, ind, vdim;
1049 for (j = 0; j < fdof; j++)
1053 for (d = 0; d < vdim; d++)
1055 val = coeff[d]->
Eval(*transf, ip);
1056 if ( (ind = vdofs[fdof*d+j]) < 0 )
1057 val = -val, ind = -1-ind;
1067 int i, j, fdof, d, ind, vdim;
1083 for (j = 0; j < fdof; j++)
1087 for (d = 0; d < vdim; d++)
1089 val = coeff[d]->
Eval(*transf, ip);
1090 if ( (ind = vdofs[fdof*d+j]) < 0 )
1091 val = -val, ind = -1-ind;
1114 for (i = 0; i < mesh->
GetNBE(); i++)
1119 for (j = 0; j < edges.
Size(); j++)
1124 int edge = edges[j];
1127 const int *ev = edge_vertex->
GetRow(edge);
1132 if (vdofs.
Size() == 0)
1138 for (d = 0; d < vdim; d++)
1140 fe->
Project(*coeff[d], *transf, vals);
1141 for (
int k = 0; k < vals.
Size(); k++)
1142 (*
this)(vdofs[d*vals.
Size()+k]) = vals(k);
1160 Vector vc(dim), nor(dim), lvec, shape;
1178 vcoeff.
Eval(vc, *T, ip);
1181 lvec.
Add(ip.
weight * (vc * nor), shape);
1193 Vector vc(dim), nor(dim), lvec;
1207 vcoeff.
Eval(vc, *T, ip);
1209 lvec(j) = (vc * nor);
1233 fe->
Project(vcoeff, *T, lvec);
1241 double error = 0.0, a;
1246 int fdof, d, i, intorder, j, k;
1268 for (k = 0; k < fdof; k++)
1269 if (vdofs[fdof*d+k] >= 0)
1270 a += (*this)(vdofs[fdof*d+k]) * shape(k);
1272 a -= (*this)(-1-vdofs[fdof*d+k]) * shape(k);
1274 a -= exsol[d]->
Eval(*transf, ip);
1281 return -sqrt(-error);
1295 for (
int i = 0; i <
fes->
GetNE(); i++)
1297 if (elems != NULL && (*elems)[i] == 0)
continue;
1299 int intorder = 2*fe->
GetOrder() + 1;
1307 exsol.
Eval(exact_vals, *T, *ir);
1310 vals.
Norm2(loc_errs);
1315 error += ip.
weight * T->
Weight() * (loc_errs(j) * loc_errs(j));
1320 return -sqrt(-error);
1326 Coefficient *ell_coeff,
double Nu,
int norm_type)
const
1329 int i, fdof, dim, intorder, j, k;
1334 Vector e_grad, a_grad, shape, el_dofs, err_val, ell_coeff_val;
1347 for (i = 0; i < mesh->
GetNE(); i++)
1358 for (k = 0; k < fdof; k++)
1360 el_dofs(k) = (*this)(vdofs[k]);
1362 el_dofs(k) = - (*this)(-1-vdofs[k]);
1368 exgrad->
Eval(e_grad, *transf, ip);
1370 Mult(dshape, Jinv, dshapet);
1374 ell_coeff->
Eval(*transf, ip) *
1383 int i1 = face_elem_transf->
Elem1No;
1384 int i2 = face_elem_transf->
Elem2No;
1389 intorder = 2 * intorder;
1395 transf = face_elem_transf->
Elem1;
1401 for (k = 0; k < fdof; k++)
1403 el_dofs(k) = (*this)(vdofs[k]);
1405 el_dofs(k) = - (*this)(-1-vdofs[k]);
1411 ell_coeff_val(j) = ell_coeff->
Eval(*transf, eip);
1412 err_val(j) = exsol->
Eval(*transf, eip) - (shape * el_dofs);
1418 transf = face_elem_transf->
Elem2;
1424 for (k = 0; k < fdof; k++)
1426 el_dofs(k) = (*this)(vdofs[k]);
1428 el_dofs(k) = - (*this)(-1-vdofs[k]);
1434 ell_coeff_val(j) += ell_coeff->
Eval(*transf, eip);
1435 ell_coeff_val(j) *= 0.5;
1436 err_val(j) -= (exsol->
Eval(*transf, eip) - (shape * el_dofs));
1440 transf = face_elem_transf->
Face;
1445 error += (ip.
weight * Nu * ell_coeff_val(j) *
1446 pow(transf->
Weight(), 1.0-1.0/(dim-1)) *
1447 err_val(j) * err_val(j));
1452 return -sqrt(-error);
1459 double error = 0.0, a;
1464 int fdof, d, i, intorder, j, k;
1487 for (k = 0; k < fdof; k++)
1488 if (vdofs[fdof*d+k] >= 0)
1489 a += (*this)(vdofs[fdof*d+k]) * shape(k);
1491 a -= (*this)(-1-vdofs[fdof*d+k]) * shape(k);
1492 a -= exsol[d]->
Eval(*transf, ip);
1508 int i, fdof, dim, intorder, j, k;
1512 Vector e_grad, a_grad, shape, el_dofs, err_val, ell_coeff_val;
1515 double a, error = 0.0;
1524 for (i = 0; i < mesh->
GetNE(); i++)
1526 if (elems != NULL && (*elems)[i] == 0)
continue;
1539 for (k = 0; k < fdof; k++)
1541 el_dofs(k) = (*this)(vdofs[k]);
1543 el_dofs(k) = -(*this)(-1-vdofs[k]);
1549 a = (el_dofs * shape) - (exsol->
Eval(*transf, ip));
1555 for (i = 0; i < mesh->
GetNE(); i++)
1557 if (elems != NULL && (*elems)[i] == 0)
continue;
1571 for (k = 0; k < fdof; k++)
1573 el_dofs(k) = (*this)(vdofs[k]);
1575 el_dofs(k) = -(*this)(-1-vdofs[k]);
1581 exgrad->
Eval(e_grad, *transf, ip);
1583 Mult(dshape, Jinv, dshapet);
1602 for (
int i = 0; i <
fes->
GetNE(); i++)
1612 int intorder = 2*fe->
GetOrder() + 1;
1621 double err = fabs(vals(j) - exsol.
Eval(*T, ip));
1622 if (p < numeric_limits<double>::infinity())
1626 err *= weight->
Eval(*T, ip);
1632 err *= weight->
Eval(*T, ip);
1633 error = fmax(error, err);
1638 if (p < numeric_limits<double>::infinity())
1642 error = -pow(-error, 1./p);
1644 error = pow(error, 1./p);
1661 for (
int i = 0; i <
fes->
GetNE(); i++)
1671 int intorder = 2*fe->
GetOrder() + 1;
1676 exsol.
Eval(exact_vals, *T, *ir);
1683 vals.
Norm2(loc_errs);
1687 v_weight->
Eval(exact_vals, *T, *ir);
1690 for (
int j = 0; j < vals.
Width(); j++)
1693 for (
int d = 0; d < vals.
Height(); d++)
1694 err += vals(d,j)*exact_vals(d,j);
1695 loc_errs(j) = fabs(err);
1702 double err = loc_errs(j);
1703 if (p < numeric_limits<double>::infinity())
1707 err *= weight->
Eval(*T, ip);
1713 err *= weight->
Eval(*T, ip);
1714 error = fmax(error, err);
1719 if (p < numeric_limits<double>::infinity())
1723 error = -pow(-error, 1./p);
1725 error = pow(error, 1./p);
1733 for (
int i = 0; i <
size; i++)
1740 for (
int i = 0; i <
size; i++)
1793 static_cast<Vector&
>(*this) = x;
1818 out <<
"SCALARS " << field_name <<
" double 1\n"
1819 <<
"LOOKUP_TABLE default\n";
1820 for (
int i = 0; i < mesh->
GetNE(); i++)
1827 for (
int j = 0; j < val.
Size(); j++)
1829 out << val(j) <<
'\n';
1836 out <<
"VECTORS " << field_name <<
" double\n";
1837 for (
int i = 0; i < mesh->
GetNE(); i++)
1844 for (
int j = 0; j < vval.
Width(); j++)
1846 out << vval(0, j) <<
' ' << vval(1, j) <<
' ';
1858 for (
int vd = 0; vd < vec_dim; vd++)
1860 out <<
"SCALARS " << field_name << vd <<
" double 1\n"
1861 <<
"LOOKUP_TABLE default\n";
1862 for (
int i = 0; i < mesh->
GetNE(); i++)
1869 for (
int j = 0; j < val.
Size(); j++)
1871 out << val(j) <<
'\n';
1881 double v1[3] = { p2[0] - p1[0], p2[1] - p1[1], p2[2] - p1[2] };
1882 double v2[3] = { p3[0] - p1[0], p3[1] - p1[1], p3[2] - p1[2] };
1883 double n[] = { v1[1] * v2[2] - v1[2] * v2[1],
1884 v1[2] * v2[0] - v1[0] * v2[2],
1885 v1[0] * v2[1] - v1[1] * v2[0] };
1886 double rl = 1.0 / sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
1887 n[0] *= rl; n[1] *= rl; n[2] *= rl;
1889 out <<
" facet normal " << n[0] <<
' ' << n[1] <<
' ' << n[2]
1891 <<
"\n vertex " << p1[0] <<
' ' << p1[1] <<
' ' << p1[2]
1892 <<
"\n vertex " << p2[0] <<
' ' << p2[1] <<
' ' << p2[2]
1893 <<
"\n vertex " << p3[0] <<
' ' << p3[1] <<
' ' << p3[2]
1894 <<
"\n endloop\n endfacet\n";
1908 double pts[4][3], bbox[3][2];
1910 out <<
"solid GridFunction\n";
1912 bbox[0][0] = bbox[0][1] = bbox[1][0] = bbox[1][1] =
1913 bbox[2][0] = bbox[2][1] = 0.0;
1914 for (i = 0; i < mesh->
GetNE(); i++)
1921 for (k = 0; k < RG.
Size()/n; k++)
1923 for (j = 0; j < n; j++)
1926 pts[j][0] = pointmat(0,l);
1927 pts[j][1] = pointmat(1,l);
1928 pts[j][2] = values(l);
1944 bbox[0][0] = pointmat(0,0);
1945 bbox[0][1] = pointmat(0,0);
1946 bbox[1][0] = pointmat(1,0);
1947 bbox[1][1] = pointmat(1,0);
1948 bbox[2][0] = values(0);
1949 bbox[2][1] = values(0);
1952 for (j = 0; j < values.
Size(); j++)
1954 if (bbox[0][0] > pointmat(0,j))
1955 bbox[0][0] = pointmat(0,j);
1956 if (bbox[0][1] < pointmat(0,j))
1957 bbox[0][1] = pointmat(0,j);
1958 if (bbox[1][0] > pointmat(1,j))
1959 bbox[1][0] = pointmat(1,j);
1960 if (bbox[1][1] < pointmat(1,j))
1961 bbox[1][1] = pointmat(1,j);
1962 if (bbox[2][0] > values(j))
1963 bbox[2][0] = values(j);
1964 if (bbox[2][1] < values(j))
1965 bbox[2][1] = values(j);
1969 cout <<
"[xmin,xmax] = [" << bbox[0][0] <<
',' << bbox[0][1] <<
"]\n"
1970 <<
"[ymin,ymax] = [" << bbox[1][0] <<
',' << bbox[1][1] <<
"]\n"
1971 <<
"[zmin,zmax] = [" << bbox[2][0] <<
',' << bbox[2][1] <<
']'
1974 out <<
"endsolid GridFunction" << endl;
1994 nfe = ufes->
GetNE();
2002 for (i = 0; i < overlap.Size(); i++)
2005 for (i = 0; i < nfe; i++)
2006 if (sd < 0 || ufes->GetAttribute(i) == sd)
2012 for (j = 0; j < ul.
Size(); j++)
2013 ul(j) = u(udofs[j]);
2017 *ffes->
GetFE(i), fl, wcoef);
2021 for (j = 0; j < fdofs.
Size(); j++)
2022 overlap[fdofs[j]]++;
2025 for (i = 0; i < overlap.Size(); i++)
2026 if (overlap[i] != 0)
2027 flux(i) /= overlap[i];
2046 int i, j, s, nfe, nsd;
2052 nfe = ufes->
GetNE();
2061 for (i = 0; i < nfe; i++)
2065 for (s = 1; s <= nsd; s++)
2072 for (i = 0; i < nfe; i++)
2079 for (j = 0; j < ul.
Size(); j++)
2080 ul(j) = u(udofs[j]);
2083 for (j = 0; j < fla.
Size(); j++)
2084 fla(j) = flux(fdofs[j]);
2088 *ffes->
GetFE(i), fl, 0);
2105 return sol_in.
Eval(*T_in, ip);
2116 string cname = name;
2117 if (cname ==
"Linear")
2119 else if (cname ==
"Quadratic")
2121 else if (cname ==
"Cubic")
2123 else if (!strncmp(name,
"H1_", 3))
2125 else if (!strncmp(name,
"L2_T", 4))
2127 else if (!strncmp(name,
"L2_", 3))
2131 cerr <<
"Extrude1DGridFunction : unknown FE collection : "
int GetNPoints() const
Returns the number of the points in the integration rule.
void SaveSTLTri(std::ostream &out, double p1[], double p2[], double p3[])
Abstract class for Finite Elements.
std::ostream & operator<<(std::ostream &out, const Mesh &mesh)
int Size() const
Logical size of the array.
int GetDim() const
Returns the space dimension for the finite element.
int GetAttribute(int i) const
int GetNDofs() const
Returns number of degrees of freedom.
Class for integration rule.
int GetBdrAttribute(int i) const
Return the attribute of boundary element i.
const double * GetVertex(int i) const
Return pointer to vertex i's coordinates.
void NewDataAndSize(double *d, int s)
Class for grid function - Vector with associated FE space.
Table * GetEdgeVertexTable() const
Returns the edge-to-vertex Table (3D)
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Class used for extruding scalar GridFunctions.
void ComputeFlux(BilinearFormIntegrator &blfi, GridFunction &u, GridFunction &flux, int wcoef, int sd)
void GetElementVertices(int i, Array< int > &vertices) const
Returns the vertices of element i.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
void MergeGridFunctions(GridFunction *gf_array[], int num_pieces, GridFunction &merged)
void ProjectDeltaCoefficient(DeltaCoefficient &delta_coeff, double &integral)
virtual void Project(Coefficient &coeff, ElementTransformation &Trans, Vector &dofs) const
void Print(std::ostream &out=std::cout, int width=8) const
Prints vector to stream out.
void ConformingProlongate()
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
void GetVectorValue(int i, const IntegrationPoint &ip, Vector &val) const
void SetSize(int s)
Resizes the vector if the new size is different.
int GetNBE() const
Returns number of boundary elements.
GridFunction * Extrude1DGridFunction(Mesh *mesh, Mesh *mesh2d, GridFunction *sol, const int ny)
Extrude a scalar 1D GridFunction, after extruding the mesh with Extrude1D.
void MakeOwner(FiniteElementCollection *_fec)
Make the GridFunction the owner of 'fec' and 'fes'.
void GetVectorGradientHat(ElementTransformation &T, DenseMatrix &gh)
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols.
int GetElementBaseGeometry(int i) const
void GetBdrValuesFrom(GridFunction &)
void GetGradient(ElementTransformation &tr, Vector &grad)
RefinedGeometry * Refine(int Geom, int Times, int ETimes=1)
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
void StealData(double **p)
Changes the ownership of the data; after the call the Vector is empty.
int GetOrder() const
Returns the order of the finite element.
Coefficient defined by a GridFunction. This coefficient is mesh dependent.
Piecewise-(bi)linear continuous finite elements.
Delta function coefficient.
void ImposeBounds(int i, const Vector &weights, const Vector &_lo, const Vector &_hi)
int Size() const
Returns the size of the vector.
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
int GetBdrAttribute(int i) const
int GetNE() const
Returns number of elements.
void GetElementVertices(int i, Array< int > &dofs) const
Returns the indices of the dofs of element i.
int GetNV() const
Returns number of nodes in the mesh.
void CalcOrtho(const DenseMatrix &J, Vector &n)
void GetNodalValues(int i, Array< double > &nval, int vdim=1) const
Returns the values in the vertices of i'th element for dimension vdim.
FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31)
const IntegrationRule * GetVertices(int GeomType)
void GetEdgeTransformation(int i, IsoparametricTransformation *EdTr)
void GetVectorFieldNodalValues(Vector &val, int comp) const
SparseMatrix * GetConformingProlongation()
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
friend void Mult(const DenseMatrix &b, const DenseMatrix &c, DenseMatrix &a)
Matrix matrix multiplication. A = B * C.
void Load(std::istream **in, int np, int *dim)
Reads a vector from multiple files.
Piecewise-(bi)cubic continuous finite elements.
int GetNE() const
Returns number of elements in the mesh.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)
double ComputeMaxError(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
void ZZErrorEstimator(BilinearFormIntegrator &blfi, GridFunction &u, GridFunction &flux, Vector &ErrorEstimates, int wsd)
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
void GetDerivative(int comp, int der_comp, GridFunction &der)
void MultTranspose(const double *x, double *y) const
Multiply a vector with the transpose matrix.
void ProjectBdrCoefficientNormal(VectorCoefficient &vcoeff, Array< int > &bdr_attr)
void SetLinearConstraint(const Vector &_w, double _a)
double GetDivergence(ElementTransformation &tr)
const FiniteElement * GetEdgeElement(int i) const
virtual ~GridFunction()
Destroys grid function.
IntegrationRules IntRules(0)
A global object with all integration rules (defined in intrules.cpp)
void SetPrintLevel(int print_lvl)
double ComputeL2Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
int GetNBE() const
Returns number of boundary elements in the mesh.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows.
Mesh * GetMesh() const
Returns the mesh.
void GetVectorFieldValues(int i, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr, int comp=0) const
double ComputeH1Error(Coefficient *exsol, VectorCoefficient *exgrad, Coefficient *ell_coef, double Nu, int norm_type) const
void SetMaxIter(int max_it)
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
void Norm2(double *v) const
Take the 2-norm of the columns of A and store in v.
virtual void GetElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
void GetBdrElementEdges(int i, Array< int > &, Array< int > &) const
Return the indices and the orientations of all edges of bdr element i.
const IntegrationRule & GetNodes() const
GeometryRefiner GlobGeometryRefiner
ElementTransformation * GetBdrElementTransformation(int i) const
Returns ElementTransformation for the i'th boundary element.
void GetValues(int i, const IntegrationRule &ir, Vector &vals, int vdim=1) const
int GetVDim()
Returns dimension of the vector.
int GetVDim() const
Returns vector dimension.
A class for non-conforming AMR on higher-order hexahedral, quadrilateral or triangular meshes...
FiniteElementSpace * FESpace()
void AddElementVector(const Array< int > &dofs, const Vector &elemvect)
Add (element) subvector to the vector.
double ComputeLpError(const double p, Coefficient &exsol, Coefficient *weight=NULL, const IntegrationRule *irs[]=NULL) const
void GetBdrElementVDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom for i'th boundary element.
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
int GetGeomType() const
Returns the geometry type:
int GetLocalDofForDof(int i)
int GetOrdering() const
Return the ordering method.
int GetElementForDof(int i)
double Min() const
Returns the minimal element of the vector.
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i'th element.
double Norml1() const
Returns the l_1 norm of the vector.
bool FaceIsInterior(int FaceNo) const
Return true if the given face is interior.
void SetAbsTol(double atol)
void SetRelTol(double rtol)
double Distance(const double *x, const double *y, const int n)
Abstract finite element space.
int GetDof() const
Returns the degrees of freedom in the FE space.
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
Base class Coefficient that may optionally depend on time.
FiniteElementSpace * fes
FE space on which grid function lives.
void ProjectGridFunction(const GridFunction &src)
void mfem_error(const char *msg)
void SetSize(int nsize)
Change logical size of the array, keep existing entries.
void SetSubVector(const Array< int > &dofs, const Vector &elemvect)
void GetColumnReference(int c, Vector &col)
void GetElementVDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
FiniteElementCollection * fec
Used when the grid function is read from a file.
int GetFaceVectorValues(int i, int side, const IntegrationRule &ir, DenseMatrix &vals, DenseMatrix &tr) const
static FiniteElementCollection * New(const char *name)
void SetBounds(const Vector &_lo, const Vector &_hi)
virtual void GetBdrElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom for i'th boundary element.
NURBSExtension * NURBSext
virtual const char * Name() const
Vector & Add(const double a, const Vector &Va)
(*this) += a * Va
Class for integration point with weight.
void SaveSTL(std::ostream &out, int TimesToRefine=1)
void GetElementTransformation(int i, IsoparametricTransformation *ElTr)
double Max() const
Returns the maximal element of the vector.
virtual void AssembleElementMatrix2(const FiniteElement &trial_fe, const FiniteElement &test_fe, ElementTransformation &Trans, DenseMatrix &elmat)
int GetFaceValues(int i, int side, const IntegrationRule &ir, Vector &vals, DenseMatrix &tr, int vdim=1) const
void GetEdgeVDofs(int iE, Array< int > &dofs) const
Returns indexes of degrees of freedom for i'th edge.
void GetElementAverages(GridFunction &avgs)
const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement associated with i'th element.
void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, Array< int > &bdr_attr)
void GetVectorValues(ElementTransformation &T, const IntegrationRule &ir, DenseMatrix &vals) const
virtual void Mult(const Vector &xt, Vector &x) const
Operator application.
void ProjectCoefficient(Coefficient &coeff)
Piecewise-(bi)quadratic continuous finite elements.
void ReorderByNodes()
For a vector grid function, makes sure that the ordering is byNODES.
double ComputeW11Error(Coefficient *exsol, VectorCoefficient *exgrad, int norm_type, Array< int > *elems=NULL, const IntegrationRule *irs[]=NULL) const
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
GridFunction & operator=(double value)
Redefine '=' for GridFunction = constant.
int GetNFaces() const
Return the number of faces in a 3D mesh.
int DofToVDof(int dof, int vd) const
void MultAtB(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &AtB)
Multiply the transpose of a matrix A with a matrix B: At*B.
void DofsToVDofs(Array< int > &dofs) const
const FiniteElementCollection * FEColl() const
Arbitrary order H1-conforming (continuous) finite elements.
SparseMatrix * GetConformingRestriction()
void GetGradients(const int elem, const IntegrationRule &ir, DenseMatrix &grad)
const FiniteElement * GetBE(int i) const
Returns pointer to the FiniteElement for the i'th boundary element.
void SetSize(int s)
If the matrix is not a square matrix of size s then recreate it.
void GetVectorGradient(ElementTransformation &tr, DenseMatrix &grad)
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
void Save(std::ostream &out) const
double Sum() const
Return the sum of the vector entries.
void GetValuesFrom(GridFunction &)
virtual void ProjectDelta(int vertex, Vector &dofs) const
void SaveVTK(std::ostream &out, const std::string &field_name, int ref)
void ProjectBdrCoefficient(Coefficient &coeff, Array< int > &attr)
virtual double GetValue(int i, const IntegrationPoint &ip, int vdim=1) const
Arbitrary order "L2-conforming" discontinuous finite elements.
int GetEdgeMaster(int v1, int v2) const
void ProjectVectorFieldOn(GridFunction &vec_field, int comp=0)