Topic: Followup from meeting: Modularity
As discussed on the meeting in Prague we really need to keep things modular in order to be able to keep things up-do-date and easy to maintain.
There is currently a few things that still hinder this, which we should try to solve, one of them is classType.
his is currently only used by the load balancer and the context files. For both of these it should be very simple to just drop in the class name (string) as a replacement for the classtype (enum). This would remove the need to update this unwieldy enum.
This means that there will be a few more bytes per element/node to transfer. I think it will be worth the benefits of modularity.
We already have
virtual const char *FEMComponent :: giveInputRecordName() const { }but a lot of elements haven't overloaded this function when they should (default implementation just returns className() which only occasionally matches).
For Domain it should be straight forward to replace the classtype by this record name:
#define SAVE_COMPONENTS(size, type, giveMethod) \
{ \
type *obj; \
for ( i = 1; i <= size; i++ ) { \
obj = giveMethod(i); \
if ( ( mode & CM_Definition ) ) { \
if ( !stream->write(obj->giveRecordName()) ) { \
THROW_CIOERR(CIO_IOERR); \
} \
} \
if ( ( iores = obj->saveContext(stream, mode) ) != CIO_OK ) { \
THROW_CIOERR(iores); \
} \
} \
}
#define RESTORE_COMPONENTS(size, type, resizeMethod, creator, giveMethod, setMethod) \
{ \
type *obj; \
if ( mode & CM_Definition ) { \
resizeMethod(size); \
} \
for ( i = 1; i <= size; i++ ) { \
if ( mode & CM_Definition ) { \
std::string name;
if ( !stream->read(name) ) { \
THROW_CIOERR(CIO_IOERR); \
} \
obj = creator(name.c_str(), 0, this); \
} else { \
obj = giveMethod(i); \
} \
if ( ( iores = obj->restoreContext(stream, mode) ) != CIO_OK ) { \
THROW_CIOERR(iores); \
} \
if ( mode & CM_Definition ) { \
setMethod(i, obj); \
} \
} \
}Borek, could you take a look at the load-balancing/context files?
I don't have any files to try out the load balancing, so I'm reluctant to touch any of these changes in fear of breaking stuff.