Sir Chen,
Thank you for your assistance; it was precisely what I needed to export a 
mesh with either 3 or 4 vertices. It appears you also use COMSOL, 
suggesting our research interests might overlap. Perhaps we could 
communicate further on this topic.

Best regards,
Yufei Fang

On Sunday, March 31, 2024 at 11:59:33 PM UTC+8 hkch...@gmail.com wrote:

> Yufei Fang:
>
> The selection of exporting data should by careful.
> [image: image.png]
> Chen
>
> Yufei Fang <sjt...@gmail.com> 于2024年3月27日周三 20:12写道:
>
>> Dear Professor Bangerth,
>> I appreciate the effort and time you dedicated to reviewing and 
>> addressing the error I encountered. Your guidance has been beneficial. 
>> Following your advice, I have updated the mesh file to incorporate 
>> triangles. The file now has the following structure:
>> """
>> 3 # number of vertices per element
>> 16308 # number of elements
>> # Elements
>> 0 2 1 
>> 3 1 2 
>> 1 3 5 
>> ...
>> """
>> However, this modification has led to a new error message:
>> """
>> An error occurred in line <1557> of file 
>> </dssg/opt/icelake/linux-centos8-icelake/gcc-9.3.0/dealii-9.4.0/src/dealii-9.4.0/source/grid/grid_in.cc>
>>  
>> in function
>>     void dealii::GridIn<dim, spacedim>::read_comsol_mphtxt(std::istream&) 
>> [with int dim = 2; int spacedim = 3; std::istream = 
>> std::basic_istream<char>]
>>
>> *The violated condition was:     s == "4 Mesh"*
>> Additional information: 
>>     You are trying to use functionality in deal.II that is currently not
>>     implemented. In many cases, this indicates that there simply didn't
>>     appear much of a need for it, or that the author of the original code
>>     did not have the time to implement a particular case. If you hit this
>>     exception, it is therefore worth the time to look into the code to
>>     find out whether you may be able to implement the missing
>>     functionality. If you do, please consider providing a patch to the
>>     deal.II development sources (see the deal.II website on how to
>>     contribute).
>>
>> Stacktrace:
>> -----------
>> #0 
>>  
>> /dssg/opt/icelake/linux-centos8-icelake/gcc-9.3.0/dealii-9.4.0/install/deal/lib/libdeal_II.g.so.9.4.0:
>>  
>> dealii::GridIn<2, 3>::read_comsol_mphtxt(std::istream&)
>> #1  ./test: run3D()
>> #2  ./test: main
>> --------------------------------------------------------
>> """
>> Attached are my updated .mphtxt and .cc files. Could you kindly assist in 
>> identifying the source of the issue?
>> On Friday, March 22, 2024 at 11:11:25 AM UTC+8 Wolfgang Bangerth wrote:
>>
>>>
>>> Yufei: 
>>> I looked at your input file, and the error message is correct. The 
>>> relevant 
>>> part of 3D.mphtxt looks as follows: 
>>>
>>> ``` 
>>> 1 # number of element types 
>>>
>>> # Type #0 
>>>
>>> 3 edg # type name 
>>>
>>>
>>> 2 # number of vertices per element 
>>> 24584 # number of elements 
>>> # Elements 
>>> 0 1 
>>> 2 1 
>>> ... 
>>> ``` 
>>>
>>> What this part of the file says is "there is only one type of cells", 
>>> "all 
>>> cells have type 3 (edges)" where edge=1d line segments, and "here are 
>>> 24584 
>>> cells of this type", with each of the line segments described by two 
>>> vertex 
>>> numbers. 
>>>
>>> In other words, the file you saved only contains line segments in 3d, 
>>> but no 
>>> quadrilaterals or triangles. You'll have to figure out how to save the 
>>> information you really want, namely cells, rather than just these edges. 
>>>
>>> Best 
>>> W. 
>>>
>>>
>>>
>>> On 3/10/24 23:50, Yufei Fang wrote: 
>>> > *** Caution: EXTERNAL Sender *** 
>>> > 
>>> > Sir Chen, thanks for your reply, 
>>> > I changed the code to 
>>> > " 
>>> > Triangulation<2,3> triangulation; 
>>> > GridIn<2,3> grid_in; 
>>> > " 
>>> > However, it still doesn't work, and the error message is the same as 
>>> before: 
>>> > " 
>>> > 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 = 2; int spacedim = 3] 
>>> > The violated condition was: 
>>> >     cells.size() > 0 
>>> > Additional information: 
>>> >     No cells given 
>>> > " 
>>> > 😭 
>>> > Here is my .mphtxt, can you help me check where the problem is? 
>>> > 
>>> > On Friday, March 8, 2024 at 3:57:14 PM UTC+8 hkch...@gmail.com wrote: 
>>> > 
>>> > 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 <sjt...@gmail.com> 于2024年3月6日周三 17:48写道: 
>>> > 
>>> > I'm trying to import the mesh from COMSOL to triangulation. 
>>> > 
>>> > 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/ 
>>> > <http://www.dealii.org/> 
>>> > For mailing list/forum options, see 
>>> > https://groups.google.com/d/forum/dealii?hl=en 
>>> > <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+un...@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/ 
>>> > <http://www.dealii.org/> 
>>> > For mailing list/forum options, see 
>>> > https://groups.google.com/d/forum/dealii?hl=en 
>>> > <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+un...@googlegroups.com 
>>> > <mailto:dealii+un...@googlegroups.com>. 
>>> > To view this discussion on the web visit 
>>> > 
>>> https://groups.google.com/d/msgid/dealii/065ad604-64c8-45c2-bad3-9df142c870f2n%40googlegroups.com
>>>  
>>> <
>>> https://groups.google.com/d/msgid/dealii/065ad604-64c8-45c2-bad3-9df142c870f2n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>>  
>>>
>>>
>>> -- 
>>> ------------------------------------------------------------------------ 
>>> Wolfgang Bangerth email: bang...@colostate.edu 
>>> www: http://www.math.colostate.edu/~bangerth/ 
>>>
>>>
>>> -- 
>> 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+un...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/dealii/8ffbfecc-2ea9-4a60-a0a1-5aaa127da346n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/dealii/8ffbfecc-2ea9-4a60-a0a1-5aaa127da346n%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/8c89a573-5f4e-4e65-aaf7-49b14896b1f5n%40googlegroups.com.

Reply via email to