Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
a77e8cb0
Commit
a77e8cb0
authored
3 years ago
by
Wuttke, Joachim
Committed by
Wuttke, Joachim
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
single-use test ff-triangle moved to libformfactor
parent
5bbff90a
No related branches found
No related tags found
1 merge request
!488
start using libformfactor
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/SingleUse/ff-triangle.cpp
+0
-52
0 additions, 52 deletions
Tests/SingleUse/ff-triangle.cpp
with
0 additions
and
52 deletions
Tests/SingleUse/ff-triangle.cpp
deleted
100644 → 0
+
0
−
52
View file @
5bbff90a
#include
"Base/Math/Constants.h"
#include
"Sample/LibFF/PolyhedralComponents.h"
#include
"Tests/GTestWrapper/google_test.h"
#include
<cstdio>
//! Ad-hoc test of triangle form factor.
//!
//! Used while preparing polyhedral form factor manuscript for publication - JWu, dec 2020.
//!
//! To reactivate this code, just move in to ../UnitTest/Numeric/.
class
FFTriangleTest
:
public
::
testing
::
Test
{
};
TEST_F
(
FFTriangleTest
,
Triangle
)
{
const
double
a
=
1.
;
const
double
as
=
a
/
2
;
const
double
ac
=
a
/
sqrt
(
3
)
/
2
;
const
double
ah
=
a
/
sqrt
(
3
);
const
std
::
vector
<
R3
>
V
{{
-
ac
,
as
,
0.
},
{
-
ac
,
-
as
,
0.
},
{
ah
,
0.
,
0.
}};
const
PolyhedralFace
T
(
V
,
false
);
EXPECT_NEAR
(
T
.
area
(),
sqrt
(
3
)
/
4
,
1e-15
);
int
failures
=
0
;
const
int
M
=
37
;
for
(
int
j
=
0
;
j
<
M
;
++
j
)
{
const
double
phi
=
M_PI_2
*
j
/
(
M
-
1
);
const
C3
uQ
{
sin
(
phi
),
cos
(
phi
),
0.
};
const
int
N
=
2800
+
j
;
for
(
int
i
=
0
;
i
<
N
;
++
i
)
{
const
double
q
=
1e-17
*
pow
(
1.7e17
,
i
/
(
N
-
1.
));
const
C3
Q
=
uQ
*
q
;
const
double
f1
=
std
::
abs
(
T
.
ff_2D_direct
(
Q
));
const
double
f2
=
std
::
abs
(
T
.
ff_2D_expanded
(
Q
));
const
double
relerr
=
std
::
abs
(
f1
-
f2
)
/
f2
;
if
(
relerr
>
7e-16
)
{
printf
(
"ERR1 %9.6f %16.11e %21.16e %21.16e %10.4e
\n
"
,
phi
,
q
,
f1
,
f2
,
relerr
);
++
failures
;
}
if
(
q
>
1e-7
)
continue
;
const
double
relerr2
=
std
::
abs
(
f1
-
T
.
area
())
/
f2
;
if
(
relerr2
>
7e-16
)
{
printf
(
"ERR2 %9.6f %16.11e %21.16e %21.16e %10.4e
\n
"
,
phi
,
q
,
f1
,
f2
,
relerr2
);
++
failures
;
}
}
}
EXPECT_EQ
(
failures
,
0
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment