Skip to content
Snippets Groups Projects
Commit adc6d4d8 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

tests with jf
parent f69047c3
No related branches found
No related tags found
No related merge requests found
......@@ -16,10 +16,6 @@
#define EPS 1.e-10
// This file defines the colorbarWindow class (subclass of Fl_Window)
// The constructor
colorbarWindow::colorbarWindow(int x, int y, int w, int h, const char *l)
: Fl_Window(x, y, w, h, l)
{
......@@ -33,8 +29,6 @@ colorbarWindow::colorbarWindow(int x, int y, int w, int h, const char *l)
minval = maxval = 0.0;
}
// Convert window X coordinate to color table index
int colorbarWindow::x_to_index(int x)
{
int index;
......@@ -46,8 +40,6 @@ int colorbarWindow::x_to_index(int x)
return index;
}
// Convert color table index to window X coordinate
int colorbarWindow::index_to_x(int index)
{
int x;
......@@ -57,21 +49,6 @@ int colorbarWindow::index_to_x(int index)
return x;
}
// Convert a color intensity to a window Y coordinate
int colorbarWindow::intensity_to_y(int intensity)
{
int y;
y = (int)(wedge_y - intensity * (double)wedge_y / 255.);
if(y < 0)
y = 0;
else if(y >= wedge_y)
y = wedge_y - 1;
return y;
}
// Convert a window Y coordinate to a color intensity
int colorbarWindow::y_to_intensity(int y)
{
int intensity;
......@@ -83,7 +60,16 @@ int colorbarWindow::y_to_intensity(int y)
return intensity;
}
// Redraw part of the colorbarWindow (between a and b)
int colorbarWindow::intensity_to_y(int intensity)
{
int y;
y = (int)(wedge_y - intensity * (double)wedge_y / 255.);
if(y < 0)
y = 0;
else if(y >= wedge_y)
y = wedge_y - 1;
return y;
}
void colorbarWindow::redraw_range(int a, int b)
{
......@@ -259,9 +245,6 @@ void colorbarWindow::redraw_range(int a, int b)
fl_draw("HSV", xx0, yy0 + font_height);
}
// Redraw the marker and the text
void colorbarWindow::redraw_marker()
{
int x, y0, y1;
......@@ -291,8 +274,6 @@ void colorbarWindow::redraw_marker()
fl_draw(str, 10, label_y);
}
// Draw everything
void colorbarWindow::draw()
{
if(!ct) return;
......@@ -310,8 +291,6 @@ void colorbarWindow::draw()
redraw_marker();
}
// Update
void colorbarWindow::update(const char *name, double min, double max,
GmshColorTable *table, bool *changed)
{
......@@ -323,8 +302,6 @@ void colorbarWindow::update(const char *name, double min, double max,
redraw();
}
// Handle
int colorbarWindow::handle(int event)
{
if(!ct) return Fl_Window::handle(event);
......
......@@ -23,16 +23,22 @@ class colorbarWindow : public Fl_Window {
GmshColorTable *ct; // pointer to the color table (allocated in the view)
bool *viewchanged; // pointer to changed bit in view
Fl_Color color_bg;
// convert window X coordinate to color table index
int x_to_index(int x);
// convert color table index to window X coordinate
int index_to_x(int index);
// convert a window Y coordinate to a color intensity
int y_to_intensity(int y);
// convert a color intensity to a window Y coordinate
int intensity_to_y(int intensity);
// redraw part of the colorbarWindow (between a and b)
void redraw_range(int a, int b);
// redraw the marker and the text
void redraw_marker();
void draw();
int handle(int);
public:
colorbarWindow(int x, int y, int w, int h, const char *l=0);
void draw();
int handle(int);
void update(const char *name, double min, double max, GmshColorTable *ct,
bool *changed);
};
......
......@@ -193,7 +193,7 @@ void status_options_cb(Fl_Widget *w, void *data)
}
}
static int stop_anim, view_in_cycle = -1;
static int stop_anim = 0, view_in_cycle = -1;
void status_play_manual(int time, int step)
{
......
......@@ -31,7 +31,7 @@ static void message_copy_cb(Fl_Widget *w, void *data)
for(int i = 1; i <= GUI::instance()->messages->browser->size(); i++) {
if(GUI::instance()->messages->browser->selected(i)) {
const char *c = GUI::instance()->messages->browser->text(i);
if(c[0] == '@')
if(strlen(c) > 5 && c[0] == '@')
buff += std::string(&c[5]);
else
buff += std::string(c);
......
......@@ -125,16 +125,11 @@ void openglWindow::drawBorder()
*/
glColor3ub(r, g, b);
glLineWidth(1);
#if defined(__APPLE__)
int ww = 1;
#else
int ww = 0;
#endif
glBegin(GL_LINE_LOOP);
glVertex2d(_ctx->viewport[0], _ctx->viewport[1]);
glVertex2d(_ctx->viewport[2] - ww, _ctx->viewport[1]);
glVertex2d(_ctx->viewport[2] - ww, _ctx->viewport[3] - ww);
glVertex2d(_ctx->viewport[0], _ctx->viewport[3] - ww);
glVertex2d(_ctx->viewport[2], _ctx->viewport[1]);
glVertex2d(_ctx->viewport[2], _ctx->viewport[3]);
glVertex2d(_ctx->viewport[0], _ctx->viewport[3]);
glEnd();
}
}
......
......@@ -2904,9 +2904,18 @@ bool ProjectPointOnSurface(Surface *s, Vertex &p, double uv[2])
x(0) = uv[0];
x(1) = uv[1];
PointSurface ps = {&p, s};
if(newton_fd(projectPS, x, &ps)){
double UMIN = 0.;
double UMAX = 1.;
double VMIN = 0.;
double VMAX = 1.;
while(1) {
newton_fd(projectPS, x, &ps);
p = InterpolateSurface(s, x(0), x(1), 0, 0);
return true;
if(x(0) >= UMIN && x(0) <= UMAX && x(1) >= VMIN && x(1) <= VMAX)
break;
x(0) = UMIN + (UMAX - UMIN) * ((rand() % 10000) / 10000.);
x(1) = VMIN + (VMAX - VMIN) * ((rand() % 10000) / 10000.);
}
return false;
}
......
......@@ -6,6 +6,7 @@
#ifndef _GMSH_MATRIX_H_
#define _GMSH_MATRIX_H_
#include <stdio.h>
#include <math.h>
#include "GmshConfig.h"
#include "GmshMessage.h"
......@@ -204,6 +205,17 @@ class gmshMatrix
}
#endif
;
void print()
{
for(int i = 0; i < size1(); i++){
for(int j = 0; j < size2(); j++){
printf(" %12.5e");
}
printf("\n");
}
return false;
}
;
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment