Re: [deal.II] Re: Can GridIn read 3D quad mesh?

2018-09-18 Thread Yuxiang Wang
Prof. Bangerth,

Thank you for the prompt response! Yes please find attached the minimal
program. The main body is pretty short (see below), modified from step-49.
Please let me know if you cannot reproduce it!

```
int main ()
{
  Triangulation<2, 3> triangulation;

  GridIn<2, 3> gridin;
  gridin.attach_triangulation(triangulation);
  std::ifstream f("mesh.inp");
  gridin.read_abaqus(f);

  GridOut gridout;
  std::ofstream fout("mesh.vtu");
  gridout.write_vtu(triangulation, fout);
}

```


Shawn

On Tue, Sep 18, 2018 at 4:28 PM Wolfgang Bangerth 
wrote:

> On 09/18/2018 03:18 PM, Yuxiang Wang wrote:
> >
> > Thank you for the pointer! I changed my code as you suggested and it
> finished
> > running.
>
> Great!
>
>
> > However, when I opened the output file (mesh.vtu), the 3D mesh was
> projected
> > to a 2D plane of z=0, and lost its 3D features. Was that expected
> behavior?
>
> No. Are you saying that if you read a mesh, then immediately output it
> again,
> that the z-coordinate is lost? If that's correct, then that's a bug and it
> would be nice to have a small program and input file that demonstrates
> this.
>
> Best
>   W.
>
> --
> 
> Wolfgang Bangerth  email: bange...@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 a topic in the
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/dealii/Erk7pxwTEj4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> dealii+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Yuxiang "Shawn" Wang, PhD
yw...@virginia.edu
+1 (434) 284-0836

-- 
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.
For more options, visit https://groups.google.com/d/optout.

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 

#include 

using namespace dealii;




int main ()
{
  Triangulation<2, 3> triangulation;

  GridIn<2, 3> gridin;
  gridin.attach_triangulation(triangulation);
  std::ifstream f("mesh.inp");
  gridin.read_abaqus(f);

  GridOut gridout;
  std::ofstream fout("mesh.vtu");
  gridout.write_vtu(triangulation, fout);
}


mesh.inp
Description: Binary data
##
#  CMake script for the step-1 tutorial program:
##

# Set the name of the project and target:
SET(TARGET "step-49")

# Declare all source files the target consists of:
SET(TARGET_SRC
  ${TARGET}.cc
  # You can specify additional files here!
  )

# Usually, you will not need to modify anything beyond this point...

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)

FIND_PACKAGE(deal.II 8.0 QUIET
  HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
  )
IF(NOT ${deal.II_FOUND})
  MESSAGE(FATAL_ERROR "\n"
"*** Could not locate deal.II. ***\n\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to 
cmake\n"
"or set an environment variable \"DEAL_II_DIR\" that contains this path."
)
ENDIF()

DEAL_II_INITIALIZE_CACHED_VARIABLES()
PROJECT(${TARGET})
DEAL_II_INVOKE_AUTOPILOT()


mesh.vtu
Description: Binary data


Re: [deal.II] Re: Can GridIn read 3D quad mesh?

2018-09-18 Thread Wolfgang Bangerth
On 09/18/2018 03:18 PM, Yuxiang Wang wrote:
> 
> Thank you for the pointer! I changed my code as you suggested and it finished 
> running.

Great!


> However, when I opened the output file (mesh.vtu), the 3D mesh was projected 
> to a 2D plane of z=0, and lost its 3D features. Was that expected behavior?

No. Are you saying that if you read a mesh, then immediately output it again, 
that the z-coordinate is lost? If that's correct, then that's a bug and it 
would be nice to have a small program and input file that demonstrates this.

Best
  W.

-- 

Wolfgang Bangerth  email: bange...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Re: Can GridIn read 3D quad mesh?

2018-09-18 Thread Yuxiang Wang
Hi Professor Bangerth,

Thank you for the pointer! I changed my code as you suggested and it 
finished running.

However, when I opened the output file (mesh.vtu), the 3D mesh was 
projected to a 2D plane of z=0, and lost its 3D features. Was that expected 
behavior?

Shawn

On Tuesday, September 18, 2018 at 1:56:19 PM UTC-7, Wolfgang Bangerth wrote:
>
> On 09/18/2018 02:40 PM, Yuxiang Wang wrote: 
> > 
> > Thank you for your help! I just tried a code snippet (modified step-49) 
> below 
> > and it does not work, either when I set the dim=2 or dim=3. 
>
> If you want to use quadrilateral (2d) meshes embedded in 3d, then you need 
> to use 
>Triangulation<2,3> 
>GridIn<2,3> 
> etc. 
>
> The 2 is the dimension of cells, the 3 the dimension of the space in which 
> they live. 
>
> Best 
>   W. 
>
> -- 
>  
> 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Re: Can GridIn read 3D quad mesh?

2018-09-18 Thread Wolfgang Bangerth
On 09/18/2018 02:40 PM, Yuxiang Wang wrote:
> 
> Thank you for your help! I just tried a code snippet (modified step-49) below 
> and it does not work, either when I set the dim=2 or dim=3.

If you want to use quadrilateral (2d) meshes embedded in 3d, then you need to 
use
   Triangulation<2,3>
   GridIn<2,3>
etc.

The 2 is the dimension of cells, the 3 the dimension of the space in which 
they live.

Best
  W.

-- 

Wolfgang Bangerth  email: bange...@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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: Can GridIn read 3D quad mesh?

2018-09-18 Thread Yuxiang Wang
Oh and another detail - the mesh is not really 2D mesh because the four 
nodes of a quad element may not be co-planar. Therefore, there does not 
exist a transform that can reduce the mesh to 2D.

Shawn

On Monday, September 17, 2018 at 12:07:43 PM UTC-7, Daniel Arndt wrote:
>
> Shawn,
>
> If I understand correctly you want to read a 2D mesh embedded in a 
> three-dimensional space.
> Which mesh format are you interested in? 
> At least, GridIn::read_ucd and GridIn::read_msh should be able to do that.
>
> If you experience problems, we like to here about that as well. 
>
> Best,
> Daniel
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] Re: Can GridIn read 3D quad mesh?

2018-09-18 Thread Yuxiang Wang
Hi Daniel,

Thank you for your help! I just tried a code snippet (modified step-49)
below and it does not work, either when I set the dim=2 or dim=3.

```
int main ()
{
  Triangulation<2> triangulation;

  GridIn<2> gridin;
  gridin.attach_triangulation(triangulation);
  std::ifstream f("mesh.inp");
  gridin.read_abaqus(f);

  GridOut gridout;
  std::ofstream fout("mesh.vtu");
  gridout.write_vtu(triangulation, fout);
}
```

The complete code is attached at the end of this email. If you don't mind,
could you help provide any guesses in what potentially went wrong?

Shawn

On Mon, Sep 17, 2018 at 12:07 PM Daniel Arndt <
daniel.ar...@iwr.uni-heidelberg.de> wrote:

> Shawn,
>
> If I understand correctly you want to read a 2D mesh embedded in a
> three-dimensional space.
> Which mesh format are you interested in?
> At least, GridIn::read_ucd and GridIn::read_msh should be able to do that.
>
> If you experience problems, we like to here about that as well.
>
> Best,
> Daniel
>
> --
> 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 a topic in the
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/dealii/Erk7pxwTEj4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> dealii+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Yuxiang "Shawn" Wang, PhD
yw...@virginia.edu
+1 (434) 284-0836

-- 
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.
For more options, visit https://groups.google.com/d/optout.
##
#  CMake script for the step-1 tutorial program:
##

# Set the name of the project and target:
SET(TARGET "step-49")

# Declare all source files the target consists of:
SET(TARGET_SRC
  ${TARGET}.cc
  # You can specify additional files here!
  )

# Usually, you will not need to modify anything beyond this point...

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)

FIND_PACKAGE(deal.II 8.0 QUIET
  HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
  )
IF(NOT ${deal.II_FOUND})
  MESSAGE(FATAL_ERROR "\n"
"*** Could not locate deal.II. ***\n\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to 
cmake\n"
"or set an environment variable \"DEAL_II_DIR\" that contains this path."
)
ENDIF()

DEAL_II_INITIALIZE_CACHED_VARIABLES()
PROJECT(${TARGET})
DEAL_II_INVOKE_AUTOPILOT()

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 

#include 

using namespace dealii;




int main ()
{
  Triangulation<2> triangulation;

  GridIn<2> gridin;
  gridin.attach_triangulation(triangulation);
  std::ifstream f("mesh.inp");
  gridin.read_abaqus(f);

  GridOut gridout;
  std::ofstream fout("mesh.vtu");
  gridout.write_vtu(triangulation, fout);
}


mesh.inp
Description: Binary data


[deal.II] Re: Can GridIn read 3D quad mesh?

2018-09-17 Thread Daniel Arndt
Shawn,

If I understand correctly you want to read a 2D mesh embedded in a 
three-dimensional space.
Which mesh format are you interested in? 
At least, GridIn::read_ucd and GridIn::read_msh should be able to do that.

If you experience problems, we like to here about that as well. 

Best,
Daniel

-- 
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.
For more options, visit https://groups.google.com/d/optout.