Well... my transition to the libMesh namespace wasn't perfectly smooth... but wasn't terrible.  The largest hangup?  We do a lot of forward declaring of libMesh classes in header files (so that they aren't included everywhere)... and all of those forward declarations had to be wrapped in a "namespace libMesh {}".  That's not too bad though.

The other main gotcha was for template specializations of Paramters::print()... which we do because there are types for which the default print() function doesn't work.  These too had to be wrapped in the libMesh namespace.

The GOOD part is that all of these changes took place in our library code... and NO user code had to be changed at all.  That was the main thing I was worried about... but it appears that we have sufficiently insulated our users from libMesh to the point where this change didn't matter ;-)

Just thought I would report back in case anyone else ran into these types of issues.

Derek


On Mon, Jun 28, 2010 at 4:55 PM, Roy Stogner <roystgnr@ices.utexas.edu> wrote:

On Mon, 21 Jun 2010, Roy Stogner wrote:

No way.  With "libMesh::Mesh" we can use the namespace features and
probably get away with a few lines of code in every file (deep breath
in, Derek, deep breath out...); with "libMesh_Mesh" there really
wouldn't be a way to avoid a 20K line patch.

Okay, let's see if my current patch passes review:

It's over 3000 lines, but all but a handful of lines are either
whitespace, braces, "namespace libMesh {", "}"

I've added "using namespace libMesh;" to the example files.  That way
future apps based on them will survive when (either as a near-term
option or a long-term default) we stop importing the namespace by
default.

There's a "using namespace libMesh;" in the library itself, which is
enough that nearly all code works unchanged.

There are at least a couple exceptions, which require ugly workarounds
if you want to be compatible with both pre-patch and post-patch
library versions:

// forward declarations of libMesh classes:
#include "libmesh_base.h"
#ifdef LIBMESH_USE_SEPARATE_NAMESPACE
namespace libMesh {
class Point;
class Elem;
}
#else
class Point;
class Elem;
#endif

// template specializations of libMesh classes:
#ifdef LIBMESH_USE_SEPARATE_NAMESPACE
libMesh::FactoryImp<HeatTransfer, Physics> heat_transfer_factory ("Heat Transfer");
#else
FactoryImp<HeatTransfer, Physics> heat_transfer_factory ("Heat Transfer");
#endif


Comments?  This isn't as bad as Derek was fearing, but neither is it
the "everything works without changes" situation I'd hoped for.
---
Roy