void _lucVectorArrowCrossSection_DrawCrossSection( void* drawingObject, lucDatabase* database, Dimension_Index dim )
{
   lucVectorArrowCrossSection*  self           = (lucVectorArrowCrossSection*)drawingObject;
   FieldVariable*    vectorVariable = self->fieldVariable;
   double            min = 0.0, max = self->maximum;
   Index          aIndex, bIndex;

   Journal_Firewall( vectorVariable->fieldComponentCount == vectorVariable->dim, lucError,
                     "Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
                     "can only visualse FieldVariables with %d components.\n", __func__, vectorVariable->name,
                     vectorVariable->fieldComponentCount, self->type, vectorVariable->dim );

   if ( True == self->dynamicRange )
   {
      min = FieldVariable_GetMinGlobalFieldMagnitude( vectorVariable );
      max = FieldVariable_GetMaxGlobalFieldMagnitude( vectorVariable );
   }

   /* Force 3d vectors */
   lucCrossSection_AllocateSampleData(self, 3);

   /* Sample the 2d cross-section */
   lucCrossSection_SampleField(self, False);

   /* Write only values that have data on this processor! */
   for ( aIndex = 0 ; aIndex < self->resolutionA ; aIndex++ )
   {
      for ( bIndex = 0 ; bIndex < self->resolutionB ; bIndex++ )
      {
         if (self->values[aIndex][bIndex][0] != HUGE_VAL)
         {
            lucDatabase_AddVertices(database, 1, lucVectorType, &self->vertices[aIndex][bIndex][0]);
            lucDatabase_AddVectors(database, 1, lucVectorType, min, max, &self->values[aIndex][bIndex][0]);
         }
      }
   }

   lucCrossSection_FreeSampleData(self);
}
void _lucIsosurface_Setup( void* drawingObject, lucDatabase* database, void* _context )
{
   lucIsosurface*             self = (lucIsosurface*)drawingObject;

   lucDrawingObject_SyncShadowValues( self, self->isosurfaceField );
   lucDrawingObject_SyncShadowValues( self, self->colourField );
   lucDrawingObject_SyncShadowValues( self, self->maskField );

   FieldVariable_GetMinAndMaxGlobalCoords(self->isosurfaceField, self->globalMin, self->globalMax);

   self->triangleCount = 0;

   Journal_Printf( lucInfo, "Sampling %s for %s (global=%d)\n", self->isosurfaceField->name, self->name, self->sampleGlobal);

   /* Anything to sample? */
   double min = FieldVariable_GetMinGlobalFieldMagnitude(self->isosurfaceField);
   double max = FieldVariable_GetMaxGlobalFieldMagnitude(self->isosurfaceField);
   if (min == max) return;
   
   if (self->sampleGlobal)
      lucIsosurface_SampleGlobal(drawingObject);
   else
      lucIsosurface_SampleLocal(drawingObject);
}