Xfem
The Xfem Plugin
Loading...
Searching...
No Matches
xfemFactory.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_FACTORY_H_
25#define _GEMA_XFEM_FACTORY_H_
26
27#include <QObject>
28
29#include <gmpFemPhysicsCommonMaterial.h>
31#include <gmpMaterialModifMohrCoulomb.h>
32#include <gmpMaterialDruckerPrager.h>
33#include <gmpMaterialElastic.h>
34#include <gmSimulationData.h>
35#include <gmPluginLoader.h>
36#include <gmpMechanic.h>
37#include <gmpHydraulic.h>
38#include <gmpHydraulicFlow.h>
39#include <gmpMaterialSaturated.h>
40#include <gmpMaterialCubicLaw.h>
41#include <gmPluginInfo.h>
42
45#include "xfemHMCoupled.h"
46#include "xfemMechanic.h"
47#include "xfemMaterial.h"
48#include "xfemProcess.h"
49#include "xfemMesh.h"
50
51#include "xfemVersion.h"
52
55{
57 Q_PLUGIN_METADATA(IID GmPluginObjectFactoryInterfaceIID)
59
60public:
63
64 // See comments on the base class method declaration
65 virtual GmPluginObject* instance(QString category, QString objType, GmSimulationData* simulation,
66 QString id, QString description)
67 {
68 assert(category == GM_PLUGIN_MESH || category == GM_PLUGIN_PHYSICS || category == GM_PLUGIN_PROCESS);
69
70 if(category == GM_PLUGIN_MESH)
71 {
72 if(objType == "mesh")
73 return new XfemGemaMesh(simulation, id, description, logger());
74 else
75 return NULL;
76 }
77 else if(category == GM_PLUGIN_PROCESS)
78 {
79 if(objType == "xfem")
80 return new XfemProcess(simulation, id, description, logger());
81 else
82 return NULL;
83 }
84 else if (category == GM_PLUGIN_PHYSICS)
85 {
86 // If this is the first time that instance() is called, lets register material types
87 static GmpFemPhysicsCommonMaterialFactory matFactory;
88 if (matFactory.numMaterialTypes() == 0)
89 {
90 const GmPluginInfo* ourInfo = simulation->loader()->pluginInfo("Xfem");
91 assert(ourInfo);
92 const QVariantMap& map = ourInfo->attributes().value("constants").value<QVariantMap>().value("materialModels").value<QVariantMap>();
93
94 // Instance the requested material object
95 //mechanical xfem material
96 matFactory.registerMaterial(map.value("elastic").toInt(), "elastic", XfemMaterial::instance, true);
97 matFactory.registerMaterial(map.value("vonMises").toInt(), "vonMises", XfemMaterial::instance);
98 matFactory.registerMaterial(map.value("druckerPrager").toInt(), "druckerPrager", XfemMaterial::instance);
99 matFactory.registerMaterial(map.value("modifiedMohrCoulomb").toInt(), "modifiedMohrCoulomb", XfemMaterial::instance);
100
101 //hydraulic xfem material
102 matFactory.registerMaterial(map.value("saturated").toInt(), "saturated", GmpHydraulicMaterialSaturated::instance);
103 matFactory.registerMaterial(map.value("cubicLaw").toInt(), "cubicLaw", GmpMaterialCubicLaw::instance);
104
105 //hydroMechanical xfem material
106 matFactory.registerMaterial(map.value("poroElastic").toInt(), "poroElastic", XfemHydroMechanicalMaterial::instance, true);
107 matFactory.registerMaterial(map.value("poroDruckerPrager").toInt(), "poroDruckerPrager", XfemHydroMechanicalMaterial::instance);
108
109 assert(matFactory.checkTypeMap());
110 }
111
112 // Instance the requested physics object
113 if (objType == "PlaneStrain")
114 {
115 return new GmpMechanic<XfemMechanic>("PlaneStrain", simulation, id, description, &matFactory, logger());
116 }
117 else if (objType == "PlaneStress")
118 {
119 return new GmpMechanic<XfemMechanic>("PlaneStress", simulation, id, description, &matFactory, logger());
120 }
121 else if (objType == "3D")
122 {
123 return new GmpMechanic<XfemMechanic>("3D", simulation, id, description, &matFactory, logger());
124 }
125 else if (objType == "HydroMechanic")
126 {
127 return new GmpMechanic<XfemHMCoupled>("HydroMechanic", simulation, id, description, &matFactory, logger());
128 }
129 else if (objType == "HydroMechanic3D")
130 {
131 return new GmpMechanic<XfemHMCoupled>("HydroMechanic3D", simulation, id, description, &matFactory, logger());
132 }
133 else if (objType == "embeddedPE")
134 {
135 return new GmpMechanic<XfemMechanicEmbeddedFracture>("embeddedPE", simulation, id, description, &matFactory, logger());
136 }
137 else if (objType == "embeddedPS")
138 {
139 return new GmpMechanic<XfemMechanicEmbeddedFracture>("embeddedPS", simulation, id, description, &matFactory, logger());
140 }
141 else if (objType == "embedded3D")
142 {
143 return new GmpMechanic<XfemMechanicEmbeddedFracture>("embedded3D", simulation, id, description, &matFactory, logger());
144 }
145 else
146 {
147 return NULL;
148 }
149 }
150 return NULL;
151 }
152
154 virtual const QMap<QString, QString>& versionInfo() const { return XfemVersionInfo(); }
155
157 virtual const QStringList& depVersionInfo() const { return XfemRevisionDependencies(); }
158};
159
160#endif
161
const QVariantMap & attributes() const
GmPluginInfo * pluginInfo(QString pluginName) const
const GmLogCategory & logger()
GmPluginLoader * loader() const
Implementation of the Xfem factory plugin.
Definition xfemFactory.h:55
virtual const QMap< QString, QString > & versionInfo() const
Retuns version information for the plugin. See comments on the base class.
Definition xfemFactory.h:154
XfemFactory()
Default constructor.
Definition xfemFactory.h:62
virtual const QStringList & depVersionInfo() const
Retuns dependency version information for the plugin. See comments on the base class.
Definition xfemFactory.h:157
Implementation of the XfemMesh interface based on the standard GeMA mesh plugin.
Definition xfemMesh.h:210
static GmpFemPhysicsCommonMaterial * instance(GmSimulationData *simulation, int typeIndex, QString typeName, const GmLogCategory &logger)
A "factory" function used to register the material with the physics material factory.
Definition xfemHydroMechanicalMaterial.h:58
static GmpFemPhysicsCommonMaterial * instance(GmSimulationData *simulation, int typeIndex, QString typeName, const GmLogCategory &logger)
A "factory" function used to register the material with the physics material factory.
Definition xfemMaterial.h:53
Basic class for the XFEM Process plugin object.
Definition xfemProcess.h:37
#define GmPluginObjectFactoryInterfaceIID
Q_INTERFACES(...)
Q_OBJECTQ_OBJECT
Declaration of the hydroMechanical coupled xfem class.
Declaration of the xfemHydroMechanicalMaterial classes.
Declaration of the xfemMaterial classes.
Declaration of the xfemMechanic classes.
Declaration of the xfemHydraulicEmbedded classes.
Declaration of the XfemMesh class.
Declaration of the XfemProcess class.