Mercurial > fem-fenics-eugenio
comparison src/subdomain_rep.h @ 268:61830a4f9ab9
Improve formatting
author | Eugenio Gianniti <eugenio.gianniti@mail.polimi.it> |
---|---|
date | Thu, 14 Aug 2014 12:26:55 +0200 |
parents | 53039ac90368 |
children |
comparison
equal
deleted
inserted
replaced
267:53039ac90368 | 268:61830a4f9ab9 |
---|---|
26 #include <octave/parse.h> | 26 #include <octave/parse.h> |
27 #include <octave/octave.h> | 27 #include <octave/octave.h> |
28 | 28 |
29 class subdomain_rep : public dolfin::SubDomain | 29 class subdomain_rep : public dolfin::SubDomain |
30 { | 30 { |
31 public: | 31 public: |
32 | 32 |
33 subdomain_rep (void) | 33 subdomain_rep (void) |
34 : dolfin::SubDomain (), pfh (NULL) {} | 34 : dolfin::SubDomain (), pfh (NULL) {} |
35 | 35 |
36 subdomain_rep (octave_fcn_handle const & fh, bool on_boundary) | 36 subdomain_rep (octave_fcn_handle const & fh, bool on_boundary) |
37 : dolfin::SubDomain (), pfh (new octave_fcn_handle (fh)), | 37 : dolfin::SubDomain (), pfh (new octave_fcn_handle (fh)), |
38 check_boundary (on_boundary) {} | 38 check_boundary (on_boundary) {} |
39 | 39 |
40 ~subdomain_rep (void) { delete pfh; } | 40 ~subdomain_rep (void) { delete pfh; } |
41 | 41 |
42 bool | 42 bool |
43 inside (dolfin::Array<double> const & x, bool on_boundary) const | 43 inside (dolfin::Array<double> const & x, bool on_boundary) const |
44 { | 44 { |
45 octave_value_list b; | 45 octave_value_list b; |
46 b.resize (x.size ()); | 46 b.resize (x.size ()); |
47 for (std::size_t i = 0; i < x.size (); ++i) | 47 for (std::size_t i = 0; i < x.size (); ++i) |
48 b(i) = x[i]; | 48 { b(i) = x[i]; } |
49 octave_value_list tmp = feval (pfh->function_value (), b); | 49 octave_value_list tmp = feval (pfh->function_value (), b); |
50 bool retval = tmp(0).bool_value (); | 50 bool retval = tmp(0).bool_value (); |
51 if (check_boundary) | 51 if (check_boundary) |
52 retval = retval && on_boundary; | 52 { retval = retval && on_boundary; } |
53 return retval; | 53 return retval; |
54 } | 54 } |
55 | 55 |
56 private: | 56 private: |
57 | 57 |
58 octave_fcn_handle * pfh; | 58 octave_fcn_handle * pfh; |
59 bool check_boundary; | 59 bool check_boundary; |
60 }; | 60 }; |
61 #endif | 61 #endif |