pyramidI.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "IOstreams.H"
00030
00031
00032
00033 namespace Foam
00034 {
00035
00036
00037
00038 template<class Point, class PointRef, class polygonRef>
00039 inline pyramid<Point, PointRef, polygonRef>::pyramid
00040 (
00041 polygonRef base,
00042 const Point& apex
00043 )
00044 :
00045 base_(base),
00046 apex_(apex)
00047 {}
00048
00049
00050 template<class Point, class PointRef, class polygonRef>
00051 inline pyramid<Point, PointRef, polygonRef>::pyramid(Istream& is)
00052 {
00053 is >> base_ >> apex_;
00054 is.check("pyramid::pyramid(Istream& is)");
00055 }
00056
00057
00058
00059
00060 template<class Point, class PointRef, class polygonRef>
00061 inline const Point& pyramid<Point, PointRef, polygonRef>::apex() const
00062 {
00063 return apex_;
00064 }
00065
00066 template<class Point, class PointRef, class polygonRef>
00067 inline polygonRef pyramid<Point, PointRef, polygonRef>::base() const
00068 {
00069 return base_;
00070 }
00071
00072
00073 template<class Point, class PointRef, class polygonRef>
00074 inline Point pyramid<Point, PointRef, polygonRef>::centre
00075 (
00076 const pointField& points
00077 ) const
00078 {
00079 return (3.0/4.0)*base_.centre(points) + (1.0/4.0)*apex_;
00080 }
00081
00082
00083 template<class Point, class PointRef, class polygonRef>
00084 inline vector pyramid<Point, PointRef, polygonRef>::height
00085 (
00086 const pointField& points
00087 ) const
00088 {
00089
00090 return (apex_ - base_.centre(points));
00091 }
00092
00093
00094 template<class Point, class PointRef, class polygonRef>
00095 inline scalar pyramid<Point, PointRef, polygonRef>::mag
00096 (
00097 const pointField& points
00098 ) const
00099 {
00100 return (1.0/3.0)*(base_.normal(points)&(height(points)));
00101 }
00102
00103
00104
00105
00106 template<class Point, class PointRef, class polygonRef>
00107 inline Istream& operator>>
00108 (
00109 Istream& is,
00110 pyramid<Point, PointRef, polygonRef>& p
00111 )
00112 {
00113 is >> p.base_ >> p.apex_;
00114 is.check("Istream& operator>>(Istream&, pyramid&)");
00115 return is;
00116 }
00117
00118
00119 template<class Point, class PointRef, class polygonRef>
00120 inline Ostream& operator<<
00121 (
00122 Ostream& os,
00123 const pyramid<Point, PointRef, polygonRef>& p
00124 )
00125 {
00126 os << p.base_ << tab << p.apex_ << nl;
00127 return os;
00128 }
00129
00130
00131
00132
00133 }
00134
00135
Copyright © 2000-2009 OpenCFD Ltd