Error importing unv

88 views
Skip to first unread message

Kailyn Domican

unread,
Nov 24, 2013, 10:46:13 PM11/24/13
to dea...@googlegroups.com

Hi I'm trying to reproduce my own grid in dealii 8.0 step-5 tutorial, please find attached grid. The code and error can be seen below.



Code 

=====================================

template <int dim>
void Step5<dim>::run ()
{
    std::string zzz = "square.unv";                  // This is my own grid that I am trying to import.
   GridIn<dim> grid_in;
  grid_in.attach_triangulation (triangulation);
  std::ifstream input_file(zzz);
  Assert (dim==2, ExcInternalError());
  grid_in.read_unv (input_file);
}
int main ()
{
  deallog.depth_console (0);
  Step5<2> laplace_problem_2d;
  laplace_problem_2d.run ();
  return 0;
}

Here is the error I am getting.


terminate called after throwing an instance of 'dealii::GridIn<2, 2>::ExcUnknownSectionType'
  what():  
--------------------------------------------------------
An error occurred in line <74> of file </home/kdomican/deal.II/source/grid/grid_in.cc> in function
    void dealii::GridIn<dim, spacedim>::read_unv(std::istream&) [with int dim = 2; int spacedim = 2; std::istream = std::basic_istream<char>]
The violated condition was: 
    tmp == 2411
The name and call sequence of the exception was:
    ExcUnknownSectionType(tmp)
Additional Information: 
The section type <164> in an UNV input file is not implemented.

Stacktrace:
-----------




Thanks in advanced, 
square.unv

Wolfgang Bangerth

unread,
Nov 24, 2013, 11:20:57 PM11/24/13
to dea...@googlegroups.com
On 11/24/2013 09:46 PM, Kailyn Domican wrote:
> Hi I'm trying to reproduce my own grid in dealii 8.0 step-5 tutorial, please
> find attached grid. The code and error can be seen below.
> [...]
> *terminate called after throwing an instance of 'dealii::GridIn<2, 2>::ExcUnknownSectionType'
> what():
> --------------------------------------------------------
> An error occurred in line <74> of file </home/kdomican/deal.II/source/grid/grid_in.cc> in function
> void dealii::GridIn<dim, spacedim>::read_unv(std::istream&) [with int dim = 2; int spacedim = 2; std::istream = std::basic_istream<char>]
> The violated condition was:
> tmp == 2411
> The name and call sequence of the exception was:
> ExcUnknownSectionType(tmp)
> Additional Information:
> The section type <164> in an UNV input file is not implemented.
>
> Stacktrace:
> -----------

Kailyn -- it looks to me as if the read_unv() function is only able to read
certain section numbers of the UNV file format. It should simply ignore those
sections it doesn't care about, but that's not how it's currently implemented.

I don't understand the implementation (primarily because I don't understand
the UNV file format specifications -- what a terrible way of specifying file
contents...). The implementation was provided by Valentin Zingan at your own
university -- you may want to talk to him about how to implement the missing
pieces. Alternatively, you could just delete those sections from your input
file that the reader doesn't understand.

Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@math.tamu.edu
www: http://www.math.tamu.edu/~bangerth/

Andreas Krämer

unread,
Jan 17, 2015, 10:03:32 AM1/17/15
to dea...@googlegroups.com
I just came upon this old thread as I had the same problem.

In my case, it helped to open the unv file and remove all blocks before block 2411 (except for the first line containing -1).

    -1
   164
         1  SI: Meter (newton)         2
    1.0000000000000000E+0    1.0000000000000000E+0    1.0000000000000000E+0
    2.7314999999999998E+2
    -1
    -1
  2420
         1
SMESH_Mesh
         1         0         0
Global Cartesian Coordinate System
    1.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
    0.0000000000000000E+0    1.0000000000000000E+0    0.0000000000000000E+0
    0.0000000000000000E+0    0.0000000000000000E+0    1.0000000000000000E+0
    0.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0
    -1
    -1
  2411
         1         1         1        11
 -1.9000000000000000E+001  2.5000000000000000E+001  0.0000000000000000E+000
         2         1         1        11
 -1.5000000000000000E+001  2.5000000000000000E+001  0.0000000000000000E+000
         3         1         1        11
....

Bye!

Wolfgang Bangerth

unread,
Jan 17, 2015, 10:18:57 AM1/17/15
to dea...@googlegroups.com
This snippet eloquently illustrates why the world urgently needs to move away
from file formats that are memory dumps of Fortran codes and towards things
that are at least slightly self-descriptive ;-)

Cheers
Reply all
Reply to author
Forward
0 new messages