TexGen
FibreDistributionConst.cpp
Go to the documentation of this file.
1/*=============================================================================
2TexGen: Geometric textile modeller.
3Copyright (C) 2006 Martin Sherburn
4
5This program is free software; you can redistribute it and/or
6modify it under the terms of the GNU General Public License
7as published by the Free Software Foundation; either version 2
8of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18=============================================================================*/
19
20#include "PrecompiledHeaders.h"
22#include "Section.h"
23
24using namespace TexGen;
25
26CFibreDistributionConst::CFibreDistributionConst()
27{
28}
29
31: CFibreDistribution(Element)
32{
33}
34
35void CFibreDistributionConst::PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
36{
38}
39
40double CFibreDistributionConst::IntegrateDistribution(const vector<XY> &Section) const
41{
42 return CSection::GetArea(Section);
43}
44
45double CFibreDistributionConst::GetVolumeFraction(const vector<XY> &Section, double dFibreArea, XY Location, int YarnIndex) const
46{
47 double dArea = IntegrateDistribution(Section);
48 double dVf = dFibreArea/dArea;
49 if (dVf>0.86||dVf<0)
50 {
51 if ( YarnIndex == -1)
52 {
53 TGERROR("Warning: Volume fraction is not realistic " << dVf);
54 }
55 else
56 {
57 TGERROR("Warning: Volume fraction is not realistic: " << dVf << ", Yarn: " << YarnIndex);
58 }
59 }
60 return dVf;
61}
62
63double CFibreDistributionConst::GetVolumeFraction(double dArea, double dFibreArea, int YarnIndex) const
64{
65 double dVf = dFibreArea/dArea;
66 if (dVf>0.86||dVf<0)
67 {
68 if ( YarnIndex == -1)
69 {
70 TGERROR("Warning: Volume fraction is not realistic " << dVf);
71 }
72 else
73 {
74 TGERROR("Warning: Volume fraction is not realistic: " << dVf << ", Yarn: " << YarnIndex);
75 }
76 }
77 return dVf;
78}
79
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
Definition: Logger.h:29
double IntegrateDistribution(const vector< XY > &Section) const
double GetVolumeFraction(const vector< XY > &Section, double dFibreArea, XY Location, int YarnIndex=-1) const
Get the volume fraction for a given location.
void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
Abstract base class that defines how the fibres are distributed within a yarn.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
static double GetArea(const vector< XY > &Section)
Get the area of a section.
Definition: Section.cpp:261
Namespace containing a series of customised math operations not found in the standard c++ library.
OUTPUT_TYPE
Definition: Misc.h:105
Struct for representing points in 2D space.
Definition: mymath.h:103