PLaSK library
Loading...
Searching...
No Matches
mixed.hpp
Go to the documentation of this file.
1/*
2 * This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3 * Copyright (c) 2022 Lodz University of Technology
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
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 General Public License for more details.
13 */
14#ifndef PLASK__MATERIAL_SPECIAL_H
15#define PLASK__MATERIAL_SPECIAL_H
16
21#include "material.hpp"
22
23namespace plask {
24
38
40 std::vector < std::pair<shared_ptr<Material>,double> > materials;
41
45 template<typename ...Args>
46 MixedMaterial(Args&&... params)
47 : materials(std::forward<Args>(params)...) {
48 }
49
53 void normalizeWeights();
54
60 MixedMaterial& add(const shared_ptr<Material>& material, double weight);
61
62 virtual ~MixedMaterial() {}
63
64 //Material methods implementation:
65 std::string name() const override;
66
67 Kind kind() const override;
68
69 double lattC(double T, char x) const override;
70
71 double Eg(double T, double e=0., char point='*') const override;
72
73 double CB(double T, double e=0., char point='*') const override;
74
75 double VB(double T, double e=0., char point='*', char hole='H') const override;
76
77 double Dso(double T, double e=0.) const override;
78
79 double Mso(double T, double e=0.) const override;
80
81 Tensor2<double> Me(double T, double e=0., char point='*') const override;
82
83 Tensor2<double> Mhh(double T, double e=0.) const override;
84
85 Tensor2<double> Mlh(double T, double e=0.) const override;
86
87 Tensor2<double> Mh(double T, double e=0.) const override;
88
89 double ac(double T) const override;
90
91 double av(double T) const override;
92
93 double b(double T) const override;
94
95 double d(double T) const override;
96
97 double c11(double T) const override;
98
99 double c12(double T) const override;
100
101 double c44(double T) const override;
102
103 double eps(double T) const override;
104
105 double chi(double T, double e=0., char point='*') const override;
106
107 double Ni(double T=0.) const override;
108
109 double Nf(double T=0.) const override;
110
111 double EactD(double T) const override;
112
113 double EactA(double T) const override;
114
115 Tensor2<double> mob(double T) const override;
116
117 Tensor2<double> cond(double T) const override;
118
119 ConductivityType condtype() const override;
120
121 double A(double T) const override;
122
123 double B(double T) const override;
124
125 double C(double T) const override;
126
127 double D(double T) const override;
128
129 Tensor2<double> thermk(double T, double h) const override;
130
131 double dens(double T) const override;
132
133 double cp(double T) const override;
134
135 double nr(double lam, double T, double n = 0.0) const override;
136
137 double absp(double lam, double T) const override;
138
139 dcomplex Nr(double lam, double T, double n = 0.0) const override;
140
141 Tensor3<dcomplex> Eps(double lam, double T, double n = 0.0) const override;
142
143 Tensor2<double> mobe(double T) const override;
144
145 Tensor2<double> mobh(double T) const override;
146
147 double taue(double T) const override;
148
149 double tauh(double T) const override;
150
151 double Ce(double T) const override;
152
153 double Ch(double T) const override;
154
155 double e13(double T) const override;
156
157 double e15(double T) const override;
158
159 double e33(double T) const override;
160
161 double c13(double T) const override;
162
163 double c33(double T) const override;
164
165 double Psp(double T) const override;
166
167 double Na() const override;
168
169 double Nd() const override;
170
171private:
172
179 template <typename Functor>
180 auto avg(Functor f) const -> typename std::remove_cv<decltype(f(*((const Material*)0)))>::type {
181 typename std::remove_cv<decltype(f(*((const Material*)0)))>::type w_sum = 0.;
182 for (auto& p: materials) {
183 w_sum += std::get<1>(p) * f(*std::get<0>(p));
184 }
185 return w_sum;
186 }
187
194 template <typename Functor>
195 auto avg_pairs(Functor f) const -> Tensor2<double> {
196 Tensor2<double> w_sum(0., 0.);
197 for (auto& p: materials) {
198 Tensor2<double> m = f(*std::get<0>(p));
199 w_sum.c00 += std::get<1>(p) * m.c00; //std::get<1>(p) is weight of current material
200 w_sum.c11 += std::get<1>(p) * m.c11;
201 }
202 return w_sum;
203 }
204
205};
206
207} // namespace plask
208
209#endif // PLASK__MATERIAL_SPECIAL_H