30 const int bufflen = 256;
35 input.getline(buff, bufflen);
36 if (strcmp(buff,
"FiniteElementSpace"))
38 " input stream is not a GridFunction!");
39 input.getline(buff, bufflen,
' ');
41 input.getline(buff, bufflen);
43 input.getline(buff, bufflen,
' ');
45 input.getline(buff, bufflen,
' ');
48 input.getline(buff, bufflen);
75 int g_nddofs = g_ndofs - (g_nvdofs + g_nedofs + g_nfdofs);
77 vi = ei = fi = di = 0;
78 for (
int i = 0; i < num_pieces; i++)
85 int l_nddofs = l_ndofs - (l_nvdofs + l_nedofs + l_nfdofs);
86 const double *l_data = gf_array[i]->
GetData();
87 double *g_data =
data;
90 for (
int d = 0; d < vdim; d++)
92 memcpy(g_data+vi, l_data, l_nvdofs*
sizeof(
double));
95 memcpy(g_data+ei, l_data, l_nedofs*
sizeof(
double));
98 memcpy(g_data+fi, l_data, l_nfdofs*
sizeof(
double));
101 memcpy(g_data+di, l_data, l_nddofs*
sizeof(
double));
108 memcpy(g_data+vdim*vi, l_data, vdim*l_nvdofs*
sizeof(
double));
109 l_data += vdim*l_nvdofs;
110 g_data += vdim*g_nvdofs;
111 memcpy(g_data+vdim*ei, l_data, vdim*l_nedofs*
sizeof(
double));
112 l_data += vdim*l_nedofs;
113 g_data += vdim*g_nedofs;
114 memcpy(g_data+vdim*fi, l_data, vdim*l_nfdofs*
sizeof(
double));
115 l_data += vdim*l_nfdofs;
116 g_data += vdim*g_nfdofs;
117 memcpy(g_data+vdim*di, l_data, vdim*l_nddofs*
sizeof(
double));
118 l_data += vdim*l_nddofs;
119 g_data += vdim*g_nddofs;
175 int nfe = ufes->
GetNE();
183 for (
int i = 0; i < nfe; i++)
185 if (subdomain >= 0 && ufes->
GetAttribute(i) != subdomain)
197 *ffes->
GetFE(i), fl, wcoef);
202 for (
int j = 0; j < fdofs.
Size(); j++)
218 for (
int i = 0; i < count.Size(); i++)
220 if (count[i] != 0) { flux(i) /= count[i]; }
250 int dof = FElem->
GetDof();
260 for (k = 0; k < n; k++)
263 nval[k] = shape * ((
const double *)loc_data + dof * vdim);
270 for (k = 0; k < n; k++)
274 nval[k] = loc_data * (&vshape(0,vdim));
289 return (DofVal * LocVec);
296 int dof = FElem->
GetDof();
307 for (
int k = 0; k < vdim; k++)
309 val(k) = shape * ((
const double *)loc_data + dof * k);
334 int dof = FElem->
GetDof();
335 Vector DofVal(dof), loc_data(dof);
337 for (
int k = 0; k < n; k++)
340 vals(k) = DofVal * loc_data;
410 int dof = FElem->
GetDof();
421 for (
int j = 0; j < nip; j++)
425 for (
int k = 0; k < vdim; k++)
427 vals(k,j) = shape * ((
const double *)loc_data + dof * k);
437 for (
int j = 0; j < nip; j++)
506 Vector shape, loc_values, orig_loc_values;
507 int i, j, d, ne, dof, odof, vdim;
511 for (i = 0; i < ne; i++)
520 loc_values.
SetSize(dof * vdim);
523 for (j = 0; j < dof; j++)
527 for (d = 0; d < vdim; d++)
529 loc_values(d*dof+j) =
530 shape * ((
const double *)orig_loc_values + d * odof) ;
543 Vector shape, loc_values, orig_loc_values;
544 int i, j, d, nbe, dof, odof, vdim;
548 for (i = 0; i < nbe; i++)
557 loc_values.
SetSize(dof * vdim);
560 for (j = 0; j < dof; j++)
564 for (d = 0; d < vdim; d++)
566 loc_values(d*dof+j) =
567 shape * ((
const double *)orig_loc_values + d * odof);
581 int d, j, k, n, sdim, dof, ind;
588 int *dofs = &vdofs[comp*dof];
594 for (k = 0; k < n; k++)
599 for (d = 0; d < sdim; d++)
602 for (j = 0; j < dof; j++)
603 if ( (ind=dofs[j]) >= 0 )
605 a += vshape(j, d) *
data[ind];
609 a -= vshape(j, d) *
data[-1-ind];
626 double *temp =
new double[
size];
629 for (j = 0; j < ndofs; j++)
630 for (i = 0; i < vdim; i++)
632 temp[j+i*ndofs] =
data[k++];
635 for (i = 0; i <
size; i++)
663 val(vertices[k]) += vals(k, comp);
664 overlap[vertices[k]]++;
668 for (i = 0; i < overlap.Size(); i++)
670 val(i) /= overlap[i];
678 int d, i, k, ind, dof, sdim;
687 for (i = 0; i < new_fes->
GetNE(); i++)
694 for (d = 0; d < sdim; d++)
696 for (k = 0; k < dof; k++)
698 if ( (ind=new_vdofs[dof*d+k]) < 0 )
700 ind = -1-ind, vals(k, d) = - vals(k, d);
702 vec_field(ind) += vals(k, d);
708 for (i = 0; i < overlap.Size(); i++)
710 vec_field(i) /= overlap[i];
722 int i, j, k,
dim, dof, der_dof, ind;
725 for (i = 0; i < overlap.Size(); i++)
732 for (i = 0; i < der_fes->
GetNE(); i++)
741 der_dof = der_fe->
GetDof();
747 for (j = 0; j < dof; j++)
748 loc_func(j) = ( (ind=vdofs[comp*dof+j]) >= 0 ) ?
750 for (k = 0; k < der_dof; k++)
758 for (j = 0; j <
dim; j++)
760 a += inv_jac(j, der_comp) * pt_grad(j);
762 der(der_dofs[k]) += a;
763 overlap[der_dofs[k]]++;
767 for (i = 0; i < overlap.Size(); i++)
769 der(i) /= overlap[i];
790 MultAtB(loc_data_mat, dshape, gh);
806 for (
int i = 0; i < Jinv.Width(); i++)
807 for (
int j = 0; j < Jinv.Height(); j++)
809 div_v += grad_hat(i, j) * Jinv(j, i);
820 div_v = (loc_data * divshape) / tr.
Weight();
837 Mult(grad_hat, Jinv, grad);
838 MFEM_ASSERT(grad.Height() == grad.Width(),
"");
839 if (grad.Height() == 3)
842 curl(0) = grad(2,1) - grad(1,2);
843 curl(1) = grad(0,2) - grad(2,0);
844 curl(2) = grad(1,0) - grad(0,1);
846 else if (grad.Height() == 2)
849 curl(0) = grad(1,0) - grad(0,1);
861 curl.
SetSize(curl_shape.Width());
862 if (curl_shape.Width() == 3)
865 curl_shape.MultTranspose(loc_data, curl_hat);
870 curl_shape.MultTranspose(loc_data, curl);
889 dshape.MultTranspose(lval, gh);
910 dshape.MultTranspose(lval, gh);
914 Jinv.MultTranspose(gh, gcol);
927 Mult(grad_hat, Jinv, grad);
935 Vector loc_avgs, loc_this;
940 for (
int i = 0; i <
fes->
GetNE(); i++)
945 avgs.FESpace()->GetElementDofs(i, te_dofs);
948 loc_mass.
Mult(loc_this, loc_avgs);
949 avgs.AddElementVector(te_dofs, loc_avgs);
951 loc_mass.
Mult(loc_this, loc_avgs);
952 int_psi.AddElementVector(te_dofs, loc_avgs);
954 for (
int i = 0; i < avgs.Size(); i++)
956 avgs(i) /= int_psi(i);
975 mfem_error(
"GridFunction::ProjectGridFunction() :"
976 " incompatible vector dimensions!");
980 for (
int i = 0; i < mesh->
GetNE(); i++)
984 for (
int vd = 0; vd < vdim; vd++)
999 Vector vals, new_vals(size);
1002 MFEM_ASSERT(weights.
Size() ==
size,
"Different # of weights and dofs.");
1003 MFEM_ASSERT(_lo.
Size() ==
size,
"Different # of lower bounds and dofs.");
1004 MFEM_ASSERT(_hi.
Size() ==
size,
"Different # of upper bounds and dofs.");
1007 double tol = 1.e-12;
1015 slbqp.
Mult(vals, new_vals);
1021 double _min,
double _max)
1026 Vector vals, new_vals(size);
1029 double max_val = vals.
Max();
1030 double min_val = vals.
Min();
1032 if (max_val <= _min)
1039 if (_min <= min_val && max_val <= _max)
1044 Vector minv(size), maxv(size);
1045 minv = (_min > min_val) ? _min : min_val;
1046 maxv = (_max < max_val) ? _max : max_val;
1065 for (j = 0; j < vertices.
Size(); j++)
1067 nval(vertices[j]) += values[j];
1068 overlap[vertices[j]]++;
1071 for (i = 0; i < overlap.Size(); i++)
1073 nval(i) /= overlap[i];
1088 const double *center = delta_coeff.
Center();
1089 const double *vert = mesh->
GetVertex(0);
1090 double min_dist, dist;
1094 min_dist =
Distance(center, vert, dim);
1095 for (
int i = 0; i < mesh->
GetNV(); i++)
1098 dist =
Distance(center, vert, dim);
1099 if (dist < min_dist)
1109 if (min_dist >= delta_coeff.
Tol())
1118 Vector vals, loc_mass_vals;
1119 for (
int i = 0; i < mesh->
GetNE(); i++)
1122 for (
int j = 0; j < vertices.
Size(); j++)
1123 if (vertices[j] == v_idx)
1133 loc_mass.Mult(vals, loc_mass_vals);
1134 integral += loc_mass_vals.
Sum();
1144 if (delta_c == NULL)
1149 for (
int i = 0; i <
fes->
GetNE(); i++)
1163 (*this) *= (delta_c->
Scale() / integral);
1174 for (
int i = 0; i < dofs.
Size(); i++)
1187 (*this)(vdof) = coeff.
Eval(*T, ip);
1215 for (
int i = 0; i < dofs.
Size(); i++)
1227 vcoeff.
Eval(val, *T, ip);
1231 (*this)(vdof) = val(vd);
1238 int i, j, fdof, d, ind, vdim;
1252 for (j = 0; j < fdof; j++)
1256 for (d = 0; d < vdim; d++)
1258 val = coeff[d]->
Eval(*transf, ip);
1259 if ( (ind = vdofs[fdof*d+j]) < 0 )
1261 val = -val, ind = -1-ind;
1280 for (
int i = 0; i <
fes->
GetNE(); i++)
1289 for (
int j = 0; j < vdofs.
Size(); j++)
1291 if (attr > dof_attr[vdofs[j]])
1293 (*this)(vdofs[j]) = vals[j];
1294 dof_attr[vdofs[j]] = attr;
1309 int i, j, fdof, d, ind, vdim;
1326 for (j = 0; j < fdof; j++)
1330 for (d = 0; d < vdim; d++)
1332 val = coeff[d]->
Eval(*transf, ip);
1333 if ( (ind = vdofs[fdof*d+j]) < 0 )
1335 val = -val, ind = -1-ind;
1361 for (i = 0; i < bdr_edges.
Size(); i++)
1363 int edge = bdr_edges[i];
1365 if (vdofs.
Size() == 0) {
continue; }
1371 for (d = 0; d < vdim; d++)
1373 fe->
Project(*coeff[d], *transf, vals);
1374 for (
int k = 0; k < vals.
Size(); k++)
1376 (*this)(vdofs[d*vals.
Size()+k]) = vals(k);
1393 Vector vc(dim), nor(dim), lvec, shape;
1413 vcoeff.
Eval(vc, *T, ip);
1416 lvec.
Add(ip.
weight * (vc * nor), shape);
1428 Vector vc(dim), nor(dim), lvec;
1444 vcoeff.
Eval(vc, *T, ip);
1446 lvec(j) = (vc * nor);
1472 fe->
Project(vcoeff, *T, lvec);
1483 for (
int i = 0; i < bdr_edges.
Size(); i++)
1485 int edge = bdr_edges[i];
1487 if (dofs.
Size() == 0) {
continue; }
1493 fe->
Project(vcoeff, *T, lvec);
1502 double error = 0.0, a;
1507 int fdof, d, i, intorder, j, k;
1533 for (k = 0; k < fdof; k++)
1534 if (vdofs[fdof*d+k] >= 0)
1536 a += (*this)(vdofs[fdof*d+k]) * shape(k);
1540 a -= (*this)(-1-vdofs[fdof*d+k]) * shape(k);
1543 a -= exsol[d]->
Eval(*transf, ip);
1551 return -sqrt(-error);
1566 for (
int i = 0; i <
fes->
GetNE(); i++)
1568 if (elems != NULL && (*elems)[i] == 0) {
continue; }
1570 int intorder = 2*fe->
GetOrder() + 1;
1582 exsol.
Eval(exact_vals, *T, *ir);
1585 vals.
Norm2(loc_errs);
1590 error += ip.
weight * T->
Weight() * (loc_errs(j) * loc_errs(j));
1596 return -sqrt(-error);
1603 Coefficient *ell_coeff,
double Nu,
int norm_type)
const
1606 int i, fdof,
dim, intorder, j, k;
1611 Vector e_grad, a_grad, shape, el_dofs, err_val, ell_coeff_val;
1624 for (i = 0; i < mesh->
GetNE(); i++)
1635 for (k = 0; k < fdof; k++)
1638 el_dofs(k) = (*this)(vdofs[k]);
1642 el_dofs(k) = - (*this)(-1-vdofs[k]);
1649 exgrad->
Eval(e_grad, *transf, ip);
1651 Mult(dshape, Jinv, dshapet);
1655 ell_coeff->
Eval(*transf, ip) *
1664 int i1 = face_elem_transf->
Elem1No;
1665 int i2 = face_elem_transf->
Elem2No;
1672 intorder = 2 * intorder;
1678 transf = face_elem_transf->
Elem1;
1684 for (k = 0; k < fdof; k++)
1687 el_dofs(k) = (*this)(vdofs[k]);
1691 el_dofs(k) = - (*this)(-1-vdofs[k]);
1698 ell_coeff_val(j) = ell_coeff->
Eval(*transf, eip);
1699 err_val(j) = exsol->
Eval(*transf, eip) - (shape * el_dofs);
1705 transf = face_elem_transf->
Elem2;
1711 for (k = 0; k < fdof; k++)
1714 el_dofs(k) = (*this)(vdofs[k]);
1718 el_dofs(k) = - (*this)(-1-vdofs[k]);
1725 ell_coeff_val(j) += ell_coeff->
Eval(*transf, eip);
1726 ell_coeff_val(j) *= 0.5;
1727 err_val(j) -= (exsol->
Eval(*transf, eip) - (shape * el_dofs));
1731 transf = face_elem_transf->
Face;
1736 error += (ip.
weight * Nu * ell_coeff_val(j) *
1737 pow(transf->
Weight(), 1.0-1.0/(dim-1)) *
1738 err_val(j) * err_val(j));
1744 return -sqrt(-error);
1752 double error = 0.0, a;
1757 int fdof, d, i, intorder, j, k;
1784 for (k = 0; k < fdof; k++)
1785 if (vdofs[fdof*d+k] >= 0)
1787 a += (*this)(vdofs[fdof*d+k]) * shape(k);
1791 a -= (*this)(-1-vdofs[fdof*d+k]) * shape(k);
1793 a -= exsol[d]->
Eval(*transf, ip);
1811 int i, fdof,
dim, intorder, j, k;
1815 Vector e_grad, a_grad, shape, el_dofs, err_val, ell_coeff_val;
1818 double a, error = 0.0;
1827 for (i = 0; i < mesh->
GetNE(); i++)
1829 if (elems != NULL && (*elems)[i] == 0) {
continue; }
1846 for (k = 0; k < fdof; k++)
1849 el_dofs(k) = (*this)(vdofs[k]);
1853 el_dofs(k) = -(*this)(-1-vdofs[k]);
1860 a = (el_dofs * shape) - (exsol->
Eval(*transf, ip));
1866 for (i = 0; i < mesh->
GetNE(); i++)
1868 if (elems != NULL && (*elems)[i] == 0) {
continue; }
1886 for (k = 0; k < fdof; k++)
1889 el_dofs(k) = (*this)(vdofs[k]);
1893 el_dofs(k) = -(*this)(-1-vdofs[k]);
1900 exgrad->
Eval(e_grad, *transf, ip);
1902 Mult(dshape, Jinv, dshapet);
1921 for (
int i = 0; i <
fes->
GetNE(); i++)
1931 int intorder = 2*fe->
GetOrder() + 1;
1940 double err = fabs(vals(j) - exsol.
Eval(*T, ip));
1941 if (p < numeric_limits<double>::infinity())
1946 err *= weight->
Eval(*T, ip);
1954 err *= weight->
Eval(*T, ip);
1956 error = std::max(error, err);
1961 if (p < numeric_limits<double>::infinity())
1966 error = -pow(-error, 1./p);
1970 error = pow(error, 1./p);
1988 for (
int i = 0; i <
fes->
GetNE(); i++)
1998 int intorder = 2*fe->
GetOrder() + 1;
2003 exsol.
Eval(exact_vals, *T, *ir);
2010 vals.
Norm2(loc_errs);
2014 v_weight->
Eval(exact_vals, *T, *ir);
2017 for (
int j = 0; j < vals.
Width(); j++)
2020 for (
int d = 0; d < vals.
Height(); d++)
2022 err += vals(d,j)*exact_vals(d,j);
2024 loc_errs(j) = fabs(err);
2031 double err = loc_errs(j);
2032 if (p < numeric_limits<double>::infinity())
2037 err *= weight->
Eval(*T, ip);
2045 err *= weight->
Eval(*T, ip);
2047 error = std::max(error, err);
2052 if (p < numeric_limits<double>::infinity())
2057 error = -pow(-error, 1./p);
2061 error = pow(error, 1./p);
2070 for (
int i = 0; i <
size; i++)
2079 for (
int i = 0; i <
size; i++)
2134 static_cast<Vector&
>(*this) = x;
2164 out <<
"SCALARS " << field_name <<
" double 1\n"
2165 <<
"LOOKUP_TABLE default\n";
2166 for (
int i = 0; i < mesh->
GetNE(); i++)
2173 for (
int j = 0; j < val.
Size(); j++)
2175 out << val(j) <<
'\n';
2182 out <<
"VECTORS " << field_name <<
" double\n";
2183 for (
int i = 0; i < mesh->
GetNE(); i++)
2190 for (
int j = 0; j < vval.
Width(); j++)
2192 out << vval(0, j) <<
' ' << vval(1, j) <<
' ';
2208 for (
int vd = 0; vd < vec_dim; vd++)
2210 out <<
"SCALARS " << field_name << vd <<
" double 1\n"
2211 <<
"LOOKUP_TABLE default\n";
2212 for (
int i = 0; i < mesh->
GetNE(); i++)
2219 for (
int j = 0; j < val.
Size(); j++)
2221 out << val(j) <<
'\n';
2231 double v1[3] = { p2[0] - p1[0], p2[1] - p1[1], p2[2] - p1[2] };
2232 double v2[3] = { p3[0] - p1[0], p3[1] - p1[1], p3[2] - p1[2] };
2233 double n[] = { v1[1] * v2[2] - v1[2] * v2[1],
2234 v1[2] * v2[0] - v1[0] * v2[2],
2235 v1[0] * v2[1] - v1[1] * v2[0]
2237 double rl = 1.0 / sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
2238 n[0] *= rl; n[1] *= rl; n[2] *= rl;
2240 out <<
" facet normal " << n[0] <<
' ' << n[1] <<
' ' << n[2]
2242 <<
"\n vertex " << p1[0] <<
' ' << p1[1] <<
' ' << p1[2]
2243 <<
"\n vertex " << p2[0] <<
' ' << p2[1] <<
' ' << p2[2]
2244 <<
"\n vertex " << p3[0] <<
' ' << p3[1] <<
' ' << p3[2]
2245 <<
"\n endloop\n endfacet\n";
2261 double pts[4][3], bbox[3][2];
2263 out <<
"solid GridFunction\n";
2265 bbox[0][0] = bbox[0][1] = bbox[1][0] = bbox[1][1] =
2266 bbox[2][0] = bbox[2][1] = 0.0;
2267 for (i = 0; i < mesh->
GetNE(); i++)
2274 for (k = 0; k < RG.
Size()/n; k++)
2276 for (j = 0; j < n; j++)
2279 pts[j][0] = pointmat(0,l);
2280 pts[j][1] = pointmat(1,l);
2281 pts[j][2] = values(l);
2297 bbox[0][0] = pointmat(0,0);
2298 bbox[0][1] = pointmat(0,0);
2299 bbox[1][0] = pointmat(1,0);
2300 bbox[1][1] = pointmat(1,0);
2301 bbox[2][0] = values(0);
2302 bbox[2][1] = values(0);
2305 for (j = 0; j < values.
Size(); j++)
2307 if (bbox[0][0] > pointmat(0,j))
2309 bbox[0][0] = pointmat(0,j);
2311 if (bbox[0][1] < pointmat(0,j))
2313 bbox[0][1] = pointmat(0,j);
2315 if (bbox[1][0] > pointmat(1,j))
2317 bbox[1][0] = pointmat(1,j);
2319 if (bbox[1][1] < pointmat(1,j))
2321 bbox[1][1] = pointmat(1,j);
2323 if (bbox[2][0] > values(j))
2325 bbox[2][0] = values(j);
2327 if (bbox[2][1] < values(j))
2329 bbox[2][1] = values(j);
2334 cout <<
"[xmin,xmax] = [" << bbox[0][0] <<
',' << bbox[0][1] <<
"]\n"
2335 <<
"[ymin,ymax] = [" << bbox[1][0] <<
',' << bbox[1][1] <<
"]\n"
2336 <<
"[zmin,zmax] = [" << bbox[2][0] <<
',' << bbox[2][1] <<
']'
2339 out <<
"endsolid GridFunction" << endl;
2354 int with_subdomains)
2361 int nfe = ufes->
GetNE();
2365 Vector ul, fl, fla, d_xyz;
2375 if (with_subdomains)
2377 for (
int i = 0; i < nfe; i++)
2380 if (attr > nsd) { nsd = attr; }
2384 for (
int s = 1; s <= nsd; s++)
2387 u.
ComputeFlux(blfi, flux, 0, (with_subdomains ? s : 0));
2389 for (
int i = 0; i < nfe; i++)
2391 if (with_subdomains && ufes->
GetAttribute(i) != s) {
continue; }
2401 *ffes->
GetFE(i), fl, 0);
2405 error_estimates(i) =
2407 (aniso_flags ? &d_xyz : NULL));
2412 for (
int k = 0; k <
dim; k++)
2417 double thresh = 0.15 * 3.0/
dim;
2419 for (
int k = 0; k <
dim; k++)
2421 if (d_xyz[k] / sum > thresh) { flag |= (1 << k); }
2424 (*aniso_flags)[i] = flag;
2450 for (
int j = 0; j < nip; j++)
2459 double err = val1.
Norml2();
2460 if (p < numeric_limits<double>::infinity())
2467 norm = std::max(norm, err);
2471 if (p < numeric_limits<double>::infinity())
2476 norm = -pow(-norm, 1./p);
2480 norm = pow(norm, 1./p);
2494 return sol_in.
Eval(*T_in, ip);
2505 string cname = name;
2506 if (cname ==
"Linear")
2510 else if (cname ==
"Quadratic")
2514 else if (cname ==
"Cubic")
2518 else if (!strncmp(name,
"H1_", 3))
2522 else if (!strncmp(name,
"L2_T", 4))
2526 else if (!strncmp(name,
"L2_", 3))
2532 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.
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.
int DofToVDof(int dof, int vd, int ndofs=-1) const
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Class used for extruding scalar GridFunctions.
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.
void GetElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom in array dofs for i'th element.
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)
virtual void ComputeFlux(BilinearFormIntegrator &blfi, GridFunction &flux, int wcoef=1, int subdomain=-1)
void ProjectDiscCoefficient(VectorCoefficient &coeff, Array< int > &dof_attr)
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.
double Norml2() const
Returns the l2 norm of the vector.
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.
Data type dense matrix using column-major storage.
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.
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
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
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
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 SumFluxAndCount(BilinearFormIntegrator &blfi, GridFunction &flux, Array< int > &counts, int wcoef, int subdomain)
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)
const SparseMatrix * GetConformingRestriction()
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.
const IntegrationRule & GetNodes() const
GeometryRefiner GlobGeometryRefiner
ElementTransformation * GetBdrElementTransformation(int i) const
Returns ElementTransformation for the i'th boundary element.
void GetCurl(ElementTransformation &tr, Vector &curl)
const SparseMatrix * GetConformingProlongation()
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()
virtual void GetBoundaryClosure(const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges)
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 GetEdgeDofs(int i, Array< int > &dofs) const
void ZZErrorEstimator(BilinearFormIntegrator &blfi, GridFunction &u, GridFunction &flux, Vector &error_estimates, Array< int > *aniso_flags, int with_subdomains)
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 SpaceDimension() const
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)
virtual void CalcDivShape(const IntegrationPoint &ip, Vector &divshape) const
FiniteElementCollection * fec
Used when the grid function is read from a file.
double ComputeElementLpDistance(double p, int i, GridFunction &gf1, GridFunction &gf2)
Compute the Lp distance between two grid functions on the given element.
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)
bool Nonconforming() const
virtual void GetBdrElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom for i'th boundary element.
NURBSExtension * NURBSext
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
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 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
void GetEdgeVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th edge.
GridFunction & operator=(double value)
Redefine '=' for GridFunction = constant.
int GetNFaces() const
Return the number of faces in a 3D mesh.
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
void Mult(const double *x, double *y) const
Matrix vector multiplication.
Arbitrary order H1-conforming (continuous) finite elements.
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 GetBdrElementVDofs(int i, Array< int > &vdofs) const
Returns indexes of degrees of freedom for i'th boundary element.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
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 &)
static void AdjustVDofs(Array< int > &vdofs)
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.
void ProjectVectorFieldOn(GridFunction &vec_field, int comp=0)