Commit bc4e30a3 authored by Kirill Terekhov's avatar Kirill Terekhov

Few fixes

Do not build Octree when opengl was not found.

Constant correctness for dense matrices.
parent 1fd9859b
...@@ -373,7 +373,7 @@ int main(int argc,char ** argv) ...@@ -373,7 +373,7 @@ int main(int argc,char ** argv)
TagReal tag_Q; // Pressure update TagReal tag_Q; // Pressure update
TagReal tag_F; // Forcing term TagReal tag_F; // Forcing term
TagRealArray tag_W; // Gradient matrix TagRealArray tag_W; // Gradient matrix
TagInteger tag_i; // row number for current cell in back cell matrix TagInteger tag_i; // row number for current face in back cell matrix
if( m.GetProcessorsNumber() > 1 ) //skip for one processor job if( m.GetProcessorsNumber() > 1 ) //skip for one processor job
...@@ -404,8 +404,8 @@ int main(int argc,char ** argv) ...@@ -404,8 +404,8 @@ int main(int argc,char ** argv)
{ {
Cell c = m.CellByLocalID(it); Cell c = m.CellByLocalID(it);
ElementArray<Face> faces = c.getFaces(); //obtain faces of the cell ElementArray<Face> faces = c.getFaces(); //obtain faces of the cell
tag_W[c].resize(faces.size()*faces.size()); Matrix<real,real_array> W(tag_W[c]);
Matrix<real,real_array> W(tag_W[c],faces.size(),faces.size()); W.Resize(faces.size(),faces.size());
real xP[3]; //center of the cell real xP[3]; //center of the cell
real yF[3]; //center of the face real yF[3]; //center of the face
real nF[3]; //normal to the face real nF[3]; //normal to the face
......
...@@ -48,6 +48,7 @@ if(OPENGL_FOUND) ...@@ -48,6 +48,7 @@ if(OPENGL_FOUND)
endif(GLUT_FOUND) endif(GLUT_FOUND)
else(OPENGL_FOUND) else(OPENGL_FOUND)
message("OpenGL not found for ${vtarget}") message("OpenGL not found for ${vtarget}")
endif(OPENGL_FOUND) endif(OPENGL_FOUND)
if(USE_PARTITIONER_ZOLTAN) if(USE_PARTITIONER_ZOLTAN)
...@@ -61,4 +62,6 @@ endif() ...@@ -61,4 +62,6 @@ endif()
endforeach(vtarget ${TARGETS}) endforeach(vtarget ${TARGETS})
if(NOT OPENGL_FOUND)
set_target_properties(Octree PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
endif(NOT OPENGL_FOUND)
...@@ -794,13 +794,20 @@ namespace INMOST ...@@ -794,13 +794,20 @@ namespace INMOST
/// @param pn Number of rows. /// @param pn Number of rows.
/// @param pm Number of columns. /// @param pm Number of columns.
Matrix(const Var * pspace, enumerator pn, enumerator pm) : space(pspace,pspace+pn*pm), n(pn), m(pm) {} Matrix(const Var * pspace, enumerator pn, enumerator pm) : space(pspace,pspace+pn*pm), n(pn), m(pm) {}
/// Construct the matrix with the provided storage. /// Construct the matrix with the provided storage with known size.
/// Could be used to wrap existing array. /// Could be used to wrap existing array.
/// \warning The size of the provided container is assumed to be pn*pm.
/// @param pspace Storage of elements of the matrix, stored in row-wise format. /// @param pspace Storage of elements of the matrix, stored in row-wise format.
/// @param pn Number of rows. /// @param pn Number of rows.
/// @param pm Number of columns. /// @param pm Number of columns.
/// \todo Do we need reference for pspace or just pspace? /// \todo Do we need reference for pspace or just pspace?
Matrix(storage_type pspace, enumerator pn, enumerator pm) : space(pspace), n(pn), m(pm) {} Matrix(const storage_type & pspace, enumerator pn, enumerator pm) : space(pspace), n(pn), m(pm) {}
/// Construct the matrix with the provided storage and unknown size.
/// Could be used to wrap existing array.
/// \warning Have to call Resize afterwards.
/// @param pspace Storage of elements of the matrix, stored in row-wise format.
/// \todo Do we need reference for pspace or just pspace?
Matrix(const storage_type & pspace) : space(pspace), n(0), m(0) {}
/// Construct a matrix with provided sizes. /// Construct a matrix with provided sizes.
/// @param pn Number of rows. /// @param pn Number of rows.
/// @param pm Number of columns. /// @param pm Number of columns.
...@@ -928,7 +935,7 @@ namespace INMOST ...@@ -928,7 +935,7 @@ namespace INMOST
/// @param size Size of the input array. /// @param size Size of the input array.
/// @param matsize Size of the final tensor. /// @param matsize Size of the final tensor.
/// @return Matrix of the tensor of size matsize by matsize. /// @return Matrix of the tensor of size matsize by matsize.
static Matrix<Var> FromTensor(Var * K, enumerator size, enumerator matsize = 3) static Matrix<Var> FromTensor(const Var * K, enumerator size, enumerator matsize = 3)
{ {
Matrix<Var> Kc(matsize,matsize); Matrix<Var> Kc(matsize,matsize);
if( matsize == 1 ) if( matsize == 1 )
...@@ -1046,7 +1053,7 @@ namespace INMOST ...@@ -1046,7 +1053,7 @@ namespace INMOST
/// @param r Array of elements of the vector. /// @param r Array of elements of the vector.
/// @param size Size of the vector. /// @param size Size of the vector.
/// @return Vector with contents of the array. /// @return Vector with contents of the array.
static Matrix FromVector(Var * r, enumerator size) static Matrix FromVector(const Var * r, enumerator size)
{ {
return Matrix(r,size,1); return Matrix(r,size,1);
} }
...@@ -1054,7 +1061,7 @@ namespace INMOST ...@@ -1054,7 +1061,7 @@ namespace INMOST
/// @param r Array of diagonal elements. /// @param r Array of diagonal elements.
/// @param size Size of the matrix. /// @param size Size of the matrix.
/// @return Matrix with diagonal defined by array, other elements are zero. /// @return Matrix with diagonal defined by array, other elements are zero.
static Matrix FromDiagonal(Var * r, enumerator size) static Matrix FromDiagonal(const Var * r, enumerator size)
{ {
Matrix ret(size,size); Matrix ret(size,size);
ret.Zero(); ret.Zero();
...@@ -1065,7 +1072,7 @@ namespace INMOST ...@@ -1065,7 +1072,7 @@ namespace INMOST
/// @param r Array of diagonal elements. /// @param r Array of diagonal elements.
/// @param size Size of the matrix. /// @param size Size of the matrix.
/// @return Matrix with diagonal defined by inverse of array elements. /// @return Matrix with diagonal defined by inverse of array elements.
static Matrix FromDiagonalInverse(Var * r, enumerator size) static Matrix FromDiagonalInverse(const Var * r, enumerator size)
{ {
Matrix ret(size,size); Matrix ret(size,size);
ret.Zero(); ret.Zero();
...@@ -1078,7 +1085,7 @@ namespace INMOST ...@@ -1078,7 +1085,7 @@ namespace INMOST
/// and vector. For a x b equivalent is CrossProduct(a)*b. /// and vector. For a x b equivalent is CrossProduct(a)*b.
/// @param vec Array of elements representing a vector. /// @param vec Array of elements representing a vector.
/// @return A matrix representing cross product. /// @return A matrix representing cross product.
static Matrix CrossProduct(Var vec[3]) static Matrix CrossProduct(const Var vec[3])
{ {
// | 0 -z y | // | 0 -z y |
// | z 0 -x | // | z 0 -x |
......
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