22#include "../units/units.h"
30 static double ColorArray[][3] =
43 double* Color = ColorArray[iIndex%(
sizeof(ColorArray)/(3*
sizeof(
double)))];
44 return COLOR(Color[0], Color[1], Color[2]);
47 void CopyToRange(vector<XYZ> &Offsets,
XYZ Vector,
int iLowerLimit,
int iUpperLimit)
49 vector<XYZ> OriginalOffsets = Offsets;
50 vector<XYZ>::iterator itOffset;
53 for (i=iLowerLimit; i<=iUpperLimit; ++i)
55 for (itOffset=OriginalOffsets.begin(); itOffset != OriginalOffsets.end(); ++itOffset)
57 Offsets.push_back(*itOffset+i*Vector);
63 double ConvertUnits(
double dValue, std::string SourceUnits, std::string TargetUnits)
65 units_clear_exception();
66 double dResult = dValue*units_convert(
const_cast<char*
>(SourceUnits.c_str()),
const_cast<char*
>(TargetUnits.c_str()));
67 char* szError = units_check_exception();
69 TGERROR(
"Error converting units: " << szError);
73 bool CompatibleUnits(std::string SourceUnits, std::string TargetUnits, std::string *pErrorMessage)
75 units_clear_exception();
76 units_convert(
const_cast<char*
>(SourceUnits.c_str()),
const_cast<char*
>(TargetUnits.c_str()));
77 char* szError = units_check_exception();
81 *pErrorMessage = szError;
90 units_clear_exception();
91 std::string Result = units_reduce(
const_cast<char*
>(Units.c_str()));
92 char* szError = units_check_exception();
94 TGERROR(
"Error reducing units: " << szError);
100 units_clear_exception();
101 units_new(
const_cast<char*
>(NewUnit.c_str()),
const_cast<char*
>(BaseUnits.c_str()));
102 char* szError = units_check_exception();
104 TGERROR(
"Error adding new units: " << szError);
109 int iPos = Filename.find_last_of(
"\\/");
110 if (iPos == std::string::npos)
113 return Filename.substr(iPos+1);
118 if (Filename.size()<Extension.size() || Filename.rfind(Extension) != Filename.size()-Extension.size())
119 Filename += Extension;
124 int iPos = Filename.rfind(Extension);
125 if (iPos == std::string::npos)
127 return Filename.substr(0, iPos);
132 int iPos = Filename.find_last_of(
"\\/");
133 int iEnd = Filename.size();
135 if (iPos == std::string::npos)
138 str = Filename.substr(iPos+1);
142 found=str.find_first_of(
" ");
143 while (found!=string::npos)
146 found=str.find_first_of(
" ",found+1);
149 if (iPos == std::string::npos)
153 return Filename.replace( iPos+1, iEnd, str );
159 Output <<
"********************" << std::endl;
160 Output <<
"*** ORIENTATIONS ***" << std::endl;
161 Output <<
"********************" << std::endl;
162 Output <<
"** Orientation vectors" << std::endl;
163 Output <<
"** 1st vector represents the fibre direction" << std::endl;
164 Output <<
"** 2nd vector is an arbitrary vector perpendicular to the first" << std::endl;
169 Output <<
"********************" << std::endl;
170 Output <<
"*** ELEMENT DATA ***" << std::endl;
171 Output <<
"********************" << std::endl;
172 Output <<
"** Element data stored as a depvars " << std::endl;
173 Output <<
"** 1 - Element index" << std::endl;
174 Output <<
"** 2 - Yarn Index (-1 for matrix, first yarn starting at 0) " << std::endl;
175 Output <<
"** 3/4 - Location (x and y cross-section coordinates of element relative to yarn centerline) " << std::endl;
176 Output <<
"** 5 - Volume fraction " << std::endl;
177 Output <<
"** 6 - Distance of element from the surface of the yarn (for yarn elements only, distance is negative) " << std::endl;
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
Namespace containing a series of customised math operations not found in the standard c++ library.
std::string RemoveExtension(std::string &Filename, std::string Extension)
Strip the extension from the filename.
std::string StripPath(std::string Filename)
Strip the path from the filename (e.g. "c:\folder\file.ext -> file.ext")
std::string ReplaceFilenameSpaces(std::string Filename)
Replaces spaces in filename with underscore.
void CopyToRange(vector< XYZ > &Offsets, XYZ Vector, int iLowerLimit, int iUpperLimit)
void WriteElementsHeader(std::ostream &Output)
Write elements header for ABAQUS .eld files.
void WriteOrientationsHeader(std::ostream &Output)
Write orientations header for ABAQUS .ori files.
COLOR GetIndexedColor(int iIndex)
bool CompatibleUnits(std::string SourceUnits, std::string TargetUnits, std::string *pErrorMessage)
std::string ReduceUnits(std::string Units)
void AddNewUnits(std::string NewUnit, std::string BaseUnits)
void AddExtensionIfMissing(std::string &Filename, std::string Extension)
Adds an extension to the filename if it is missing otherwise do nothing (e.g. picture -> picture....
double ConvertUnits(double dValue, std::string SourceUnits, std::string TargetUnits)
Struct for representing points in 3D space.