N-sim
Emulation and simulation of
Wireless Sensor Networks



   Home


   Project Page


   Download


   CVS



   Installation


   Configuration


   Plug-ins




 Hosted by
SourceForge.net Logo

/home/brennan/n-sim/OrbisQuartus/server/orbisquartus.cpp

Go to the documentation of this file.
00001 
00014 /*
00015  * Copyright 2007. Los Alamos National Security, LLC. This material
00016  * was produced under U.S. Government contract DE-AC52-06NA25396 for
00017  * Los Alamos National Laboratory (LANL), which is operated by Los
00018  * Alamos National Security, LLC, for the Department of Energy. The
00019  * U.S. Government has rights to use, reproduce, and distribute this
00020  * software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY,
00021  * LLC, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
00022  * LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to
00023  * produce derivative works, such modified software should be clearly
00024  * marked, so as not to confuse it with the version available from LANL.
00025  *
00026  * Additionally, this program is free software; you can redistribute
00027  * it and/or modify it under the terms of the GNU General Public
00028  * License as published by the Free Software Foundation; version 2 of
00029  * the License. Accordingly, this program is distributed in the hope
00030  * it will be useful, but WITHOUT ANY WARRANTY; without even the
00031  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00032  * PURPOSE. See the GNU General Public License for more details.
00033  */
00034 
00035 
00036 #include <configuration.h>
00037 #include <mini_mpi.h>
00038 #include <sensor_node.h>
00039 #include "sim_if.h"
00040 #include "daemon.h"
00041 #include "orbisquartus.h"
00042 #include "virtual_time-internal.h"
00043 
00044 
00045 OrbisQuartus::OrbisQuartus()
00046 {
00047         daemon_init();
00048         mynodes = 0;
00049 }
00050 
00051 
00052 int OrbisQuartus::start(int argc, char *argv[])
00053 {
00054         int error =0;
00055 
00056         /* Note: argc and argv are off-limits */
00057         MPI_Init(&argc, &argv);
00058         MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
00059         MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
00060 
00061         _init();
00062 
00063         //ctl_init();
00064         virtual_time_init(this);
00065 
00066         error = _get_config(argc, argv);
00067         MPI_Barrier(MPI_COMM_WORLD);
00068 
00069         return error;
00070 }
00071 
00072 
00073 int OrbisQuartus::iterate(void)
00074 {
00075         printf("simulate\n");
00076         fflush(stdout);
00077         virtual_time_iterate();
00078         return 1; //sim_if_service(nodes, num_nodes);
00079 }
00080 
00081 
00082 /********************/
00083 
00084 
00085 #if USING_XEN
00086 
00087 int main(int argc, char *argv[])
00088 {
00089         OrbisQuartus oq;
00090 
00091         while (!oq.shuttingdown()) {
00092 
00093                 oq.start(argc, argv);
00094 
00095                 while (!oq.quitting())
00096                         oq.iterate();
00097 
00098                 oq.stop();
00099         }
00100         return 0;
00101 }
00102 
00103 #endif  


© 2007, Los Alamos National Security, LLC.