← Back to team overview

dolfin team mailing list archive

Re: Subdomain.mark

 

On Mon, Mar 31, 2008 at 03:52:57PM +0200, Murtazo Nazarov wrote:
> Hi,
> 
> I want to apply a boundary condition to the vertices on a boundary. For that I define:
> 
> // Sub domain for MyBC                                                                             
> class MyBC_Boundary2D : public SubDomain
> {
> public:
>   bool inside(const real* p, bool on_boundary) const
>   {
>     return  on_boundary && (p[0] < xmax - bmarg) && (p[0] > xmin + bmarg);
>   }
> };
> 
> Then I initialize:
> //-----------------------------------------------------------------------------                      
> void MyBC::init(SubDomain& sub_domain)
> { ...
>   mesh.init(0);
>   sub_domains = new MeshFunction<uint>(mesh, 0);
> ...}

Do you remember to set everything to 1 (number of subdomains) here?

-- 
Anders


> and skip interior nodes:
> 
> void MyBC::apply(...)
> {...
>   for (VertexIterator vertex(mesh); !vertex.end();++vertex)
>     {
>       // Skip facets not inside the sub domain
>       if ( (*sub_domains)(*vertex) != sub_domain )
>         {
>           continue;
>         }
>       cout << "vertex = " << (*vertex).index() << endl;
>     }
> ...}
> 
> But, it still does not skip interior nodes. Do I do something wrong or there
> should be some changes in subdomain.mark?
> 
> /murtazo


Follow ups

References