1 #ifndef __POISSON2DLAGRANGEMULTIPLIER_HPP__
2 #define __POISSON2DLAGRANGEMULTIPLIER_HPP__
22 typedef boost::function<
double(
const double,
const double,
const double)>
27 OpDomainLhsK(std::string row_field_name, std::string col_field_name,
28 boost::shared_ptr<std::vector<unsigned char>> boundary_marker =
nullptr)
30 boundaryMarker(boundary_marker) {
35 EntityType col_type,
EntData &row_data,
39 const int nb_row_dofs = row_data.
getIndices().size();
40 const int nb_col_dofs = col_data.
getIndices().size();
42 if (nb_row_dofs && nb_col_dofs) {
44 locLhs.resize(nb_row_dofs, nb_col_dofs,
false);
48 const double area = getMeasure();
51 const int nb_integration_points = getGaussPts().size2();
53 auto t_w = getFTensor0IntegrationWeight();
59 for (
int gg = 0; gg != nb_integration_points; gg++) {
61 const double a = t_w * area;
63 for (
int rr = 0; rr != nb_row_dofs; ++rr) {
67 for (
int cc = 0; cc != nb_col_dofs; cc++) {
69 locLhs(rr, cc) += t_row_diff_base(
i) * t_col_diff_base(
i) *
a;
89 if (row_side != col_side || row_type != col_type) {
90 transLocLhs.resize(nb_col_dofs, nb_row_dofs,
false);
91 noalias(transLocLhs) = trans(locLhs);
109 boost::shared_ptr<std::vector<unsigned char>> boundary_marker =
nullptr)
111 sourceTermFunc(source_term_function), boundaryMarker(boundary_marker) {}
120 locRhs.resize(nb_dofs,
false);
124 const double area = getMeasure();
127 const int nb_integration_points = getGaussPts().size2();
129 auto t_w = getFTensor0IntegrationWeight();
131 auto t_coords = getFTensor1CoordsAtGaussPts();
137 for (
int gg = 0; gg != nb_integration_points; gg++) {
139 const double a = t_w * area;
141 sourceTermFunc(t_coords(0), t_coords(1), t_coords(2));
143 for (
int rr = 0; rr != nb_dofs; rr++) {
145 locRhs[rr] += t_base * body_source *
a;
179 EntityType col_type,
EntData &row_data,
183 const int nb_row_dofs = row_data.
getIndices().size();
184 const int nb_col_dofs = col_data.
getIndices().size();
186 if (nb_row_dofs && nb_col_dofs) {
188 locBoundaryLhs.resize(nb_row_dofs, nb_col_dofs,
false);
189 locBoundaryLhs.clear();
192 const double edge = getMeasure();
195 const int nb_integration_points = getGaussPts().size2();
197 auto t_w = getFTensor0IntegrationWeight();
203 for (
int gg = 0; gg != nb_integration_points; gg++) {
204 const double a = t_w * edge;
206 for (
int rr = 0; rr != nb_row_dofs; ++rr) {
210 for (
int cc = 0; cc != nb_col_dofs; cc++) {
212 locBoundaryLhs(rr, cc) += t_row_base * t_col_base *
a;
242 boundaryFunc(boundary_function) {}
251 locBoundaryRhs.resize(nb_dofs,
false);
252 locBoundaryRhs.clear();
255 const double edge = getMeasure();
258 const int nb_integration_points = getGaussPts().size2();
260 auto t_w = getFTensor0IntegrationWeight();
262 auto t_coords = getFTensor1CoordsAtGaussPts();
268 for (
int gg = 0; gg != nb_integration_points; gg++) {
270 const double a = t_w * edge;
271 double boundary_term =
272 boundaryFunc(t_coords(0), t_coords(1), t_coords(2));
274 for (
int rr = 0; rr != nb_dofs; rr++) {
276 locBoundaryRhs[rr] += t_base * boundary_term *
a;
303 #endif //__POISSON2DLAGRANGEMULTIPLIER_HPP__