Beispiel #1
0
int main()
{
  
   /**************************************************************************/
   /* read in the input File 'Eingabefile.dat'                               */
   /**************************************************************************/
   open_inputfile();                                       /*prog_functions.c*/


   /**************************************************************************/
   /* 'read_start_values_from_inputfile()'                                   */
   /*                                                                        */
   /* o.) 'frac_gen_type': variable controlls the type of generating process */
   /* o.) 'rseed'        : random start number                               */
   /* o.) 'frac_dens_3d' : fracture density [fracture area m^2 / m^3]        */
   /* o.) 'dom_min/dom_max': two domain points of the generating domain      */
   /*                                                                        */
   /**************************************************************************/
   read_start_values_from_inputfile();


   /**************************************************************************/
   /* generating the list of FRAC[]                                          */
   /**************************************************************************/
   gen_fracture_list();                                    /*prog_functions.c*/
   printf("\n Global Fracture list .................. done\n"); 


   /**************************************************************************/
   /* area_computation()                                                     */
   /* post-processing after generating steps                                 */
   /**************************************************************************/
   /*                                                                        */
   /* 2D fracture planes (known and stochastic ones) in the 3D space         */
   /*                                                                        */
   /*    1.) Optimization                                                    */
   /*    2.) Multilayer -- Technik                                           */
   /*    3.) Subplane3D                                                      */
   /*    4.) Intersektionen (Schnittlinien bzw. Schnittpunkte bestimmen      */
   /*    5.) Subvolume (3D Volumengebiet)                                    */
   /*    6.) Backbone                                                        */
   /*    7.) Output (Netzgener., Stroemungs-- und Transport Programm)        */
   /*                                                                        */
   /*                                                                        */
   /* 1D trace lines (known ones) in the 3D space                            */
   /*                                                                        */
   /*    1.) Subplane3D                                                      */ 
   /*    2.) Intersektionen (Schnittlinien bzw. Schnittpunkte bestimmen      */ 
   /*    3.) Subvolume (3D Volumengebiet)                                    */ 
   /*    4.) Output (Netzgener., Stroemungs-- und Transport Programm)        */ 
   /*                                                                        */
   /**************************************************************************/
   area_computation();


   printf("\n program finally done :-) \n\n");

   return(0);
}
/* called when an inotify event is received */
static void process_inotify(int fd)
{
	int bytes;
	/* union to avoid strict-aliasing problems */
	union {
		char buffer[256];  /* a tad large */
		struct inotify_event event;
	} eventbuf;

	bytes = read(fd, &eventbuf.buffer, sizeof(eventbuf.buffer));

	acpid_log(LOG_DEBUG, "inotify read bytes: %d", bytes);

	/* eof is not expected */	
	if (bytes == 0) {
		acpid_log(LOG_WARNING, "inotify fd eof encountered");
		return;
	}
	else if (bytes < 0) {
		/* EINVAL means buffer wasn't big enough.  See inotify(7). */
		acpid_log(LOG_ERR, "inotify read error: %s (%d)",
			strerror(errno), errno);
		acpid_log(LOG_ERR, "disconnecting from inotify");
		delete_connection(fd);
		return;
	}

	acpid_log(LOG_DEBUG, "inotify name len: %d", eventbuf.event.len);

	const int dnsize = 256;
	char devname[dnsize];

	/* if a name is included */
	if (eventbuf.event.len > 0) {
		/* devname = ACPID_INPUTLAYERDIR + "/" + pevent -> name */
		strcpy(devname, ACPID_INPUTLAYERDIR);
		strcat(devname, "/");
		strncat(devname, eventbuf.event.name, dnsize - strlen(devname) - 1);
	}
		
	/* if this is a create */
	if (eventbuf.event.mask & IN_CREATE) {
		acpid_log(LOG_DEBUG, "inotify about to open: %s", devname);

		open_inputfile(devname);
	}

	/* if this is a delete */
	if (eventbuf.event.mask & IN_DELETE) {
		/* struct connection *c; */
		
		acpid_log(LOG_DEBUG, "inotify received a delete for: %s", devname);

#if 0
/* Switching back to the original ENODEV detection scheme.  See 
   process_input() in input_layer.c. */
/* keeping this for future reference */
		/* search for the event file in the connection list */
		/* ??? Or should we just have a delete_connection_name()? */
		c = find_connection_name(devname);
		
		/* close that connection if found */
		if (c)
			delete_connection(c->fd);
#endif
	}
}