Xfem
The Xfem Plugin
Loading...
Searching...
No Matches
xfemElement.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_XFEM_ELEMENT_H_
25#define _GEMA_XFEM_ELEMENT_H_
26
27#include <gmpCell.h>
28#include <gmpCellMeshData.h>
29#include <gmElement.h>
30
31#include <xfemConfig.h>
32#include "xfemLuaElement.h"
33
34#include <gmLuaCell.h>
35
36
40#define XFEM_ELEMENT_ENRICHED_MASK ((~(~0u >> 1)) >> (32 - GMP_GEMAMESH_CELL_ID_BITS))
41
44{
45public:
47 virtual bool enriched() const = 0;
48
56 const GmShape* enrichmentShape() const { return linearShape(); }
57
58protected:
59 friend class XfemMesh;
60
62 virtual void setEnriched(bool mode) = 0;
63};
64
65
67template <class Base, class Proxy, class CellMeshData, GmCellType T, int N> class XfemGemaElement
68 : public GmpGhostCell<Base, Proxy, CellMeshData, T, N>
69{
70public:
72 XfemGemaElement(int meshId, int id, int offset)
73 : GmpGhostCell<Base, Proxy, CellMeshData, T, N>(meshId, id, offset) {}
74
75 // See comments on base class.
76 virtual int cellId() const { return GmpGhostCell<Base, Proxy, CellMeshData, T, N>::cellId() & (~XFEM_ELEMENT_ENRICHED_MASK); }
77
80
81protected:
82
84 virtual void setEnriched(bool mode)
85 {
86 if(mode == enriched())
87 return;
88 replaceCellId(mode ? (cellId() | XFEM_ELEMENT_ENRICHED_MASK) : cellId(), true);
89 }
90};
91
92#endif
93
virtual const GmShape * linearShape() const
void replaceCellId(int id, bool keepActiveFlag)
Basic interface for an XFEM element.
Definition xfemElement.h:44
const GmShape * enrichmentShape() const
Returns a shape function object used in the element enrichment.
Definition xfemElement.h:56
virtual bool enriched() const =0
Returns true if this element has been enriched, false when not.
virtual void setEnriched(bool mode)=0
Marks the element as enriched or not.
Basic implementation for an Xfem element, based on a "standard" GeMA mesh element.
Definition xfemElement.h:69
virtual void setEnriched(bool mode)
Marks the element as enriched or not.
Definition xfemElement.h:84
XfemGemaElement(int meshId, int id, int offset)
Constructor.
Definition xfemElement.h:72
virtual bool enriched() const
Returns true if this element has been enriched, false when not.
Definition xfemElement.h:79
Basic class for a XFEM mesh. This is the basic mesh interface for xfem problems adding enrichment cap...
Definition xfemMesh.h:50
Declaration of useful configuration definitions for the plugin library.
#define XFEM_ELEMENT_ENRICHED_MASK
Mask with 1 on the most significant bit of the cell id to tell if the element has been enriched or no...
Definition xfemElement.h:40
Declaration of the XfemLuaElement class.