Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122208556
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
Wed, Jul 16, 16:10
Size
1 KB
Mime Type
text/x-c
Expires
Fri, Jul 18, 16:10 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27450383
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