1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
/* -*- c++ -*- (enables emacs c++ mode) */
/*===========================================================================
Copyright (C) 2007-2017 Yves Renard, Julien Pommier.
This file is a part of GetFEM++
GetFEM++ is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version along with the GCC Runtime Library
Exception either version 3.1 or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License and GCC Runtime Library Exception for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, you may use this file as it is a part of a free
software library without restriction. Specifically, if other files
instantiate templates or use macros or inline functions from this file,
or you compile this file and link it with other files to produce an
executable, this file does not by itself cause the resulting executable
to be covered by the GNU Lesser General Public License. This exception
does not however invalidate any other reasons why the executable file
might be covered by the GNU Lesser General Public License.
===========================================================================*/
#include "getfem/getfem_mesh_fem_global_function.h"
using std::endl; using std::cout; using std::cerr;
using std::ends; using std::cin; using std::isnan;
/* some GetFEM++ types that we will be using */
using bgeot::base_small_vector; /* special class for small (dim<16) vectors */
using bgeot::base_node; /* geometrical nodes(derived from base_small_vector)*/
using bgeot::scalar_type; /* = double */
using bgeot::size_type; /* = unsigned long */
using bgeot::dim_type;
using bgeot::short_type;
using bgeot::base_matrix; /* small dense matrix. */
#define VALIDATE_XFEM
#ifdef VALIDATE_XFEM
struct crack_exact_solution_function : public getfem::abstract_xy_function {
unsigned function_num;
unsigned component_num; /* 0 -> x component, 1 -> y component */
scalar_type lambda, mu;
virtual scalar_type val(scalar_type x, scalar_type y) const;
virtual base_small_vector grad(scalar_type x, scalar_type y) const;
virtual base_matrix hess(scalar_type, scalar_type) const
{ GMM_ASSERT1(false, "Sorry, to be done ..."); }
crack_exact_solution_function(unsigned fnum,
unsigned cnum,
scalar_type l, scalar_type m) {
function_num = fnum;
component_num = cnum;
lambda = l; mu = m;
}
base_small_vector eval(const base_node &x, base_matrix *pgrad) const;
};
struct crack_exact_solution {
getfem::mesh_fem_global_function mf;
getfem::base_vector U;
crack_exact_solution(getfem::mesh &me) : mf(me) {}
void init(int function_num, scalar_type lambda, scalar_type mu,
getfem::level_set &ls);
};
inline base_small_vector sol_f(const base_node &x) {
int N = x.size();
base_small_vector res(N);
return res;
}
#else
inline base_small_vector sol_f(const base_node &x) {
int N = x.size();
base_small_vector res(N); res[N-1] = x[N-1];
return res;
}
#endif
|