ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since 78f75d02 was
79492222,
checked in by krzywon, 10 years ago
|
Changed the file and folder names to remove all SANS references.
|
-
Property mode set to
100644
|
File size:
1.7 KB
|
Rev | Line | |
---|
[aa639ea] | 1 | /** \file hollowsphere.cc */ |
---|
| 2 | #include <cmath> |
---|
| 3 | #include <cassert> |
---|
| 4 | #include "hollow_sphere.h" |
---|
| 5 | |
---|
| 6 | HollowSphere::HollowSphere() |
---|
| 7 | { |
---|
| 8 | ro_ = 0; |
---|
| 9 | th_ = 0; |
---|
| 10 | } |
---|
| 11 | |
---|
| 12 | HollowSphere::HollowSphere(double radius, double thickness) |
---|
| 13 | { |
---|
| 14 | ro_ = radius; |
---|
| 15 | th_ = thickness; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | double HollowSphere::GetMaxRadius() |
---|
| 19 | { |
---|
| 20 | double maxr = ro_; |
---|
| 21 | return maxr; |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | void HollowSphere::GetFormFactor(IQ * iq) |
---|
| 25 | { |
---|
| 26 | /** number of I for output, equal to the number of rows of array IQ*/ |
---|
| 27 | int numI = iq->iq_data.dim1(); |
---|
| 28 | double qmin = iq->GetQmin(); |
---|
| 29 | double qmax = iq->GetQmax(); |
---|
| 30 | |
---|
| 31 | assert(numI > 0); |
---|
| 32 | assert(qmin > 0); |
---|
| 33 | assert(qmax > 0); |
---|
| 34 | assert( qmax > qmin ); |
---|
| 35 | |
---|
| 36 | double logMin = log10(qmin); |
---|
| 37 | double z = logMin; |
---|
| 38 | double logMax = log10(qmax); |
---|
| 39 | double delta = (logMax - logMin) / (numI-1); |
---|
| 40 | |
---|
| 41 | //not finished yet, need to find the part which is equal to 1 |
---|
| 42 | for(int i = 0; i < numI; ++i) { |
---|
| 43 | |
---|
| 44 | /** temp for Q*/ |
---|
| 45 | double q = pow(z,10); |
---|
| 46 | |
---|
| 47 | double ri_ = ro_ - th_ ; |
---|
| 48 | |
---|
| 49 | double bes1 = 3.0 * (sin(q*ri_) - q*ri_*cos(q*ri_)) / triple(q) / triple(ri_); |
---|
| 50 | double bes2 = 3.0 * (sin(q*ro_) - q*ro_*cos(q*ro_)) / triple(q) / triple(ro_); |
---|
| 51 | double bes = (triple(ro_)*bes1 - triple(ri_)*bes2)/(triple(ro_) - triple(ri_)); |
---|
| 52 | /** double f is the temp for I, should be equal to one when q is 0*/ |
---|
| 53 | double f = bes * bes; |
---|
| 54 | |
---|
| 55 | /** IQ[i][0] is Q,Q starts from qmin (non zero),q=0 handle separately IQ[i][1] is I */ |
---|
| 56 | iq->iq_data[i][0]= q; |
---|
| 57 | iq->iq_data[i][1]= f; |
---|
| 58 | |
---|
| 59 | z += delta; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | Point3D HollowSphere::GetAPoint(double sld) |
---|
| 65 | { |
---|
| 66 | return Point3D(0,0,0); |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | double HollowSphere::GetVolume() |
---|
| 70 | { |
---|
| 71 | return 0; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | bool HollowSphere::IsInside(const Point3D& point) const |
---|
| 75 | { |
---|
| 76 | return true; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | ShapeType HollowSphere::GetShapeType() const |
---|
| 80 | { |
---|
| 81 | return HOLLOWSPHERE; |
---|
| 82 | } |
---|
| 83 | |
---|
Note: See
TracBrowser
for help on using the repository browser.