Commit f663de08 authored by whitlocb's avatar whitlocb
Browse files

I merged some "import visit" fixes to the trunk.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11498 18c085ea-50e0-402c-830e-de6fd14e8384
parent 0e4ecca0
dantooine.llnl.gov.cmake
\ No newline at end of file
......@@ -104,7 +104,7 @@ VISIT_OPTION_DEFAULT(VISIT_H5PART_LIBDEP HDF5_LIBRARY_DIR hdf5 ${VISIT_HDF5_LIBD
##
## Mili
##
#VISIT_OPTION_DEFAULT(VISIT_MILI_DIR ${VISITHOME}/mili/1.10.0/${VISITARCH})
VISIT_OPTION_DEFAULT(VISIT_MILI_DIR ${VISITHOME}/mili/1.10.0/${VISITARCH})
##
## NetCDF
......
......@@ -19,6 +19,8 @@
<li>If a non-compliant Nek file is encountered, VisIt is better at reporting to the user why the file is non-compliant.</li>
<li>It no longer crashes the GUI when you delete the last variable in the Threshold operator's attributes window.</li>
<li>Large, time-varying PlainText files can now be processed with a constant memory footprint.</li>
<li>Symbols needed by "import visit" in a Python interpreter have been exposed so they are not hidden by default when building with visibility=hidden.</li>
<li>The visit.so and visitmodule.so Python modules now are installed with $ORIGIN rpath so their dependent shared libraries can be found when Python imports the modules.</li>
</ul>
<p><b><font size="4">Enhancements in version 2.0.1</font></b></p>
<ul>
......
......@@ -90,10 +90,10 @@ SET(INSTALLTARGETS IClipOperator)
IF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
ADD_LIBRARY(GClipOperator ${LIBG_SOURCES})
TARGET_LINK_LIBRARIES(GClipOperator visitcommon gui avtmath)
TARGET_LINK_LIBRARIES(GClipOperator visitcommon gui)
ADD_LIBRARY(VClipOperator ${LIBV_SOURCES})
TARGET_LINK_LIBRARIES(VClipOperator visitcommon viewer avtmath)
TARGET_LINK_LIBRARIES(VClipOperator visitcommon viewer)
SET(INSTALLTARGETS ${INSTALLTARGETS} GClipOperator VClipOperator)
IF(VISIT_PYTHON_SCRIPTING)
......@@ -103,7 +103,7 @@ IF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO
${COMMON_SOURCES}
)
ADD_LIBRARY(SClipOperator ${LIBS_SOURCES})
TARGET_LINK_LIBRARIES(SClipOperator visitcommon visitpy avtmath ${PYTHON_LIBRARY})
TARGET_LINK_LIBRARIES(SClipOperator visitcommon visitpy ${PYTHON_LIBRARY})
SET(INSTALLTARGETS ${INSTALLTARGETS} SClipOperator)
ENDIF(VISIT_PYTHON_SCRIPTING)
......@@ -114,12 +114,12 @@ IF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO
ENDIF(NOT VISIT_SERVER_COMPONENTS_ONLY AND NOT VISIT_ENGINE_ONLY AND NOT VISIT_DBIO_ONLY)
ADD_LIBRARY(EClipOperator_ser ${LIBE_SOURCES})
TARGET_LINK_LIBRARIES(EClipOperator_ser visitcommon avtexpressions_ser avtfilters_ser avtpipeline_ser avtmath )
TARGET_LINK_LIBRARIES(EClipOperator_ser visitcommon avtexpressions_ser avtfilters_ser avtpipeline_ser )
SET(INSTALLTARGETS ${INSTALLTARGETS} EClipOperator_ser)
IF(VISIT_PARALLEL)
ADD_PARALLEL_LIBRARY(EClipOperator_par ${LIBE_SOURCES})
TARGET_LINK_LIBRARIES(EClipOperator_par visitcommon avtexpressions_par avtfilters_par avtpipeline_par avtmath)
TARGET_LINK_LIBRARIES(EClipOperator_par visitcommon avtexpressions_par avtfilters_par avtpipeline_par)
SET(INSTALLTARGETS ${INSTALLTARGETS} EClipOperator_par)
ENDIF(VISIT_PARALLEL)
......
......@@ -92,8 +92,5 @@
<Include file="header" quoted="false">
PlaneAttributes.h
</Include>
<Include file="header" quoted="false">
avtVector.h
</Include>
</Attribute>
</Plugin>
......@@ -683,14 +683,15 @@ ClipAttributes::CreateCompatible(const std::string &tname) const
}
// Compute up vector
avtVector temp(0, 0, 1);
avtVector normal(normal_arr);
if (normal.x == 0 && normal.y == 0)
temp.y = 1;
avtVector up = normal % temp;
double up_a[3] = { up.x, up.y, up.z };
p->SetUpAxis(up_a);
double temp[3] = {0, 0, 1};
if (normal_arr[0] == 0 && normal_arr[1] == 0)
temp[1] = 1;
double up[3];
up[0] = normal_arr[1]*temp[2] - normal_arr[2]*temp[1];
up[1] = normal_arr[2]*temp[0] - normal_arr[0]*temp[2];
up[2] = normal_arr[0]*temp[1] - normal_arr[1]*temp[0];
p->SetUpAxis(up);
p->SetThreeSpace(true);
retval = p;
......
......@@ -177,14 +177,15 @@ ClipAttributes::CreateCompatible(const std::string &tname) const
}
// Compute up vector
avtVector temp(0, 0, 1);
avtVector normal(normal_arr);
if (normal.x == 0 && normal.y == 0)
temp.y = 1;
avtVector up = normal % temp;
double up_a[3] = { up.x, up.y, up.z };
p->SetUpAxis(up_a);
double temp[3] = {0, 0, 1};
if (normal_arr[0] == 0 && normal_arr[1] == 0)
temp[1] = 1;
double up[3];
up[0] = normal_arr[1]*temp[2] - normal_arr[2]*temp[1];
up[1] = normal_arr[2]*temp[0] - normal_arr[0]*temp[2];
up[2] = normal_arr[0]*temp[1] - normal_arr[1]*temp[0];
p->SetUpAxis(up);
p->SetThreeSpace(true);
retval = p;
......
......@@ -233,6 +233,9 @@ ELSE(VISIT_STATIC)
visitpy
${PYTHON_LIBRARIES}
)
IF(NOT APPLE)
SET_TARGET_PROPERTIES(visitmodule PROPERTIES INSTALL_RPATH "$ORIGIN")
ENDIF(NOT APPLE)
# Create the front end visit module
IF(NOT WIN32)
......@@ -243,6 +246,9 @@ ELSE(VISIT_STATIC)
TARGET_LINK_LIBRARIES(visitfrontend
${PYTHON_LIBRARIES}
)
IF(NOT APPLE)
SET_TARGET_PROPERTIES(visitfrontend PROPERTIES INSTALL_RPATH "$ORIGIN")
ENDIF(NOT APPLE)
VISIT_INSTALL_TARGETS(visitfrontend)
ENDIF(NOT WIN32)
......
......@@ -209,21 +209,31 @@
#define NO_ARGUMENTS() if(!PyArg_ParseTuple(args, "")) return NULL;
#if defined(_WIN32)
# define VISITMODULE_API /* not affected */
#else
# if __GNUC__ >= 4
# define VISITMODULE_API __attribute__ ((visibility("default")))
# else
# define VISITMODULE_API /* not affected */
# endif
#endif
//
// Make the initvisit function callable from C.
//
extern "C"
{
void initvisit();
void initvisit2();
void cli_initvisit(int, bool, int, char **, int, char **);
void cli_runscript(const char *);
VISITMODULE_API void initvisit();
VISITMODULE_API void initvisit2();
VISITMODULE_API void cli_initvisit(int, bool, int, char **, int, char **);
VISITMODULE_API void cli_runscript(const char *);
// Expose these functions so we can call them from a facade
// VisIt module from "import visit" inside of Python.
PyObject *visit_Launch(PyObject *, PyObject *);
PyObject *visit_SetDebugLevel(PyObject *, PyObject *);
PyObject *visit_AddArgument(PyObject *, PyObject *);
VISITMODULE_API PyObject *visit_Launch(PyObject *, PyObject *);
VISITMODULE_API PyObject *visit_SetDebugLevel(PyObject *, PyObject *);
VISITMODULE_API PyObject *visit_AddArgument(PyObject *, PyObject *);
}
//
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2010, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* All rights reserved.
......@@ -172,7 +172,7 @@ cleanupvisit(void)
}
/*****************************************************************************
* Function: ReadLIBPATH
* Function: ReadVisItEnvironment
*
* Purpose:
* Reads LIBPATH that would be set up by the VisIt script that
......@@ -191,55 +191,75 @@ cleanupvisit(void)
* Creation: Wed Nov 22 15:17:56 PST 2006
*
* Modifications:
*
* Brad Whitlock, Wed May 26 15:49:37 PST 2010
* I changed the function so it also reads VISITPLUGINDIR.
*
* ***************************************************************************/
char *
ReadLIBPATH(const char *visitProgram)
int
ReadVisItEnvironment(const char *visitProgram, char **LIBPATH,
char **VISITPLUGINDIR)
{
FILE *p = NULL;
char *LIBPATH = NULL;
char line[2000];
char *command = NULL;
int vpdLen = 0;
const char *vpd = "LIBPATH=";
int lpLen = 0, vpdLen = 0, ldlpLen = 0;
const char *lp = "LIBPATH=";
const char *vpd = "VISITPLUGINDIR=";
lpLen = strlen(lp);
vpdLen = strlen(vpd);
*LIBPATH = NULL;
*VISITPLUGINDIR = NULL;
command = (char*)malloc(strlen(visitProgram) + 1 + strlen(" -env"));
if(command == NULL)
return NULL;
return 0;
sprintf(command, "%s -env", visitProgram);
p = popen(command, "r");
if(p == NULL)
{
free(command);
return NULL;
return 0;
}
while(!feof(p))
{
fgets(line, 2000, p);
if(strncmp(line, vpd, vpdLen) == 0)
if(strncmp(line, lp, lpLen) == 0)
{
char *value = NULL, *end = NULL;
int len;
value = line + vpdLen;
value = line + lpLen;
len = strlen(value);
/* Trim off the newlines and colons at the end.*/
end = value + len;
while(*end == '\0' || *end == '\n' || *end == ':')
*end-- = '\0';
/* Copy the string. */
LIBPATH=(char *)malloc(len + 1);
strcpy(LIBPATH, value);
break;
*LIBPATH=(char *)malloc(len + 1);
strcpy(*LIBPATH, value);
}
else if(strncmp(line, vpd, vpdLen) == 0)
{
char *value = NULL, *end = NULL;
int len;
value = line;
len = strlen(value);
/* Trim off the newlines and colons at the end.*/
end = value + len;
while(*end == '\0' || *end == '\n' || *end == ':')
*end-- = '\0';
/* Copy the string. */
*VISITPLUGINDIR=(char *)malloc(len + 1);
strcpy(*VISITPLUGINDIR, value);
}
}
pclose(p);
free(command);
return LIBPATH;
return 1;
}
/*****************************************************************************
......@@ -262,13 +282,18 @@ ReadLIBPATH(const char *visitProgram)
* Creation: Wed Dec 13 10:45:58 PDT 2006
*
* Modifications:
*
* Brad Whitlock, Wed May 26 15:50:34 PST 2010
* Use provided arguments to get the right version of VisIt. Also set
* VISITPLUGINDIR.
*
* ***************************************************************************/
PyObject *
visit_frontend_Launch(PyObject *self, PyObject *args)
{
char *visitProgram = NULL, *LIBPATH = NULL;
char *visitProgram = NULL, *visitProgramWithArgs = NULL,
*LIBPATH = NULL, *VISITPLUGINDIR = NULL;
int i, slen = 0;
PyCFunction func = NULL;
static char *visitProgramDefault = "visit";
#if defined(_WIN32)
......@@ -300,10 +325,28 @@ visit_frontend_Launch(PyObject *self, PyObject *args)
fprintf(stderr, "visitProgram = %s\n", visitProgram);
#endif
/* Decorate visitProgram with any arguments we have added. */
slen = strlen(visitProgram) + 1;
for(i = 0; moduleState->arguments[i] != NULL; i++)
slen += strlen(moduleState->arguments[i]) + 1 + 1;
visitProgramWithArgs = (char *)malloc(slen);
strcpy(visitProgramWithArgs, visitProgram);
slen = strlen(visitProgramWithArgs);
for(i = 0; moduleState->arguments[i] != NULL; i++)
{
sprintf(&visitProgramWithArgs[slen], " %s", moduleState->arguments[i]);
slen += (strlen(moduleState->arguments[i]) + 1);
}
#ifdef DEBUG_PRINT
fprintf(stderr, "visitProgramWithArgs = %s\n", visitProgramWithArgs);
#endif
/* Read the LIBPATH that would be used by the specified VisIt program
* so we know where to look for visitmodule.so
*/
LIBPATH = ReadLIBPATH(visitProgram);
ReadVisItEnvironment(visitProgramWithArgs, &LIBPATH, &VISITPLUGINDIR);
free(visitProgramWithArgs);
visitProgramWithArgs = NULL;
if(LIBPATH == 0)
{
#ifdef DEBUG_PRINT
......@@ -317,6 +360,19 @@ visit_frontend_Launch(PyObject *self, PyObject *args)
fprintf(stderr, "LIBPATH = %s\n", LIBPATH);
}
#endif
if(VISITPLUGINDIR == 0)
{
#ifdef DEBUG_PRINT
fprintf(stderr, "VISITPLUGINDIR = NULL\n");
#endif
return NULL;
}
#ifdef DEBUG_PRINT
else
{
fprintf(stderr, "VISITPLUGINDIR = %s\n", VISITPLUGINDIR);
}
#endif
#if defined(__APPLE__)
/* use LIBPATH but truncate the "/lib" */
......@@ -339,6 +395,11 @@ visit_frontend_Launch(PyObject *self, PyObject *args)
putenv(envcommand);
free(VISITHOME);
free(envcommand);
#else
/* UNIX */
/* Set the plugin dir */
putenv(VISITPLUGINDIR);
#endif
/* Save off the name of the module file that we will have to load
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment