Commit f7f2f4ef authored by allens's avatar allens

added the ability to add messages

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@27758 18c085ea-50e0-402c-830e-de6fd14e8384
parent f35858f0
......@@ -65,6 +65,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/lib/VisIt_ExpressionMetaData.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/VisIt_MaterialData.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/VisIt_MaterialMetaData.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/VisIt_MeshMetaData.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/VisIt_MessageMetaData.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/VisIt_NameList.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/VisIt_OptionList.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/VisIt_PointMesh.c
......
......@@ -56,6 +56,7 @@ LibsimLibrary::LibsimLibrary(const char* lib) :
mVisIt_SimulationMetaData_setCycleTime = (int (*)(visit_handle,int,double)) mLibsim.symbol("VisIt_SimulationMetaData_setCycleTime");
mVisIt_SimulationMetaData_addGenericCommand = (int (*)(visit_handle,visit_handle)) mLibsim.symbol("VisIt_SimulationMetaData_addGenericCommand");
mVisIt_SimulationMetaData_addMesh = (int (*)(visit_handle,visit_handle)) mLibsim.symbol("VisIt_SimulationMetaData_addMesh");
mVisIt_SimulationMetaData_addMessage = (int (*)(visit_handle,visit_handle)) mLibsim.symbol("VisIt_SimulationMetaData_addMessage");
mVisIt_SimulationMetaData_addVariable = (int (*)(visit_handle,visit_handle)) mLibsim.symbol("VisIt_SimulationMetaData_addVariable");
mVisIt_MeshMetaData_alloc = (int (*)(visit_handle*)) mLibsim.symbol("VisIt_MeshMetaData_alloc");
......
......@@ -118,6 +118,8 @@ public:
return mVisIt_SimulationMetaData_addGenericCommand(h,c); }
int SimulationMetaData_addMesh(visit_handle h,visit_handle m) {
return mVisIt_SimulationMetaData_addMesh(h,m); }
int SimulationMetaData_addMessage(visit_handle h,visit_handle c) {
return mVisIt_SimulationMetaData_addMessage(h,c); }
int SimulationMetaData_addVariable(visit_handle h,visit_handle v) {
return mVisIt_SimulationMetaData_addVariable(h,v); }
......@@ -226,6 +228,7 @@ public:
int SimulationMetaData_setCycleTime(visit_handle h,int cycle,double time) { return VisIt_SimulationMetaData_setCycleTime(h,cycle,time); }
int SimulationMetaData_addGenericCommand(visit_handle h,visit_handle c) { return VisIt_SimulationMetaData_addGenericCommand(h,c); }
int SimulationMetaData_addMesh(visit_handle h,visit_handle m) { return VisIt_SimulationMetaData_addMesh(h,m); }
int SimulationMetaData_addMessage(visit_handle h,visit_handle c) { return VisIt_SimulationMetaData_addMessage(h,c); }
int SimulationMetaData_addVariable(visit_handle h,visit_handle v) { return VisIt_SimulationMetaData_addVariable(h,v); }
int CommandMetaData_alloc(visit_handle *h) { return VisIt_CommandMetaData_alloc(h); }
int CommandMetaData_setName(visit_handle h,const char *name) { return VisIt_CommandMetaData_setName(h,name); }
......@@ -279,6 +282,7 @@ private:
int (*mVisIt_SimulationMetaData_setCycleTime)(visit_handle,int,double);
int (*mVisIt_SimulationMetaData_addGenericCommand)(visit_handle,visit_handle);
int (*mVisIt_SimulationMetaData_addMesh)(visit_handle,visit_handle);
int (*mVisIt_SimulationMetaData_addMessage)(visit_handle,visit_handle);
int (*mVisIt_SimulationMetaData_addVariable)(visit_handle,visit_handle);
int (*mVisIt_MeshMetaData_alloc)(visit_handle*);
......
......@@ -101,6 +101,7 @@ VisIt_ExpressionMetaData.h
VisIt_MaterialData.h
VisIt_MaterialMetaData.h
VisIt_MeshMetaData.h
VisIt_MessageMetaData.h
VisIt_NameList.h
VisIt_OptionList.h
VisIt_PointMesh.h
......
Target: xml2sim
Function: simv2_MessageMetaData_check
Declaration: SIMV2_API int simv2_MessageMetaData_check(visit_handle);
Definition:
int
simv2_MessageMetaData_check(visit_handle h)
{
VisIt_MessageMetaData *obj = GetObject(h, "simv2_MessageMetaData_check");
int retval = VISIT_ERROR;
if(obj != NULL)
{
if(obj->name == "")
{
VisItError("MessageMetaData needs a string");
return VISIT_ERROR;
}
retval = VISIT_OKAY;
}
return retval;
}
<?xml version="1.0"?>
<Attribute name="MessageMetaData" purpose="" persistent="false" keyframe="false" exportAPI="" exportInclude="" codefile="MessageMetaData.code">
<Field name="name" label="name" type="string">
</Field>
<Function name="simv2_MessageMetaData_check" user="true" member="true">
</Function>
</Attribute>
......@@ -524,13 +524,24 @@ GetEnvironment(visit_string *env)
done = ReadEnvironmentFromCommand(path, env);
}
/* Try the one in their VISIT_HOME environment var next */
if (!done)
{
if(getenv("VISIT_HOME") != NULL)
{
char path[LIBSIM_MAX_STRING_SIZE];
sprintf(path, "%s/bin/visit", getenv("VISIT_HOME"));
done = ReadEnvironmentFromCommand(path, env);
}
}
/* Try the one in their path next */
if (!done)
{
done = ReadEnvironmentFromCommand("visit", env);
}
/* If we still can't find it, try the one in /usr/gapps/visit */
/* If we still can't find it, try the LLNL path /usr/gapps/visit */
if (!done)
{
done = ReadEnvironmentFromCommand("/usr/gapps/visit/bin/visit", env);
......@@ -1821,8 +1832,8 @@ static int LoadVisItLibrary_Windows(void)
{
WCHAR msg[1024];
va_list *va = 0;
LIBSIM_MESSAGE1("Error: %d", GetLastError());
LIBSIM_MESSAGE1("Error: %x", GetLastError());
LIBSIM_MESSAGE1("Error: %d", GetLastError());
LIBSIM_MESSAGE1("Error: %x", GetLastError());
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), 0,
msg, 1024, va);
wprintf(L"Formatted message: %s\n", msg);
......
......@@ -47,6 +47,7 @@
#include <VisIt_NameList.h>
#include <VisIt_MaterialMetaData.h>
#include <VisIt_MeshMetaData.h>
#include <VisIt_MessageMetaData.h>
#include <VisIt_SimulationMetaData.h>
#include <VisIt_SpeciesMetaData.h>
#include <VisIt_VariableMetaData.h>
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2015, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#include <VisItDataInterface_V2.h>
#include "VisItDynamic.h"
#include "VisItFortran.h"
int
VisIt_MessageMetaData_alloc(visit_handle *obj)
{
VISIT_DYNAMIC_EXECUTE(MessageMetaData_alloc,
int, (visit_handle*),
(obj))
}
int
VisIt_MessageMetaData_free(visit_handle obj)
{
VISIT_DYNAMIC_EXECUTE(MessageMetaData_free,
int, (visit_handle),
(obj));
}
int
VisIt_MessageMetaData_setName(visit_handle h, const char *val)
{
VISIT_DYNAMIC_EXECUTE(MessageMetaData_setName,
int, (visit_handle, const char *),
(h, val));
}
int
VisIt_MessageMetaData_getName(visit_handle h, char **val)
{
VISIT_DYNAMIC_EXECUTE(MessageMetaData_getName,
int, (visit_handle, char **),
(h, val));
}
/************************** Fortran callable routines *************************/
/* maxlen 012345678901234567890123456789 */
#define F_VISITMESSAGEMETADATAALLOC F77_ID(visitmessagemetadataalloc_,visitmessagemetadataalloc,VISITMESSAGEMETADATAALLOC)
#define F_VISITMESSAGEMETADATAFREE F77_ID(visitmessagemetadatafree_,visitmessagemetadatafree,VISITMESSAGEMETADATAFREE)
#define F_VISITMESSAGEMETADATASETNAME F77_ID(visitmessagemetadatasetname_,visitmessagemetadatasetname, VISITMESSAGEMETADATASETNAME)
#define F_VISITMESSAGEMETADATAGETNAME F77_ID(visitmessagemetadatagetname_,visitmessagemetadatagetname, VISITMESSAGEMETADATAGETNAME)
int
F_VISITMESSAGEMETADATAALLOC(visit_handle *h)
{
return VisIt_MessageMetaData_alloc(h);
}
int
F_VISITMESSAGEMETADATAFREE(visit_handle *h)
{
return VisIt_MessageMetaData_free(*h);
}
int
F_VISITMESSAGEMETADATASETNAME(visit_handle *h, const char *val, int *lval)
{
char *f_val = NULL;
int retval;
COPY_FORTRAN_STRING(f_val, val, lval);
retval = VisIt_MessageMetaData_setName(*h, f_val);
FREE(f_val);
return retval;
}
int
F_VISITMESSAGEMETADATAGETNAME(visit_handle *h, char *val, int *lval)
{
char *s = NULL;
int retval = VisIt_MessageMetaData_getName(*h, &s);
if(s != NULL)
{
visit_cstring_to_fstring(s, val, *lval);
free(s);
}
return retval;
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2015, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#ifndef VISIT_MESSAGEMETADATA_H
#define VISIT_MESSAGEMETADATA_H
#ifdef __cplusplus
extern "C" {
#endif
int VisIt_MessageMetaData_alloc(visit_handle *obj);
int VisIt_MessageMetaData_free(visit_handle obj);
int VisIt_MessageMetaData_setName(visit_handle h, const char *);
int VisIt_MessageMetaData_getName(visit_handle h, char **);
#ifdef __cplusplus
}
#endif
#endif
......@@ -136,6 +136,14 @@ VisIt_SimulationMetaData_addCustomCommand(visit_handle h, visit_handle obj)
(h,obj));
}
int
VisIt_SimulationMetaData_addMessage(visit_handle h, visit_handle obj)
{
VISIT_DYNAMIC_EXECUTE(SimulationMetaData_addMessage,
int, (visit_handle,visit_handle),
(h,obj));
}
/************************** Fortran callable routines *************************/
/* maxlen 012345678901234567890123456789 */
......@@ -151,6 +159,7 @@ VisIt_SimulationMetaData_addCustomCommand(visit_handle h, visit_handle obj)
#define F_VISITMDSIMADDSPECIES F77_ID(visitmdsimaddspecies_,visitmdsimaddspecies,VISITMDSIMADDSPECIES)
#define F_VISITMDSIMADDGENERICCOMMAND F77_ID(visitmdsimaddgenericcommand_,visitmdsimaddgenericcommand,VISITMDSIMADDGENERICCOMMAND)
#define F_VISITMDSIMADDCUSTOMCOMMAND F77_ID(visitmdsimaddcustomcommand_,visitmdsimaddcustomcommand,VISITMDSIMADDCUSTOMCOMMAND)
#define F_VISITMDSIMADDMESSAGE F77_ID(visitmdsimaddmessage_,visitmdsimaddmessage,VISITMDSIMADDMESSAGE)
int
F_VISITMDSIMALLOC(visit_handle *h)
......@@ -224,5 +233,10 @@ F_VISITMDSIMADDCUSTOMCOMMAND(visit_handle *h, visit_handle *md)
return VisIt_SimulationMetaData_addCustomCommand(*h, *md);
}
int
F_VISITMDSIMADDMESSAGE(visit_handle *h, visit_handle *md)
{
return VisIt_SimulationMetaData_addMessage(*h, *md);
}
......@@ -60,6 +60,8 @@ int VisIt_SimulationMetaData_addSpecies(visit_handle h, visit_handle obj);
int VisIt_SimulationMetaData_addGenericCommand(visit_handle h, visit_handle obj);
int VisIt_SimulationMetaData_addCustomCommand(visit_handle h, visit_handle obj);
int VisIt_SimulationMetaData_addMessage(visit_handle h, visit_handle obj);
#ifdef __cplusplus
}
#endif
......
......@@ -1124,6 +1124,10 @@
external visitmdsimaddcustomcommand
integer visitmdsimaddcustomcommand
! visitmdsimaddmessage(visit_handle h, visit_handle md)
external visitmdsimaddmessage
integer visitmdsimaddmessage
! VisIt_SpeciesMetaData functions
!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
......
......@@ -73,6 +73,7 @@ simv2_ExpressionMetaData.C
simv2_MaterialData.C
simv2_MaterialMetaData.C
simv2_MeshMetaData.C
simv2_MessageMetaData.C
simv2_NameList.C
simv2_OptionList.C
simv2_PointMesh.C
......
......@@ -128,6 +128,7 @@ SIMV2_API int simv2_invoke_WriteVariable(const char *, const char *, int, visit_
#define VISIT_COMMANDMETADATA 108
#define VISIT_OPTIONLIST 109
#define VISIT_MESSAGEMETADATA 110
SIMV2_API int simv2_ObjectType(visit_handle h);
SIMV2_API int simv2_FreeObject(visit_handle h);
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2015, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#include <cstring>
#include <snprintf.h>
#include <vectortypes.h>
#include "VisItDataInterfaceRuntime.h"
#include "VisItDataInterfaceRuntimeP.h"
#include "simv2_MessageMetaData.h"
struct VisIt_MessageMetaData : public VisIt_ObjectBase
{
VisIt_MessageMetaData();
virtual ~VisIt_MessageMetaData();
std::string name;
};
VisIt_MessageMetaData::VisIt_MessageMetaData() : VisIt_ObjectBase(VISIT_MESSAGEMETADATA)
{
name = "";
}
VisIt_MessageMetaData::~VisIt_MessageMetaData()
{
}
static VisIt_MessageMetaData *
GetObject(visit_handle h, const char *fname)
{
char tmp[150];
VisIt_MessageMetaData *obj = (VisIt_MessageMetaData *)VisItGetPointer(h);
if(obj != NULL)
{
if(obj->objectType() != VISIT_MESSAGEMETADATA)
{
SNPRINTF(tmp, 150, "%s: The provided handle does not point to "
"a MessageMetaData object.", fname);
VisItError(tmp);
obj = NULL;
}
}
else
{
SNPRINTF(tmp, 150, "%s: An invalid handle was provided.", fname);
VisItError(tmp);
}
return obj;
}
/*******************************************************************************
* Public functions, available to C
******************************************************************************/
int
simv2_MessageMetaData_alloc(visit_handle *h)
{
*h = VisItStorePointer(new VisIt_MessageMetaData);
return (*h != VISIT_INVALID_HANDLE) ? VISIT_OKAY : VISIT_ERROR;
}
int
simv2_MessageMetaData_free(visit_handle h)
{
int retval = VISIT_ERROR;
VisIt_MessageMetaData *obj = GetObject(h, "simv2_MessageMetaData_free");
if(obj != NULL)
{
delete obj;
VisItFreePointer(h);
retval = VISIT_OKAY;
}
return retval;
}
int
simv2_MessageMetaData_setName(visit_handle h, const char *val)
{
if(val == NULL)
{
VisItError("An invalid string was provided for name");
return VISIT_ERROR;
}
int retval = VISIT_ERROR;
VisIt_MessageMetaData *obj = GetObject(h, "simv2_MessageMetaData_setName");
if(obj != NULL)
{
obj->name = val;
retval = VISIT_OKAY;
}
return retval;
}
int
simv2_MessageMetaData_getName(visit_handle h, char **val)
{
if(val == NULL)
{
VisItError("simv2_MessageMetaData_getName: Invalid address.");
return VISIT_ERROR;
}
int retval = VISIT_ERROR;
VisIt_MessageMetaData *obj = GetObject(h, "simv2_MessageMetaData_getName");
if(obj != NULL)
{
*val = (char*)malloc(obj->name.size() + 1);
strcpy(*val, obj->name.c_str());
retval = VISIT_OKAY;
}
else
*val = NULL;
return retval;
}
int
simv2_MessageMetaData_check(visit_handle h)
{
VisIt_MessageMetaData *obj = GetObject(h, "simv2_MessageMetaData_check");
int retval = VISIT_ERROR;
if(obj != NULL)
{
if(obj->name == "")
{
VisItError("MessageMetaData needs a string");
return VISIT_ERROR;
}
retval = VISIT_OKAY;
}
return retval;
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2015, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#ifndef SIMV2_MESSAGEMETADATA_H
#define SIMV2_MESSAGEMETADATA_H
#include <VisItSimV2Exports.h>
#include <VisItInterfaceTypes_V2.h>
// C-callable implementation of front end functions
#ifdef __cplusplus
extern "C" {
#endif
SIMV2_API int simv2_MessageMetaData_alloc(visit_handle *obj);
SIMV2_API int simv2_MessageMetaData_free(visit_handle obj);
SIMV2_API int simv2_MessageMetaData_setName(visit_handle h, const char *);
SIMV2_API int simv2_MessageMetaData_getName(visit_handle h, char **);
#ifdef __cplusplus
};
#endif
// Callable from within the runtime and SimV2
SIMV2_API int simv2_MessageMetaData_check(visit_handle);
#endif
......@@ -51,6 +51,7 @@
#include "simv2_ExpressionMetaData.h"
#include "simv2_SpeciesMetaData.h"
#include "simv2_CommandMetaData.h"
#include "simv2_MessageMetaData.h"
struct VisIt_SimulationMetaData : public VisIt_ObjectBase
{
......@@ -70,6 +71,8 @@ struct VisIt_SimulationMetaData : public VisIt_ObjectBase
std::vector<visit_handle> genericCommands;
std::vector<visit_handle> customCommands;
std::vector<visit_handle> messages;
};
VisIt_SimulationMetaData::VisIt_SimulationMetaData() :
......@@ -77,7 +80,7 @@ VisIt_SimulationMetaData::VisIt_SimulationMetaData() :
simulationMode(0),
cycle(0), time(0.),
meshes(), variables(), materials(), curves(), expressions(), species(),
genericCommands(), customCommands()
genericCommands(), customCommands(), messages()
{
}
......@@ -101,6 +104,9 @@ VisIt_SimulationMetaData::~VisIt_SimulationMetaData()
simv2_FreeObject(genericCommands[i]);
for(i = 0; i < customCommands.size(); ++i)
simv2_FreeObject(customCommands[i]);
for(i = 0; i < messages.size(); ++i)
simv2_FreeObject(messages[i]);
}
static VisIt_SimulationMetaData *
......@@ -213,6 +219,7 @@ ADD_METADATA(simv2_SimulationMetaData_addExpression, VISIT_EXPRESSIONMETADATA, "
ADD_METADATA(simv2_SimulationMetaData_addSpecies, VISIT_SPECIESMETADATA, "SpeciesMetaData", species)
ADD_METADATA(simv2_SimulationMetaData_addGenericCommand, VISIT_COMMANDMETADATA, "CommandMetaData", genericCommands)
ADD_METADATA(simv2_SimulationMetaData_addCustomCommand, VISIT_COMMANDMETADATA, "CommandMetaData", customCommands)
ADD_METADATA(simv2_SimulationMetaData_addMessage, VISIT_MESSAGEMETADATA, "MessageMetaData", messages)
// C++ code that exists in the runtime that we can use in the SimV2 reader
......@@ -270,6 +277,7 @@ GET_METADATA_ITEM(simv2_SimulationMetaData_getNumExpressions, simv2_SimulationMe
GET_METADATA_ITEM(simv2_SimulationMetaData_getNumSpecies, simv2_SimulationMetaData_getSpecies, species)
GET_METADATA_ITEM(simv2_SimulationMetaData_getNumGenericCommands, simv2_SimulationMetaData_getGenericCommand, genericCommands)
GET_METADATA_ITEM(simv2_SimulationMetaData_getNumCustomCommands, simv2_SimulationMetaData_getCustomCommand, customCommands)
GET_METADATA_ITEM(simv2_SimulationMetaData_getNumMessages, simv2_SimulationMetaData_getMessage, messages)
int
simv2_SimulationMetaData_check(visit_handle h)
......@@ -377,6 +385,11 @@ simv2_SimulationMetaData_check(visit_handle h)
if(simv2_CommandMetaData_check(obj->customCommands[i]) == VISIT_ERROR)
retval = VISIT_ERROR;
}
for(i = 0; i < obj->messages.size(); ++i)
{
if(simv2_MessageMetaData_check(obj->messages[i]) == VISIT_ERROR)
retval = VISIT_ERROR;
}
}
return retval;
}
......@@ -60,6 +60,7 @@ SIMV2_API int simv2_SimulationMetaData_addExpression(visit_handle h, visit_handl
SIMV2_API int simv2_SimulationMetaData_addSpecies(visit_handle h, visit_handle obj);
SIMV2_API int simv2_SimulationMetaData_addGenericCommand(visit_handle h, visit_handle obj);
SIMV2_API int simv2_SimulationMetaData_addCustomCommand(visit_handle h, visit_handle obj);
SIMV2_API int simv2_SimulationMetaData_addMessage(visit_handle h, visit_handle obj);
#ifdef __cplusplus
}
......@@ -87,4 +88,7 @@ SIMV2_API int simv2_SimulationMetaData_getGenericCommand(visit_handle h, int i,
SIMV2_API int simv2_SimulationMetaData_getNumCustomCommands(visit_handle h, int &n);
SIMV2_API int simv2_SimulationMetaData_getCustomCommand(visit_handle h, int i, visit_handle &obj);
SIMV2_API int simv2_SimulationMetaData_getNumMessages(visit_handle h, int &n);
SIMV2_API int simv2_SimulationMetaData_getMessage(visit_handle h, int i, visit_handle &obj);
#endif
......@@ -1183,6 +1183,10 @@ def VisIt_SimulationMetaData_addCustomCommand(h, obj):
return _simV2.VisIt_SimulationMetaData_addCustomCommand(h, obj)
VisIt_SimulationMetaData_addCustomCommand = _simV2.VisIt_SimulationMetaData_addCustomCommand
def VisIt_SimulationMetaData_addMessage(h, obj):
return _simV2.VisIt_SimulationMetaData_addMessage(h, obj)
VisIt_SimulationMetaData_addMessage = _simV2.VisIt_SimulationMetaData_addMessage
def VisIt_SpeciesData_alloc(*args):
return _simV2.VisIt_SpeciesData_alloc(*args)
VisIt_SpeciesData_alloc = _simV2.VisIt_SpeciesData_alloc
......
......@@ -11966,6 +11966,37 @@ fail:
}
SWIGINTERN PyObject *_wrap_VisIt_SimulationMetaData_addMessage(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
visit_handle arg1 ;
visit_handle arg2 ;
int val1 ;
int ecode1 = 0 ;
int val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
int result;
if (!PyArg_ParseTuple(args,(char *)"OO:VisIt_SimulationMetaData_addMessage",&obj0,&obj1)) SWIG_fail;
ecode1 = SWIG_AsVal_int(obj0, &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "VisIt_SimulationMetaData_addMessage" "', argument " "1"" of type '" "visit_handle""'");
}
arg1 = static_cast< visit_handle >(val1);
ecode2 = SWIG_AsVal_int(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VisIt_SimulationMetaData_addMessage" "', argument " "2"" of type '" "visit_handle""'");
}
arg2 = static_cast< visit_handle >(val2);
result = (int)VisIt_SimulationMetaData_addMessage(arg1,arg2);
resultobj = SWIG_From_int(static_cast< int >(result));
return resultobj;
fail:
return NULL;
}