Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91282449
test_computeTemp.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 9, 15:44
Size
1 KB
Mime Type
text/x-c
Expires
Mon, Nov 11, 15:44 (2 d)
Engine
blob
Format
Raw Data
Handle
22235808
Attached To
R7561 SP4E_HW1
test_computeTemp.cc
View Options
#include "my_types.hh"
#include "fft.hh"
#include "material_point.hh"
#include "compute_temperature.hh"
#include <gtest/gtest.h>
/*****************************************************************/
// Fixture class
class
material
:
public
::
testing
::
Test
{
protected
:
void
SetUp
()
override
{
std
::
vector
<
MaterialPoint
>
points
;
for
(
int
i
=
0
;
i
<
size
*
size
;
i
++
)
{
MaterialPoint
p
;
Vector
position
;
position
[
0
]
=
(
i
%
size
)
*
(
2.0
/
size
);
position
[
1
]
=
int
(
i
/
size
)
*
(
2.0
/
size
);
position
[
2
]
=
0
;
p
.
getPosition
()
=
position
;
p
.
getTemperature
()
=
0.0
;
p
.
getHeatRate
()
=
0.0
;
points
.
push_back
(
p
);
}
for
(
auto
&
p
:
points
)
{
system
.
addParticle
(
std
::
make_shared
<
MaterialPoint
>
(
p
));
}
computeTemp
=
std
::
make_shared
<
ComputeTemperature
>
();
}
int
size
=
10
;
System
system
;
std
::
shared_ptr
<
ComputeTemperature
>
computeTemp
;
};
/*****************************************************************/
TEST_F
(
material
,
uniformInit
)
{
computeTemp
->
compute
(
system
);
for
(
int
i
=
0
;
i
<
size
*
size
;
i
++
)
{
auto
&
p
=
static_cast
<
MaterialPoint
&>
(
system
.
getParticle
(
i
));
ASSERT_NEAR
(
p
.
getTemperature
(),
0.0
,
1e-15
);
}
}
Event Timeline
Log In to Comment