Add unit test to help with Jens DofObject issue #9

Merged
merged 3 commits into from Dec 13, 2012

Conversation

Projects
None yet
4 participants
@benkirk
Member

benkirk commented Dec 13, 2012

Partially just to test the pull request process & workflow, but also useful.

I have added a
-D__LIBMESH_IS_UNIT_TESTING__

preprocessor macro that is defined when compiling the unit tests. This allows us to enable certain class constructors or utility get/set methods that we probably otherwise would not want public - see for example the dof_object.h patch contained in this request.

I created a unit test to set exacty the buffer he is reporting, and as I suspected the new VariableGroups patch is working as expected.

Hmm....

Problem must lie elsewhere.

@buildhive

This comment has been minimized.

Show comment
Hide comment
@benkirk

This comment has been minimized.

Show comment
Hide comment
@benkirk

benkirk Dec 13, 2012

Member

Specifically, when I run

$ make -C tests check

I get this:

Debugging DofObject buffer
 https://sourceforge.net/mailarchive/forum.php?thread_name=50C8EE7C.8090405%40gmail.com&forum_name=libmesh-users
 [ 2 8 257 0 257 96 257 192 257 0 ]
aobject.dof_number(0,0,0)=0
aobject.dof_number(0,1,0)=96
aobject.dof_number(0,2,0)=192
aobject.dof_number(1,0,0)=0
 [ 2 8 257 1 257 97 257 193 257 1 ]
aobject.dof_number(0,0,0)=1
aobject.dof_number(0,1,0)=97
aobject.dof_number(0,2,0)=193
aobject.dof_number(1,0,0)=1

Which is exactly as expected.

Member

benkirk commented Dec 13, 2012

Specifically, when I run

$ make -C tests check

I get this:

Debugging DofObject buffer
 https://sourceforge.net/mailarchive/forum.php?thread_name=50C8EE7C.8090405%40gmail.com&forum_name=libmesh-users
 [ 2 8 257 0 257 96 257 192 257 0 ]
aobject.dof_number(0,0,0)=0
aobject.dof_number(0,1,0)=96
aobject.dof_number(0,2,0)=192
aobject.dof_number(1,0,0)=0
 [ 2 8 257 1 257 97 257 193 257 1 ]
aobject.dof_number(0,0,0)=1
aobject.dof_number(0,1,0)=97
aobject.dof_number(0,2,0)=193
aobject.dof_number(1,0,0)=1

Which is exactly as expected.

@roystgnr

This comment has been minimized.

Show comment
Hide comment
@roystgnr

roystgnr Dec 13, 2012

Member

On Thu, 13 Dec 2012, Benjamin S. Kirk wrote:

-D__LIBMESH_IS_UNIT_TESTING__

Take out the leading (and I guess trailing, for symmetry) underscores?
I can't imagine it causing a problem, but technically double leading
underscores are reserved for the C/C++ implementation.

Member

roystgnr commented Dec 13, 2012

On Thu, 13 Dec 2012, Benjamin S. Kirk wrote:

-D__LIBMESH_IS_UNIT_TESTING__

Take out the leading (and I guess trailing, for symmetry) underscores?
I can't imagine it causing a problem, but technically double leading
underscores are reserved for the C/C++ implementation.

@benkirk

This comment has been minimized.

Show comment
Hide comment
@benkirk

benkirk Dec 13, 2012

Member

On Dec 13, 2012, at 10:01 AM, roystgnr notifications@github.com wrote:

On Thu, 13 Dec 2012, Benjamin S. Kirk wrote:

-D__LIBMESH_IS_UNIT_TESTING__

Take out the leading (and I guess trailing, for symmetry) underscores?
I can't imagine it causing a problem, but technically double leading
underscores are reserved for the C/C++ implementation.

Will do. But let's certainly hope it doesn't create a problem - after all:

#ifndef dof_object_h
#define dof_object_h

uh, oops…

-Ben

Member

benkirk commented Dec 13, 2012

On Dec 13, 2012, at 10:01 AM, roystgnr notifications@github.com wrote:

On Thu, 13 Dec 2012, Benjamin S. Kirk wrote:

-D__LIBMESH_IS_UNIT_TESTING__

Take out the leading (and I guess trailing, for symmetry) underscores?
I can't imagine it causing a problem, but technically double leading
underscores are reserved for the C/C++ implementation.

Will do. But let's certainly hope it doesn't create a problem - after all:

#ifndef dof_object_h
#define dof_object_h

uh, oops…

-Ben

@roystgnr

This comment has been minimized.

Show comment
Hide comment
@roystgnr

roystgnr Dec 13, 2012

Member

On Thu, 13 Dec 2012, Benjamin S. Kirk wrote:

Will do. But let's certainly hope it doesn't create a problem - after all:

#ifndef dof_object_h
#define dof_object_h

uh, oops…

Indeed. Changing our header guards to keep from violating the C and
C++ standards has been at the bottom of my TODO list for forever. I
don't think there's any mechanism for breakage unless some compiler or
standard library implementer actually tries to use the same identifier

as one of ours, though.

Roy

Member

roystgnr commented Dec 13, 2012

On Thu, 13 Dec 2012, Benjamin S. Kirk wrote:

Will do. But let's certainly hope it doesn't create a problem - after all:

#ifndef dof_object_h
#define dof_object_h

uh, oops…

Indeed. Changing our header guards to keep from violating the C and
C++ standards has been at the bottom of my TODO list for forever. I
don't think there's any mechanism for breakage unless some compiler or
standard library implementer actually tries to use the same identifier

as one of ours, though.

Roy

@jwpeterson

This comment has been minimized.

Show comment
Hide comment
@jwpeterson

jwpeterson Dec 13, 2012

Member

On Thu, Dec 13, 2012 at 9:27 AM, Benjamin S. Kirk
notifications@github.com wrote:

On Dec 13, 2012, at 10:01 AM, roystgnr notifications@github.com wrote:

On Thu, 13 Dec 2012, Benjamin S. Kirk wrote:

-D__LIBMESH_IS_UNIT_TESTING__

Take out the leading (and I guess trailing, for symmetry) underscores?
I can't imagine it causing a problem, but technically double leading
underscores are reserved for the C/C++ implementation.

Will do. But let's certainly hope it doesn't create a problem - after all:

#ifndef dof_object_h
#define dof_object_h

uh, oops…

Wow, yeah that's ANSI C

http://www.doc.ic.ac.uk/lab/cplus/c++.rules/chap5.html

"The use of two underscores (`__') in identifiers is reserved for the
compiler's internal use according to the ANSI-C standard."

I guess we've been using this since the very beginning without knowing
the rules...

If we do change this, should we prepend libmesh as well?

#ifndef libmesh_dof_object_h

John

Member

jwpeterson commented Dec 13, 2012

On Thu, Dec 13, 2012 at 9:27 AM, Benjamin S. Kirk
notifications@github.com wrote:

On Dec 13, 2012, at 10:01 AM, roystgnr notifications@github.com wrote:

On Thu, 13 Dec 2012, Benjamin S. Kirk wrote:

-D__LIBMESH_IS_UNIT_TESTING__

Take out the leading (and I guess trailing, for symmetry) underscores?
I can't imagine it causing a problem, but technically double leading
underscores are reserved for the C/C++ implementation.

Will do. But let's certainly hope it doesn't create a problem - after all:

#ifndef dof_object_h
#define dof_object_h

uh, oops…

Wow, yeah that's ANSI C

http://www.doc.ic.ac.uk/lab/cplus/c++.rules/chap5.html

"The use of two underscores (`__') in identifiers is reserved for the
compiler's internal use according to the ANSI-C standard."

I guess we've been using this since the very beginning without knowing
the rules...

If we do change this, should we prepend libmesh as well?

#ifndef libmesh_dof_object_h

John

@benkirk

This comment has been minimized.

Show comment
Hide comment
@benkirk

benkirk Dec 13, 2012

Member

On Dec 13, 2012, at 10:49 AM, jwpeterson notifications@github.com wrote:

I guess we've been using this since the very beginning without knowing
the rules...

If we do change this, should we prepend libmesh as well?

#ifndef libmesh_dof_object_h

Absolutely. util_h would be so generic we'd certainly be asking for it!

-Ben

Member

benkirk commented Dec 13, 2012

On Dec 13, 2012, at 10:49 AM, jwpeterson notifications@github.com wrote:

I guess we've been using this since the very beginning without knowing
the rules...

If we do change this, should we prepend libmesh as well?

#ifndef libmesh_dof_object_h

Absolutely. util_h would be so generic we'd certainly be asking for it!

-Ben

@buildhive

This comment has been minimized.

Show comment
Hide comment

benkirk added a commit that referenced this pull request Dec 13, 2012

Merge pull request #9 from benkirk/devel
Add unit test to help with Jens DofObject issue

@benkirk benkirk merged commit b379636 into libMesh:master Dec 13, 2012

@jwpeterson

This comment has been minimized.

Show comment
Hide comment
@jwpeterson

jwpeterson Dec 13, 2012

Member

On Thu, Dec 13, 2012 at 9:52 AM, Benjamin S. Kirk
notifications@github.comwrote:

On Dec 13, 2012, at 10:49 AM, jwpeterson notifications@github.com
wrote:

I guess we've been using this since the very beginning without knowing
the rules...

If we do change this, should we prepend libmesh as well?

#ifndef libmesh_dof_object_h

Absolutely. util_h would be so generic we'd certainly be asking for it!

OK, I will do this and try out the whole pull request business.

John

Member

jwpeterson commented Dec 13, 2012

On Thu, Dec 13, 2012 at 9:52 AM, Benjamin S. Kirk
notifications@github.comwrote:

On Dec 13, 2012, at 10:49 AM, jwpeterson notifications@github.com
wrote:

I guess we've been using this since the very beginning without knowing
the rules...

If we do change this, should we prepend libmesh as well?

#ifndef libmesh_dof_object_h

Absolutely. util_h would be so generic we'd certainly be asking for it!

OK, I will do this and try out the whole pull request business.

John

@jwpeterson

This comment has been minimized.

Show comment
Hide comment
@jwpeterson

jwpeterson Dec 13, 2012

Member

On Thu, Dec 13, 2012 at 10:07 AM, John Peterson jwpeterson@gmail.com wrote:

On Thu, Dec 13, 2012 at 9:52 AM, Benjamin S. Kirk notifications@github.com
wrote:

On Dec 13, 2012, at 10:49 AM, jwpeterson notifications@github.com wrote:

I guess we've been using this since the very beginning without knowing
the rules...

If we do change this, should we prepend libmesh as well?

#ifndef libmesh_dof_object_h

Absolutely. util_h would be so generic we'd certainly be asking for it!

OK, I will do this and try out the whole pull request business.

Actually, I think let's also go with uppercase names, just so they
look more like "normal" #defines?

Sorry, I should probably open a new issue for this...

John

Member

jwpeterson commented Dec 13, 2012

On Thu, Dec 13, 2012 at 10:07 AM, John Peterson jwpeterson@gmail.com wrote:

On Thu, Dec 13, 2012 at 9:52 AM, Benjamin S. Kirk notifications@github.com
wrote:

On Dec 13, 2012, at 10:49 AM, jwpeterson notifications@github.com wrote:

I guess we've been using this since the very beginning without knowing
the rules...

If we do change this, should we prepend libmesh as well?

#ifndef libmesh_dof_object_h

Absolutely. util_h would be so generic we'd certainly be asking for it!

OK, I will do this and try out the whole pull request business.

Actually, I think let's also go with uppercase names, just so they
look more like "normal" #defines?

Sorry, I should probably open a new issue for this...

John

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment