1 /*
2 *	Copyright (C) 2013 Thorsten Liebig (Thorsten.Liebig@gmx.de)
3 *
4 *	This program is free software: you can redistribute it and/or modify
5 *	it under the terms of the GNU Lesser General Public License as published
6 *	by the Free Software Foundation, either version 3 of the License, or
7 *	(at your option) any later version.
8 *
9 *	This program is distributed in the hope that it will be useful,
10 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
11 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 *	GNU Lesser General Public License for more details.
13 *
14 *	You should have received a copy of the GNU Lesser General Public License
15 *	along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #pragma once
19 
20 #include "CSProperties.h"
21 #include "CSPropDispersiveMaterial.h"
22 
23 //! Continuous Structure Debye Dispersive Material Property
24 /*!
25   This Property can hold information about the special properties of Debye dispersive materials.
26   \todo Add all the other parameter needed by this model
27   */
28 class CSXCAD_EXPORT CSPropDebyeMaterial : public CSPropDispersiveMaterial
29 {
30 public:
31 	CSPropDebyeMaterial(ParameterSet* paraSet);
32 	CSPropDebyeMaterial(CSProperties* prop);
33 	CSPropDebyeMaterial(unsigned int ID, ParameterSet* paraSet);
34 	virtual ~CSPropDebyeMaterial();
35 
36 	//! Get PropertyType as a xml element name \sa PropertyType and GetType
GetTypeXMLString()37 	virtual const std::string GetTypeXMLString() const {return std::string("DebyeMaterial");}
38 
39 	//! Set the epsilon plasma frequency
40 	void SetEpsDelta(int order, double val, int ny=0) {SetValue(val,EpsDelta[order],ny);}
41 	//! Set the epsilon plasma frequency
42 	int  SetEpsDelta(int order, const std::string val, int ny=0)  {return SetValue(val,EpsDelta[order],ny);}
43 	//! Get the epsilon plasma frequency
44 	double GetEpsDelta(int order, int ny=0) {return GetValue(EpsDelta[order],ny);}
45 	//! Get the epsilon plasma frequency as a string
46 	const std::string GetEpsDeltaTerm(int order, int ny=0) {return GetTerm(EpsDelta[order],ny);}
47 
48 	//! Set the epsilon plasma frequency weighting
SetEpsDeltaWeightFunction(int order,const std::string val,int ny)49 	int SetEpsDeltaWeightFunction(int order, const std::string val, int ny) {return SetValue(val,WeightEpsDelta[order],ny);}
50 	//! Get the epsilon plasma frequency weighting string
GetEpsDeltaWeightFunction(int order,int ny)51 	const std::string GetEpsDeltaWeightFunction(int order, int ny) {return GetTerm(WeightEpsDelta[order],ny);}
52 	//! Get the epsilon plasma frequency weighting
GetEpsDeltaWeighted(int order,int ny,const double * coords)53 	double GetEpsDeltaWeighted(int order, int ny, const double* coords) {return GetWeight(WeightEpsDelta[order],ny,coords)*GetEpsDelta(order,ny);}
54 
55 	//! Set the epsilon relaxation time
56 	void SetEpsRelaxTime(int order, double val, int ny=0) {SetValue(val,EpsRelaxTime[order],ny);}
57 	//! Set the epsilon relaxation time
58 	int  SetEpsRelaxTime(int order, const std::string val, int ny=0)  {return SetValue(val,EpsRelaxTime[order],ny);}
59 	//! Get the epsilon relaxation time
60 	double GetEpsRelaxTime(int order, int ny=0) {return GetValue(EpsRelaxTime[order],ny);}
61 	//! Get the epsilon relaxation time as a string
62 	const std::string GetEpsRelaxTimeTerm(int order, int ny=0) {return GetTerm(EpsRelaxTime[order],ny);}
63 
64 	//! Set the epsilon relaxation time weighting
SetEpsRelaxTimeWeightFunction(int order,const std::string val,int ny)65 	int SetEpsRelaxTimeWeightFunction(int order, const std::string val, int ny) {return SetValue(val,WeightEpsRelaxTime[order],ny);}
66 	//! Get the epsilon relaxation time weighting string
GetEpsRelaxTimeWeightFunction(int order,int ny)67 	const std::string GetEpsRelaxTimeWeightFunction(int order, int ny) {return GetTerm(WeightEpsRelaxTime[order],ny);}
68 	//! Get the epsilon relaxation time weighting
GetEpsRelaxTimeWeighted(int order,int ny,const double * coords)69 	double GetEpsRelaxTimeWeighted(int order, int ny, const double* coords) {return GetWeight(WeightEpsRelaxTime[order],ny,coords)*GetEpsRelaxTime(order,ny);}
70 
71 	virtual void Init();
72 	virtual bool Update(std::string *ErrStr=NULL);
73 
74 	virtual bool Write2XML(TiXmlNode& root, bool parameterised=true, bool sparse=false);
75 	virtual bool ReadFromXML(TiXmlNode &root);
76 
77 	virtual void ShowPropertyStatus(std::ostream& stream);
78 
79 protected:
80 	virtual void InitValues();
81 	virtual void DeleteValues();
82 	//! Epsilon delta
83 	ParameterScalar** EpsDelta;
84 	//! Epsilon delta weighting functions
85 	ParameterScalar** WeightEpsDelta;
86 
87 	//! Relaxation times for epsilon
88 	ParameterScalar** EpsRelaxTime;
89 	//! Relaxation times for epsilon weighting functions
90 	ParameterScalar** WeightEpsRelaxTime;
91 };
92