const Point<2> center (0,0);
const SphericalManifold<2> boundary_description(center);
tria.set_manifold (0, boundary_description);
for (typename Triangulation<2>::active_cell_iterator
cell=tria.begin_active(); cell!=tria.end(); ++cell) {
for (int fn=0; fn<4; ++fn) {
auto ctr = cell->face(fn)->center();
auto x=ctr[0],y=ctr[1];
if (0.92<std::sqrt(x*x+y*y)<1.) {
cell->set_all_manifold_ids(0);
break;
}
}
}
tria.refine_global(2);
Hi,
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<Screenshot 2018-03-28 22.08.32.png>
At this point, all objects created in this function will be destroyed in reverse order. Unfortunately, we defined the manifold object after the triangulation, which still has a pointer to it and the library will produce an error if the manifold object is destroyed before the triangulation. We therefore have to release it, which can be done as follows. Note that this sets the manifold object used for part "0" of the domain back to a default object, over which the triangulation has full control.
triangulation.set_manifold (0);An alternative to doing so, and one that is frequently more convenient, would have been to declare the manifold object before the triangulation object. In that case, the triangulation would have let lose of the manifold object upon its destruction, and everything would have been fine.
On 29 Mar 2018, at 08:14, Weixiong Zheng <zwxn...@gmail.com> wrote:HiIt does give me straight boundary after changing to:
const Point<2> center (0,0);
const SphericalManifold<2> boundary_description(center);
//const StraightBoundary<2> boundary_description;
//tria.set_all_manifold_ids_on_boundary(0);
tria.set_manifold (2, boundary_description);
for (typename Triangulation<2>::active_cell_iterator
cell=tria.begin_active(); cell!=tria.end(); ++cell) {
for (int fn=0; fn<4; ++fn) {
auto ctr = cell->face(fn)->center();
auto x=ctr[0],y=ctr[1];
if (0.92<std::sqrt(x*x+y*y) && std::sqrt(x*x+y*y)<1. && !cell->at_boundary()){
cell->set_all_manifold_ids(2);
break;
}
//if (cell->at_boundary())
//cell->set_all_manifold_ids(2);
}
}But after the program finished, I got the following message for errors:An error occurred in line <128> of file </Applications/deal.II-8.5-brew.app/Contents/Resources/brew/src/deal.II-8.5-brew/source/base/subscriptor.cc> in functionvoid dealii::Subscriptor::check_no_subscribers() constThe violated condition was:counter == 0Additional information:Object of class N6dealii17SphericalManifoldILi2ELi2EEE is still used by 1 other objects.(Additional information: <none>)See the entry in the Frequently Asked Questions of deal.II (linked to from http://www.dealii.org/) for a lot more information on what this error means and how to fix programs in which it happens.Stacktrace:-----------#0 2 libdeal_II.g.8.5.0.dylib 0x000000011e04707c _ZNK6dealii11Subscriptor20check_no_subscribersEv + 3660: 2 libdeal_II.g.8.5.0.dylib 0x000000011e04707c _ZNK6dealii11Subscriptor20check_no_subscribersEv#1 3 libdeal_II.g.8.5.0.dylib 0x000000011e047292 _ZN6dealii11SubscriptorD2Ev + 34: 3 libdeal_II.g.8.5.0.dylib 0x000000011e047292 _ZN6dealii11SubscriptorD2Ev#2 4 libdeal_II.g.8.5.0.dylib 0x000000011e9c96c5 _ZN6dealii8ManifoldILi2ELi2EED2Ev + 21: 4 libdeal_II.g.8.5.0.dylib 0x000000011e9c96c5 _ZN6dealii8ManifoldILi2ELi2EED2Ev#3 5 step-49 0x000000010d18f0c5 _ZN6dealii17SphericalManifoldILi2ELi2EED2Ev + 21: 5 step-49 0x000000010d18f0c5 _ZN6dealii17SphericalManifoldILi2ELi2EED2Ev#4 6 step-49 0x000000010d18eaf5 _ZN6dealii17SphericalManifoldILi2ELi2EED1Ev + 21: 6 step-49 0x000000010d18eaf5 _ZN6dealii17SphericalManifoldILi2ELi2EED1Ev#5 7 step-49 0x000000010d18d663 _Z6grid_2v + 1891: 7 step-49 0x000000010d18d663 _Z6grid_2v#6 8 step-49 0x000000010d18eb09 main + 9: 8 step-49 0x000000010d18eb09 main#7 9 libdyld.dylib 0x00007fffe1c02255 start + 1: 9 libdyld.dylib 0x00007fffe1c02255 start--------------------------------------------------------make[3]: *** [CMakeFiles/run] Abort trap: 6make[2]: *** [CMakeFiles/run.dir/all] Error 2make[1]: *** [CMakeFiles/run.dir/rule] Error 2make: *** [run] Error 2
在 2018年3月28日星期三 UTC-7下午10:42:30,Jean-Paul Pelteret写道: