Example #1
0
void
MultiApp::initialSetup()
{
  // Fill in the _positions vector
  fillPositions();

  if (_move_apps.size() != _move_positions.size())
    mooseError("The number of apps to move and the positions to move them to must be the same for MultiApp " << name());

  /// Set up our Comm and set the number of apps we're going to be working on
  buildComm();

  if (!_has_an_app)
    return;

  MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm);

  _apps.resize(_my_num_apps);
  _backups.resize(_my_num_apps);

  // Initialize the backups
  for (unsigned int i=0; i<_my_num_apps; i++)
    _backups[i] = MooseSharedPointer<Backup>(new Backup);

  // If the user provided an unregistered app type, see if we can load it dynamically
  if (!AppFactory::instance().isRegistered(_app_type))
    _app.dynamicAppRegistration(_app_type, getParam<std::string>("library_path"));

  for (unsigned int i=0; i<_my_num_apps; i++)
    createApp(i, _app.getGlobalTimeOffset());

  // Swap back
  Moose::swapLibMeshComm(swapped);
}
Example #2
0
void
MultiApp::init()
{
  // Fill in the _positions vector
  fillPositions();

  if (_move_apps.size() != _move_positions.size())
    mooseError("The number of apps to move and the positions to move them to must be the same for MultiApp "<<_name);

  _total_num_apps = _positions.size();
  mooseAssert(_input_files.size() == 1 || _positions.size() == _input_files.size(), "Number of positions and input files are not the same!");

  /// Set up our Comm and set the number of apps we're going to be working on
  buildComm();

  if (!_has_an_app)
    return;

  MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm);

  _apps.resize(_my_num_apps);

  for (unsigned int i=0; i<_my_num_apps; i++)
    createApp(i, _app.getGlobalTimeOffset());

  // Swap back
  Moose::swapLibMeshComm(swapped);
}
Example #3
0
int main()
{
    const Dimension windowSize(1024, 768);

    App* app = createApp(shared_ptr<StreamFactory>(new DesktopStreamFactory("assets")));

    unique_ptr<Application> application(new Application("Application example", windowSize, app));
    application->run();
}
Example #4
0
/**
 * @brief Construct a %BLE Server
 *
 * This class is not designed to be individually instantiated.  Instead one should create a server by asking
 * the BLEDevice class.
 */
BLEServer::BLEServer() {
	m_appId            = -1;
	m_gatts_if         = -1;
	m_connectedCount   = 0;
	m_connId           = -1;
	BLEDevice::m_bleServer   = this;
	m_pServerCallbacks = nullptr;

	createApp(0);
} // BLEServer
/*
 * SG create for 2 nodes. Also creates nodes
 */
void testCreateApp(const char *app, const char *node1, const char *node2, bool createNode)
{
    const char *nodenames[] = {node1, node2};
    if(createNode)
    {
        for(int i = 0; i < 2; ++i)
            addNode(nodenames[i]);
    }
    // create sg, si/csi
    createApp(app);
    // create su/comp on the 2 nodes inside sg
    extendApp(app, nodenames, 2);
    acStart(app);
}
Example #6
0
KueueApp::KueueApp()
{
    qDebug() << "[KUEUE] Constructing";

#ifdef IS_WIN32
    char const *const path_env = getenv( "PATH" );
    QString path = "PATH=" + QCoreApplication::applicationDirPath() + "/archive/;" +
                             QCoreApplication::applicationDirPath() + "/cygwin/bin/;" + 
                             QCoreApplication::applicationDirPath() + "/qemu/;" + 
                             path_env;

    putenv( path.toAscii() );
#endif

    mFailedMessageDisplayed = false;
    
    if ( !Settings::settingsOK() )
    {
        BasicConfig* bc = new BasicConfig();
        int reply = bc->exec();
        delete bc;
        
        if ( reply == 0 )
        {
            qApp->quit();
        }
        else
        {
            createApp();
        }
    }
    else
    {
        createApp();
    }
}
Example #7
0
void
MultiApp::initialSetup()
{
  if (!_has_an_app)
    return;

  MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm);

  _apps.resize(_my_num_apps);

  // If the user provided an unregistered app type, see if we can load it dynamically
  if (!AppFactory::instance().isRegistered(_app_type))
    _app.dynamicAppRegistration(_app_type, getParam<std::string>("library_path"));

  for (unsigned int i=0; i<_my_num_apps; i++)
    createApp(i, _app.getGlobalTimeOffset());

  // Swap back
  Moose::swapLibMeshComm(swapped);
}
Example #8
0
void
MultiApp::resetApp(unsigned int global_app, Real time)
{
  MPI_Comm swapped = Moose::swapLibMeshComm(_my_comm);

  if (hasLocalApp(global_app))
  {
    unsigned int local_app = globalAppToLocal(global_app);

    // Extract the file numbers from the output, so that the numbering is maintained after reset
    std::map<std::string, unsigned int> m = _apps[local_app]->getOutputWarehouse().getFileNumbers();

    // Delete and create a new App
    delete _apps[local_app];
    createApp(local_app, time);

    // Reset the file numbers of the newly reset apps
    _apps[local_app]->getOutputWarehouse().setFileNumbers(m);
  }

  // Swap back
  Moose::swapLibMeshComm(swapped);
}
Example #9
0
static void	handle_application_start(LoadMibState *state, const char **atts)
{
	char	*appname = NULL;
	char	*pubkeyname = NULL;
	char	*privkeyname = NULL;
	char	**att;
	char	*name;
	char	*value;
	LystElt	elt;

	if (noMibYet(state)) return;
	if (state->app)
	{
		return noteLoadError(state, "Already working on an app.");
	}

	for (att = (char **) atts; *att; att++)
	{
		name = *att;
		att++;
		value = *att;
		if (strcmp(name, "name") == 0)
		{
			appname = value;
		}
		else if (strcmp(name, "pubkey") == 0)
		{
			pubkeyname = value;
		}
		else if (strcmp(name, "privkey") == 0)
		{
			privkeyname = value;
		}
		else return noteLoadError(state, "Unknown attribute.");
	}

	if (appname == NULL)
	{
		return noteLoadError(state, "Need name of application.");
	}

	state->app = lookUpApplication(appname);
	switch (state->currentOperation)
	{
	case LoadAdding:
		if (state->app == NULL)
		{
			elt = createApp(appname, pubkeyname, privkeyname);
			if (elt == NULL)
			{
				return putErrmsg("Couldn't add application.",
						appname);
			}

			state->app = (AmsApp *) lyst_data(elt);
		}

		break;

	case LoadChanging:
		return noteLoadError(state, "'Change' not yet implemented.");

	case LoadDeleting:
		if (state->app == NULL)
		{
			return noteLoadError(state, "No such application.");
		}

		state->target = state->app;	/*	May be target.	*/
		break;

	default:
		break;				/*	Just context.	*/
	}
}
Example #10
0
static int	loadTestMib()
{
	AmsMibParameters	parms = { 1, "dgr", NULL, NULL };
	AmsMib			*mib;
	char			ownHostName[MAXHOSTNAMELEN + 1];
	char			eps[MAXHOSTNAMELEN + 5 + 1];
	LystElt			elt;
	Venture			*venture;
	AppRole			*role;
	Subject			*subject;

	mib = _mib(&parms);
	if (mib == NULL)
	{
		return crash();
	}

	getNameOfHost(ownHostName, sizeof ownHostName);
	isprintf(eps, sizeof eps, "%s:2357", ownHostName);
	elt = createCsEndpoint(eps, NULL);
       	if (elt == NULL)
	{
		return crash();
	}

	elt = createApp("amsdemo", NULL, NULL);
       	if (elt == NULL)
	{
		return crash();
	}

	venture = createVenture(1, "amsdemo", "test", NULL, 0, 0);
	if (venture == NULL)
	{
		return crash();
	}

	role = createRole(venture, 2, "shell", NULL, NULL);
	if (role == NULL)
	{
		return crash();
	}

	role = createRole(venture, 3, "log", NULL, NULL);
	if (role == NULL)
	{
		return crash();
	}

	role = createRole(venture, 4, "pitch", NULL, NULL);
	if (role == NULL)
	{
		return crash();
	}

	role = createRole(venture, 5, "catch", NULL, NULL);
	if (role == NULL)
	{
		return crash();
	}

	role = createRole(venture, 96, "amsd", NULL, NULL);
	if (role == NULL)
	{
		return crash();
	}

	role = createRole(venture, 97, "amsstop", NULL, NULL);
	if (role == NULL)
	{
		return crash();
	}

	role = createRole(venture, 98, "amsmib", NULL, NULL);
	if (role == NULL)
	{
		return crash();
	}

	subject = createSubject(venture, 1, "text",
			"Arbitrary variable-length text.", NULL, NULL, NULL);
	if (subject == NULL)
	{
		return crash();
	}

	subject = createSubject(venture, 97, "amsstop",
			"Message space shutdown command.", NULL, NULL, NULL);
	if (subject == NULL)
	{
		return crash();
	}

	subject = createSubject(venture, 98, "amsmib",
			"Runtime MIB updates.", NULL, NULL, NULL);
	if (subject == NULL)
	{
		return crash();
	}

	return 0;
}