OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
|
#include <interface.h>
Public Member Functions | |
Interface () | |
Constructor. More... | |
virtual | ~Interface () |
virtual const char * | giveClassName () const =0 |
Class Interface.
Interface class is abstract base class. Its role is to provide a base class for all interfaces. The interface represent some well defined additional or optional ability or support, which is provided by some class. The services and attributes are encapsulated in particular interface class, which is required to be derived from base Interface class. The class which wants to implement interface will simply inherits corresponding interface class. Each base class, whose derived classes are assumed to implement some interfaces, will declare the getInterface(InterfaceType) method. This method must be implemented by each derived class implementing some interface and returns pointer to corresponding interface. This service provides general way, how to access particular interface of given class.
The interface concept can be illustrated on following simple example. Let's have an error estimator, represented by corresponding class. This estimator requires some special services at the element level. Because typically not all elements provide support for this error estimator, it would be wasting of space to declare required services in general element base class. (This will lead to big and extremely general interface declared by base class, with only some services compulsory and with many optional services. This can lead to confusion and very unclear structure). Suggested remedy is to declare corresponding interface to error estimator. The interface should declare all services needed by error estimator. Particular elements, which would like to provide support for error estimator, simply derive itself from corresponding interface and implement services from interface. If error estimator wants to access its interface, it asks element for pointer to its corresponding interface (getInterface method). Once interface is returned, error estimator can use its services to compute response.
Some difficulty may arise, when implementing general interface service, requiring general services from class implementing interface. Then simple "trick" can be made: The interface should declare service giveClass(), which returns the pointer to class which implements interface. After having this pointer, the interface general service can use all (but only public) services of class implementing interface. For example some service utilizing the integration over element volume can be formulated as general, but when interface is defined, there is no connection to element implementing it. This connection can be established by declaring virtual giveElement() service, which returns the pointer to element implementing the interface. Then general implementation at interface class level can be made, using base Element class public services. Then all element classes implementing the interface should overload only giveElement service, but not the whole service with integration.
Interfaces provide a way, how to organize or group optional or function-specific services into clearly defined units (well structured code) which can be selectively implemented by some classes.
Definition at line 82 of file interface.h.
|
inline |
Constructor.
Definition at line 86 of file interface.h.
|
inlinevirtual |
Definition at line 87 of file interface.h.
|
pure virtual |
Implemented in oofem::VTKXMLExportModuleElementInterface, oofem::LatticeDamage2d, oofem::MDM, oofem::IsotropicDamageMaterial1, oofem::LatticeDamage2dStatus, oofem::FailureModuleElementInterface, oofem::Shell7BaseXFEM, oofem::Beam3d, oofem::MITC4Shell, oofem::Beam2d, oofem::MDMStatus, oofem::DKTPlate, oofem::IsotropicDamageMaterial1Status, oofem::QDKTPlate, oofem::RCSDNLMaterial, oofem::Brick1_mt, oofem::TR1_2D_SUPG, oofem::QWedge_mt, oofem::Wedge_mt, oofem::TR1_2D_SUPG2, oofem::IDNLMaterial, oofem::MazarsMaterial, oofem::RerShell, oofem::DKTPlate3d, oofem::MazarsNLMaterial, oofem::FRCFCMNL, oofem::Quad1_mt, oofem::Tr1_hmt, oofem::CCTPlate3d, oofem::IDGMaterialStatus, oofem::IsotropicLinearElasticMaterial, oofem::ConcreteFCM, oofem::LIBeam3d2, oofem::Brick1_hmt, oofem::QWedge_hmt, oofem::CCTPlate, oofem::Wedge_hmt, oofem::TrPlaneStrRot3d, oofem::Quad1MindlinShell3D, oofem::Tr2Shell7, oofem::MisesMatNl, oofem::Lattice2d_mt, oofem::TR1_2D_CBS, oofem::LinQuad3DPlaneStress, oofem::HydratingIsoHeatMaterial, oofem::TrPlaneStrain, oofem::RankineMatNl, oofem::Truss1d, oofem::TrabBoneNLEmbed, oofem::Quad1_hmt, oofem::Tetrah1_hmt, oofem::Tr1_mt, oofem::Tr2Shell7XFEM, oofem::FRCFCMStatus, oofem::RankineMatGrad, oofem::QBrick1_hmt, oofem::Tet1BubbleStokes, oofem::TR1_2D_SUPG2_AXI, oofem::LSpace, oofem::Truss3d, oofem::Quad1PlaneStrain, oofem::PlaneStress2d, oofem::TrabBoneNL3D, oofem::TrPlanestressRotAllman3d, oofem::TrabBoneNL, oofem::TR1_2D_SUPG_AXI, oofem::Tr1BubbleStokes, oofem::Axisymm3d, oofem::TrabBoneGrad3D, oofem::tet21ghostsolid, oofem::Tr21Stokes, oofem::FRCFCMNLStatus, oofem::MisesMatGrad, oofem::TrPlaneStress2d, oofem::QTRSpace, oofem::LIBeam3d, oofem::TrPlanestressRotAllman, oofem::TR_SHELL01, oofem::QuadAxisym1_mt, oofem::Tet21Stokes, oofem::LIBeam2d, oofem::TR_SHELL02, oofem::Quad1Mindlin, oofem::Hexa21Stokes, oofem::LIBeam2dNL, oofem::Shell7Base, oofem::XfemElementInterface, oofem::QSpace, oofem::QWedge, oofem::SolidShell, oofem::Tr1Darcy, oofem::TrPlaneStrRot, oofem::IDNLMaterialStatus, oofem::LargeStrainMasterMaterialGrad, oofem::LWedge, oofem::MazarsMaterialStatus, oofem::RCSDNLMaterialStatus, oofem::QTrPlaneStrain, oofem::HydratingHeMoMaterial, oofem::LTRSpace, oofem::Q27Space, oofem::ConcreteFCMStatus, oofem::Line2BoundaryElement, oofem::LineDistributedSpring, oofem::QTrPlaneStress2d, oofem::Quad1PlateSubSoil, oofem::Tria1PlateSubSoil, oofem::QuadAxisym1_hmt, oofem::MisesMatNlStatus, oofem::TrabBoneNLEmbedStatus, oofem::MazarsNLMaterialStatus, oofem::TrPlaneStress2dXFEM, oofem::QWedge_ht, oofem::TrabBoneNL3DStatus, oofem::Wedge_ht, oofem::Quad10_2D_SUPG, oofem::Q4Axisymm, oofem::QTrPlaneStress2dXFEM, oofem::TR21_2D_SUPG, oofem::Quad2PlateSubSoil, oofem::L4Axisymm, oofem::TrabBoneNLStatus, oofem::RankineMatNlStatus, oofem::RankineMatGradStatus, oofem::Brick1_ht, oofem::QBrick1_ht, oofem::MacroLSpace, oofem::Tr_Warp, oofem::TrabBoneGrad3DStatus, oofem::IDGMaterial, oofem::Tetrah1_ht, oofem::Tr1_ht, oofem::QSpaceGrad, oofem::PlaneStressPhF2d, oofem::PlaneStress2dXfem, oofem::QPlaneStress2d, oofem::Quad1_ht, oofem::QTRSpaceGrad, oofem::QWedgeGrad, oofem::Q9PlaneStress2d, oofem::QPlaneStressPhF2d, oofem::MisesMatGradStatus, oofem::QPlaneStrain, oofem::HydratingTransportMaterialStatus, oofem::Tet1_3D_SUPG, oofem::QPlaneStrainGrad, oofem::QPlaneStressGrad, oofem::QTrPlaneStressGrad, oofem::QuadAxisym1_ht, oofem::QTrPlaneStrainGrad, oofem::LSpaceBB, and oofem::TrAxisym1_ht.