#include <jem/base/Tuple.h>
#include <jem/base/Array.h>
#include <jem/base/System.h>
#include <jem/io/PrintWriter.h>
#include <jem/util/HashDictionary.h>
#include <jem/xml/print.h>
#include <jive/Array.h>
#include <jive/util/ArrayItemGroup.h>
#include <jive/fem/XNodeSet.h>
#include <jive/fem/XElementSet.h>
using jive::IdxVector;
static const int XDIM = 0;
static const int YDIM = 1;
int makeMesh ()
{
const IdxTuple elemCount ( 1000, 100 );
const IdxTuple nodeCount ( elemCount + 1 );
FloatTuple delta;
idx_t m, n;
nodes.reserve (
product(nodeCount) );
elems.reserve (
product(elemCount) );
delta = 1.0 / castTo<double>( elemCount );
for ( idx_t j = 0; j < nodeCount[YDIM]; j++ )
{
coords[YDIM] = delta[YDIM] * j;
for ( idx_t i = 0; i < nodeCount[XDIM]; i++ )
{
coords[XDIM] = delta[XDIM] * i;
nodes.addNode ( coords );
}
}
m = nodeCount[XDIM];
n = nodeCount[YDIM];
ngroups = newInstance<HashDictionary> ();
ngroups->insert (
"x0",
newInstance<ArrayItemGroup> (
nodes.getData ()
)
);
ngroups->insert (
"x1",
newInstance<ArrayItemGroup> (
nodes.getData ()
)
);
ngroups->insert (
"y0",
newInstance<ArrayItemGroup> (
nodes.getData ()
)
);
ngroups->insert (
"y1",
newInstance<ArrayItemGroup> (
nodes.getData ()
)
);
for ( idx_t j = 0; j < elemCount[YDIM]; j++ )
{
inodes[0] = j * nodeCount[XDIM];
inodes[1] = inodes[0] + 1;
inodes[2] = inodes[1] + nodeCount[XDIM];
inodes[3] = inodes[2] - 1;
for ( idx_t i = 0; i < elemCount[XDIM]; i++ )
{
elems.addElement ( inodes );
inodes += 1;
}
}
tagName = nodes.getTagName ();
*prn << nodes;
tagName = elems.getTagName ();
*prn << startTag ( tagName );
*prn << elems;
*prn << endTag ( tagName );
ItemGroup::printSome ( *prn, *ngroups );
return 0;
}
int main()
{
}