summaryrefslogtreecommitdiff
path: root/CSXCAD/src/CSPropProbeBox.h
blob: a8997d7666d501a25e5bae195caf4052e1583879 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
*	Copyright (C) 2008-2012 Thorsten Liebig (Thorsten.Liebig@gmx.de)
*
*	This program is free software: you can redistribute it and/or modify
*	it under the terms of the GNU Lesser General Public License as published
*	by the Free Software Foundation, either version 3 of the License, or
*	(at your option) any later version.
*
*	This program is distributed in the hope that it will be useful,
*	but WITHOUT ANY WARRANTY; without even the implied warranty of
*	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*	GNU Lesser General Public License for more details.
*
*	You should have received a copy of the GNU Lesser General Public License
*	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "CSProperties.h"


//! Continuous Structure Probe Property for calculating integral properties
/*!
 CSProbProbeBox is a class for calculating integral properties such as (static) charges, voltages or currents.
*/
class CSXCAD_EXPORT CSPropProbeBox : public CSProperties
{
public:
	CSPropProbeBox(ParameterSet* paraSet);
	CSPropProbeBox(CSProperties* prop);
	CSPropProbeBox(unsigned int ID, ParameterSet* paraSet);
	virtual ~CSPropProbeBox();

	//! Get PropertyType as a xml element name \sa PropertyType and GetType
	virtual const std::string GetTypeXMLString() const {return std::string("ProbeBox");}

	//! Define a number for this probe property \sa GetNumber
	void SetNumber(unsigned int val);
	//! Get the number designated to this probe property \sa SetNumber
	unsigned int GetNumber();

	//! Get the normal direction of this probe box (required by some types of probes)
	int GetNormalDir() const {return m_NormDir;}
	//! Set the normal direction of this probe box (required by some types of probes)
	void SetNormalDir(unsigned int ndir) {m_NormDir=ndir;}

	//! Define/Set the probe weighting \sa GetWeighting
	void SetWeighting(double weight) {m_weight=weight;}
	//! Get the probe weighting \sa GetWeighting
	double GetWeighting() {return m_weight;}

	//! Define the probe type (e.g. type=0 for a charge integration, can/must be defined by the user interface) \sa GetProbeType
	void SetProbeType(int type) {ProbeType=type;}
	//! Get the probe type \sa SetProbeType
	int GetProbeType() {return ProbeType;}

	//! Set the probe start time
	void SetStartTime(float value) {startTime=value;}
	//! Get the probe start time
	double GetStartTime() {return startTime;}

	//! Set the probe stop time
	void SetStopTime(float value) {stopTime=value;}
	//! Get the probe stop time
	double GetStopTime() {return stopTime;}

	size_t CountFDSamples() {return m_FD_Samples.size();}
	std::vector<double> *GetFDSamples()	{return &m_FD_Samples;}
	void ClearFDSamples() {m_FD_Samples.clear();}
	void AddFDSample(double freq) {m_FD_Samples.push_back(freq);}
	void AddFDSample(std::vector<double> *freqs);
	void AddFDSample(std::string freqs);

	virtual bool Write2XML(TiXmlNode& root, bool parameterised=true, bool sparse=false);
	virtual bool ReadFromXML(TiXmlNode &root);

protected:
	unsigned int uiNumber;
	int m_NormDir;
	double m_weight;
	int ProbeType;
	std::vector<double> m_FD_Samples;
	double startTime, stopTime;
};