Commit 126a6e5a by oliver.sander_at_tu-dresden.de

### Make trescafrictionfunctionaltest build

parent bad6d74c
 ... ... @@ -271,7 +271,7 @@ public: { auto p = (*origin_)[row]; p.axpy(v, (*direction_)[row]); result += (*coefficients_)[row] * tangentialPart(p).two_norm(); result += (*coefficients_)[row][0] * tangentialPart(p).two_norm(); } return result; ... ...
 ... ... @@ -80,11 +80,10 @@ void testCoordinateRestrictionSubdifferential(const Functional& functional, for (auto v : testParameters) { // Test the subdifferential of the restriction Solvers::Interval subDifferential; restriction.subDiff(v, subDifferential); Solvers::Interval subDifferential = restriction.subDifferential(v); // Step size. Best value: square root of the machine precision constexpr double eps = std::sqrt(std::numeric_limits::epsilon()); const double eps = std::sqrt(std::numeric_limits::epsilon()); auto forwardFDGradient = (restriction(v+eps) - restriction(v)) / eps; auto backwardFDGradient = (restriction(v) - restriction(v-eps)) / eps; ... ... @@ -112,36 +111,14 @@ int main(int argc, char* argv[]) try // Create a Tresca friction functional on a grid with three vertices for testing using M = Matrix >; using Vector = BlockVector >; // TODO: You would really want something like std::vector for the weights W, // But that would mean different levels of nestedness for the different containers, // and it is not clear to me how coordinate restrictions would work in this situation. using W = BlockVector >; //using W = std::vector; M matrix(3,3); matrix[0][0] = ScaledIdentityMatrix(1); matrix[0][1] = 0; matrix[0][2] = 0; // TODO: TrescaFrictionFunctional currently uses the coefficient vector type // for the weights, too. That's of course inappropriate, because there is // really only a scalar weight per Lagrange point. // Let's hack around that by simply having the same number twice for each Lagrange point. Vector weights = {{2.0, 2.0}, {3.0, 3.0}, {4.0, 4.0}}; matrix[1][0] = 0; matrix[1][1] = ScaledIdentityMatrix(2); matrix[1][2] = ScaledIdentityMatrix(-1); matrix[2][0] = 0; matrix[2][1] = ScaledIdentityMatrix(-1); matrix[2][2] = ScaledIdentityMatrix(1); Vector linearPart = {{1,2},{3,4}, {5,6}}; Vector lower = {{-1000000,-1000000},{-1000000,-1000000}, {-1000000,-1000000}}; Vector upper = {{1000000,1000000},{1000000,1000000}, {1000000,1000000}}; W weights = {2.0, 3.0, 4.0}; TrescaFrictionFunctional functional(matrix, linearPart, lower, upper, weights); TrescaFrictionFunctional functional(weights); // A set of local test points, i.e., values for a single vector block std::vector localTestPoints = {{0,0}, ... ... @@ -183,7 +160,7 @@ int main(int argc, char* argv[]) try testCoordinateRestrictionSubdifferential(functional, testPoints, {-3, -2, -1, 0, 1, 2, 3}); return 0; } catch (Exception e) } catch (Exception& e) { std::cout << e.what() << std::endl; }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment