Download AV/code/read_mesh.cpp from mapengfei/mesh-cardiology: direct link, hf CLI and curl.
- Browser
- Download file 2.14 kB
-
https://huggingface.co/datasets/mapengfei/mesh-cardiology/resolve/main/AV/code/read_mesh.cpp
- Command line
-
hf download hf://datasets/mapengfei/mesh-cardiology/AV/code/read_mesh.cpp
-
curl -L -o read_mesh.cpp https://huggingface.co/datasets/mapengfei/mesh-cardiology/resolve/main/AV/code/read_mesh.cpp
2.14 kB
| namespace dolfin { | |
| class FiberDirection : public Expression | |
| { | |
| public: | |
| FiberDirection( | |
| std::shared_ptr<MeshFunction<double> > f0_0, | |
| std::shared_ptr<MeshFunction<double> > f0_1, | |
| std::shared_ptr<MeshFunction<double> > f0_2 | |
| ) : Expression(3), f0_0(f0_0), f0_1(f0_1), f0_2(f0_2) {} | |
| // Function for evaluating expression on each cell | |
| void eval(Array<double>& values, const Array<double>& x, const ufc::cell& cell) const | |
| { | |
| const uint D = cell.topological_dimension; | |
| const uint cell_index = cell.index; | |
| values[0] = (*c00)[cell_index]; | |
| values[1] = (*c01)[cell_index]; | |
| values[2] = (*c11)[cell_index]; | |
| } | |
| // The data stored in mesh functions | |
| std::shared_ptr<MeshFunction<double> > f0_0; | |
| std::shared_ptr<MeshFunction<double> > f0_1; | |
| std::shared_ptr<MeshFunction<double> > f0_2; | |
| }; | |
| } | |
| int main(){ | |
| double mesh_resolution = 120; | |
| double length = 74.4; | |
| double bottom = -115; | |
| double length_2 = 9.9; | |
| double bottom_2 = 5.1; | |
| std::cout << "Create solid mesh.\n"; | |
| auto domain_small = std::make_shared<mshr::Cylinder>(dolfin::Point(0.0,0.0,bottom), dolfin::Point(0.0,0.0,bottom+length), 13.182, 13.182); | |
| auto domain_big = std::make_shared<mshr::Cylinder>(dolfin::Point(0.0,0.0,bottom), dolfin::Point(0.0,0.0,bottom+length), 14.672, 14.672); | |
| auto domain_small_2 = std::make_shared<mshr::Cylinder>(dolfin::Point(0.0,0.0,bottom_2), dolfin::Point(0.0,0.0,bottom_2+length_2), 13.343, 13.343); | |
| auto domain_big_2 = std::make_shared<mshr::Cylinder>(dolfin::Point(0.0,0.0,bottom_2), dolfin::Point(0.0,0.0,bottom_2+length_2), 14.833, 14.833); | |
| auto domain = domain_big - domain_small + domain_big_2 - domain_small_2; | |
| auto solid_mesh = std::make_shared<ImmersedMesh>(mshr::generate_mesh(domain, mesh_resolution)); | |
| dolfin::File mesh_file_0("extended_tube.pvd"); | |
| mesh_file_0 << *solid_mesh->get_dolfin_mesh(); | |
| dolfin::XDMFFile mesh_file("/public/home/fenics/Mesh_1/valve/mesh.xdmf"); | |
| auto mesh = dolfin::Mesh(); | |
| mesh_file.read(mesh); | |
| mesh_file.close(); | |
| } |