1 /*
2 *	Copyright (C) 2008-2012 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 Lorentz/ Drude Dispersive Material Property
24 /*!
25   This Property can hold information about the special properties of Lorentz or Drude dispersive materials.
26   The Drude material model is a special case of the Lorentz material model.
27   \todo Add all the other parameter needed by this model
28   */
29 class CSXCAD_EXPORT CSPropLorentzMaterial : public CSPropDispersiveMaterial
30 {
31 public:
32 	CSPropLorentzMaterial(ParameterSet* paraSet);
33 	CSPropLorentzMaterial(CSProperties* prop);
34 	CSPropLorentzMaterial(unsigned int ID, ParameterSet* paraSet);
35 	virtual ~CSPropLorentzMaterial();
36 
37 	//! Get PropertyType as a xml element name \sa PropertyType and GetType
GetTypeXMLString()38 	virtual const std::string GetTypeXMLString() const {return std::string("LorentzMaterial");}
39 
40 	//! Set the epsilon plasma frequency
41 	void SetEpsPlasmaFreq(int order, double val, int ny=0) {SetValue(val,EpsPlasma[order],ny);}
42 	//! Set the epsilon plasma frequency
43 	int  SetEpsPlasmaFreq(int order, const std::string val, int ny=0)  {return SetValue(val,EpsPlasma[order],ny);}
44 	//! Get the epsilon plasma frequency
45 	double GetEpsPlasmaFreq(int order, int ny=0) {return GetValue(EpsPlasma[order],ny);}
46 	//! Get the epsilon plasma frequency as a string
47 	const std::string GetEpsPlasmaFreqTerm(int order, int ny=0) {return GetTerm(EpsPlasma[order],ny);}
48 
49 	//! Set the epsilon plasma frequency weighting
SetEpsPlasmaFreqWeightFunction(int order,const std::string val,int ny)50 	int SetEpsPlasmaFreqWeightFunction(int order, const std::string val, int ny) {return SetValue(val,WeightEpsPlasma[order],ny);}
51 	//! Get the epsilon plasma frequency weighting string
GetEpsPlasmaFreqWeightFunction(int order,int ny)52 	const std::string GetEpsPlasmaFreqWeightFunction(int order, int ny) {return GetTerm(WeightEpsPlasma[order],ny);}
53 	//! Get the epsilon plasma frequency weighting
GetEpsPlasmaFreqWeighted(int order,int ny,const double * coords)54 	double GetEpsPlasmaFreqWeighted(int order, int ny, const double* coords) {return GetWeight(WeightEpsPlasma[order],ny,coords)*GetEpsPlasmaFreq(order,ny);}
55 
56 	//! Set the epsilon lorentz pole frequency
57 	void SetEpsLorPoleFreq(int order, double val, int ny=0) {SetValue(val,EpsLorPole[order],ny);}
58 	//! Set the epsilon lorentz pole frequency
59 	int  SetEpsLorPoleFreq(int order, const std::string val, int ny=0)  {return SetValue(val,EpsLorPole[order],ny);}
60 	//! Get the epsilon lorentz pole frequency
61 	double GetEpsLorPoleFreq(int order, int ny=0) {return GetValue(EpsLorPole[order],ny);}
62 	//! Get the epsilon lorentz pole frequency as a string
63 	const std::string GetEpsLorPoleFreqTerm(int order, int ny=0) {return GetTerm(EpsLorPole[order],ny);}
64 
65 	//! Set the epsilon lorentz pole frequency weighting
SetEpsLorPoleFreqWeightFunction(int order,const std::string val,int ny)66 	int SetEpsLorPoleFreqWeightFunction(int order, const std::string val, int ny) {return SetValue(val,WeightEpsLorPole[order],ny);}
67 	//! Get the epsilon lorentz pole frequency weighting string
GetEpsLorPoleFreqWeightFunction(int order,int ny)68 	const std::string GetEpsLorPoleFreqWeightFunction(int order, int ny) {return GetTerm(WeightEpsLorPole[order],ny);}
69 	//! Get the epsilon lorentz pole frequency weighting
GetEpsLorPoleFreqWeighted(int order,int ny,const double * coords)70 	double GetEpsLorPoleFreqWeighted(int order, int ny, const double* coords) {return GetWeight(WeightEpsLorPole[order],ny,coords)*GetEpsLorPoleFreq(order,ny);}
71 
72 	//! Set the epsilon relaxation time
73 	void SetEpsRelaxTime(int order, double val, int ny=0) {SetValue(val,EpsRelaxTime[order],ny);}
74 	//! Set the epsilon relaxation time
75 	int  SetEpsRelaxTime(int order, const std::string val, int ny=0)  {return SetValue(val,EpsRelaxTime[order],ny);}
76 	//! Get the epsilon relaxation time
77 	double GetEpsRelaxTime(int order, int ny=0) {return GetValue(EpsRelaxTime[order],ny);}
78 	//! Get the epsilon relaxation time as a string
79 	const std::string GetEpsRelaxTimeTerm(int order, int ny=0) {return GetTerm(EpsRelaxTime[order],ny);}
80 
81 	//! Set the epsilon relaxation time weighting
SetEpsRelaxTimeWeightFunction(int order,const std::string val,int ny)82 	int SetEpsRelaxTimeWeightFunction(int order, const std::string val, int ny) {return SetValue(val,WeightEpsRelaxTime[order],ny);}
83 	//! Get the epsilon relaxation time weighting string
GetEpsRelaxTimeWeightFunction(int order,int ny)84 	const std::string GetEpsRelaxTimeWeightFunction(int order, int ny) {return GetTerm(WeightEpsRelaxTime[order],ny);}
85 	//! Get the epsilon relaxation time weighting
GetEpsRelaxTimeWeighted(int order,int ny,const double * coords)86 	double GetEpsRelaxTimeWeighted(int order, int ny, const double* coords) {return GetWeight(WeightEpsRelaxTime[order],ny,coords)*GetEpsRelaxTime(order,ny);}
87 
88 	//! Set the mue plasma frequency
89 	void SetMuePlasmaFreq(int order, double val, int ny=0)  {SetValue(val,MuePlasma[order],ny);}
90 	//! Set the mue plasma frequency
91 	int SetMuePlasmaFreq(int order, const std::string val, int ny=0)  {return SetValue(val,MuePlasma[order],ny);}
92 	//! Get the mue plasma frequency
93 	double GetMuePlasmaFreq(int order, int ny=0)  {return GetValue(MuePlasma[order],ny);}
94 	//! Get the mue plasma frequency string
95 	const std::string GetMueTermPlasmaFreq(int order, int ny=0)  {return GetTerm(MuePlasma[order],ny);}
96 
97 	//! Set the mue plasma frequency weighting
SetMuePlasmaFreqWeightFunction(int order,const std::string val,int ny)98 	int SetMuePlasmaFreqWeightFunction(int order, const std::string val, int ny) {return SetValue(val,WeightMuePlasma[order],ny);}
99 	//! Get the mue plasma frequency weighting string
GetMuePlasmaFreqWeightFunction(int order,int ny)100 	const std::string GetMuePlasmaFreqWeightFunction(int order, int ny) {return GetTerm(WeightMuePlasma[order],ny);}
101 	//! Get the mue plasma frequency weighting
GetMuePlasmaFreqWeighted(int order,int ny,const double * coords)102 	double GetMuePlasmaFreqWeighted(int order, int ny, const double* coords)  {return GetWeight(WeightMuePlasma[order],ny,coords)*GetMuePlasmaFreq(order,ny);}
103 
104 	//! Set the mue lorentz pole frequency
105 	void SetMueLorPoleFreq(int order, double val, int ny=0)  {SetValue(val,MueLorPole[order],ny);}
106 	//! Set the mue lorentz pole frequency
107 	int SetMueLorPoleFreq(int order, const std::string val, int ny=0)  {return SetValue(val,MueLorPole[order],ny);}
108 	//! Get the mue lorentz pole frequency
109 	double GetMueLorPoleFreq(int order, int ny=0)  {return GetValue(MueLorPole[order],ny);}
110 	//! Get the mue lorentz pole frequency string
111 	const std::string GetMueTermLorPoleFreq(int order, int ny=0)  {return GetTerm(MueLorPole[order],ny);}
112 
113 	//! Set the mue lorentz pole frequency weighting
SetMueLorPoleFreqWeightFunction(int order,const std::string val,int ny)114 	int SetMueLorPoleFreqWeightFunction(int order, const std::string val, int ny) {return SetValue(val,WeightMueLorPole[order],ny);}
115 	//! Get the mue lorentz pole frequency weighting string
GetMueLorPoleFreqWeightFunction(int order,int ny)116 	const std::string GetMueLorPoleFreqWeightFunction(int order, int ny) {return GetTerm(WeightMueLorPole[order],ny);}
117 	//! Get the mue lorentz pole frequency weighting
GetMueLorPoleFreqWeighted(int order,int ny,const double * coords)118 	double GetMueLorPoleFreqWeighted(int order, int ny, const double* coords)  {return GetWeight(WeightMueLorPole[order],ny,coords)*GetMueLorPoleFreq(order,ny);}
119 
120 	//! Set the mue relaxation time
121 	void SetMueRelaxTime(int order, double val, int ny=0)  {SetValue(val,MueRelaxTime[order],ny);}
122 	//! Set the mue relaxation time
123 	int SetMueRelaxTime(int order, const std::string val, int ny=0)  {return SetValue(val,MueRelaxTime[order],ny);}
124 	//! Get the mue relaxation time
125 	double GetMueRelaxTime(int order, int ny=0)  {return GetValue(MueRelaxTime[order],ny);}
126 	//! Get the mue relaxation time string
127 	const std::string GetMueTermRelaxTime(int order, int ny=0)  {return GetTerm(MueRelaxTime[order],ny);}
128 
129 	//! Set the mue relaxation time weighting
SetMueRelaxTimeWeightFunction(int order,const std::string val,int ny)130 	int SetMueRelaxTimeWeightFunction(int order, const std::string val, int ny) {return SetValue(val,WeightMueRelaxTime[order],ny);}
131 	//! Get the mue relaxation time weighting string
GetMueRelaxTimeWeightFunction(int order,int ny)132 	const std::string GetMueRelaxTimeWeightFunction(int order, int ny) {return GetTerm(WeightMueRelaxTime[order],ny);}
133 	//! Get the mue relaxation time weighting
GetMueRelaxTimeWeighted(int order,int ny,const double * coords)134 	double GetMueRelaxTimeWeighted(int order, int ny, const double* coords)  {return GetWeight(WeightMueRelaxTime[order],ny,coords)*GetMueRelaxTime(order,ny);}
135 
136 	virtual void Init();
137 	virtual bool Update(std::string *ErrStr=NULL);
138 
139 	virtual bool Write2XML(TiXmlNode& root, bool parameterised=true, bool sparse=false);
140 	virtual bool ReadFromXML(TiXmlNode &root);
141 
142 	virtual void ShowPropertyStatus(std::ostream& stream);
143 
144 protected:
145 	virtual void InitValues();
146 	virtual void DeleteValues();
147 	//! Epsilon and mue plasma frequncies
148 	ParameterScalar** EpsPlasma;
149 	ParameterScalar** MuePlasma;
150 	//! Epsilon and mue plasma frequncies weighting functions
151 	ParameterScalar** WeightEpsPlasma;
152 	ParameterScalar** WeightMuePlasma;
153 
154 	//! Epsilon and mue lorentz pole frequncies
155 	ParameterScalar** EpsLorPole;
156 	ParameterScalar** MueLorPole;
157 	//! Epsilon and mue lorentz pole frequncies weighting functions
158 	ParameterScalar** WeightEpsLorPole;
159 	ParameterScalar** WeightMueLorPole;
160 
161 	//! Relaxation times for epsilon and mue
162 	ParameterScalar** EpsRelaxTime;
163 	ParameterScalar** MueRelaxTime;
164 	//! Relaxation times for epsilon and mue weighting functions
165 	ParameterScalar** WeightEpsRelaxTime;
166 	ParameterScalar** WeightMueRelaxTime;
167 };
168