Hi Yufei Fang,

changing the origin code to the followeing will be  ok.


void run3D()
{
Triangulation<2,3> triangulation;
GridIn<2,3> grid_in;
grid_in.attach_triangulation(triangulation);
std::ifstream input_file("../resource/3D.mphtxt");
grid_in.read_comsol_mphtxt(input_file);

std::ofstream out("grid3D.vtk");
GridOut       grid_out;
grid_out.write_vtk(triangulation, out);
std::cout << "Grid written to grid.vtk" << std::endl;
}

int main()
{
run3D();
}


Chen

Yufei Fang <sjtu...@gmail.com> 于2024年3月6日周三 17:48写道:

> I'm trying to import the mesh from COMSOL to triangulation.
>
> [image: comsol_4IaAE9lQVf.png]
> it's an air-supported membrane structure, the mesh consists of free
> triangular or free quad. both are failed.
> *here is my code:*
> "
> void run3D()
> {
> Triangulation<3> triangulation;
> GridIn<3> grid_in;
> grid_in.attach_triangulation(triangulation);
> std::ifstream input_file("../resource/3D.mphtxt");
> grid_in.read_comsol_mphtxt(input_file);
>
> std::ofstream out("grid3D.vtk");
> GridOut       grid_out;
> grid_out.write_vtk(triangulation, out);
> std::cout << "Grid written to grid.vtk" << std::endl;
> }
>
> int main()
> {
> run3D();
> }
> "
> the error is:
> "
> An error occurred in line <2264> of file
> </home/fomebody/dealii-9.5.1/source/grid/tria.cc> in function
>     static void
> dealii::internal::TriangulationImplementation::Implementation::create_triangulation(const
> std::vector<dealii::Point<spacedim> >&, const
> std::vector<dealii::CellData<dim> >&, const dealii::SubCellData&,
> dealii::Triangulation<dim, spacedim>&) [with int dim = 3; int spacedim = 3]
> The violated condition was:
>     cells.size() > 0
> Additional information:
>     No cells given
> "
> my question is:
> 1. how to import such a mesh into dealii;
> 2. the tutorial said triangular and tetrahedral cannot be imported in
> dealii, but i can import triangular or tetrahedral element by
> gridin_COMSOL_mphtxt, is it controdicory?
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/6e0e1c38-5aef-4b9a-bddc-a14a8bc07f0bn%40googlegroups.com
> <https://groups.google.com/d/msgid/dealii/6e0e1c38-5aef-4b9a-bddc-a14a8bc07f0bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CADr3OdJP3mxy-AUJ%2BM7MEdG9YMLQGqc7--isLweW%2Bt5afn9NFA%40mail.gmail.com.

Reply via email to