Commit 9bbd76de authored by GILLES Sebastien's avatar GILLES Sebastien

#1480 Move a function into Internal namespace.

parent c0284681
......@@ -1633,6 +1633,8 @@
BEF4A6E122E1BF0400CD4A6E /* OutputDirectoryStorage.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BEF4A6DE22E1BF0400CD4A6E /* OutputDirectoryStorage.hxx */; };
BEF4A6E222E1BF0400CD4A6E /* OutputDirectoryStorage.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEF4A6DF22E1BF0400CD4A6E /* OutputDirectoryStorage.hpp */; };
BEF795E022DDDE430054B192 /* BinaryOrAscii.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEF795DD22DDDE430054B192 /* BinaryOrAscii.hpp */; };
BEF9B60F231E590D009A680D /* Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEF9B60D231E590C009A680D /* Directory.cpp */; };
BEF9B612231E591B009A680D /* Directory.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEF9B611231E591B009A680D /* Directory.hpp */; };
BEFC32DF1CB53C3B00C8903C /* RefFEltInLocalOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEFC32DC1CB53C3B00C8903C /* RefFEltInLocalOperator.cpp */; };
BEFC32E01CB53C3B00C8903C /* RefFEltInLocalOperator.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEFC32DD1CB53C3B00C8903C /* RefFEltInLocalOperator.hpp */; };
BEFC32E11CB53C3B00C8903C /* RefFEltInLocalOperator.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BEFC32DE1CB53C3B00C8903C /* RefFEltInLocalOperator.hxx */; };
......@@ -4897,6 +4899,8 @@
BEF795DD22DDDE430054B192 /* BinaryOrAscii.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = BinaryOrAscii.hpp; sourceTree = "<group>"; };
BEF9835B180451CF00E7905D /* Factory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Factory.cpp; sourceTree = "<group>"; };
BEF9835C180451CF00E7905D /* Factory.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Factory.hpp; sourceTree = "<group>"; };
BEF9B60D231E590C009A680D /* Directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Directory.cpp; sourceTree = "<group>"; };
BEF9B611231E591B009A680D /* Directory.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Directory.hpp; sourceTree = "<group>"; };
BEFC32DC1CB53C3B00C8903C /* RefFEltInLocalOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefFEltInLocalOperator.cpp; sourceTree = "<group>"; };
BEFC32DD1CB53C3B00C8903C /* RefFEltInLocalOperator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RefFEltInLocalOperator.hpp; sourceTree = "<group>"; };
BEFC32DE1CB53C3B00C8903C /* RefFEltInLocalOperator.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RefFEltInLocalOperator.hxx; sourceTree = "<group>"; };
......@@ -9847,6 +9851,8 @@
BE35030722F2E96700D09A4D /* Directory.cpp */,
BE35030922F2E96700D09A4D /* Directory.hpp */,
BE35030822F2E96700D09A4D /* Directory.hxx */,
BEF9B60B231D6AF1009A680D /* Advanced */,
BEF9B60C231E58BB009A680D /* Internal */,
);
path = Filesystem;
sourceTree = "<group>";
......@@ -10718,6 +10724,22 @@
path = VectorIO;
sourceTree = "<group>";
};
BEF9B60B231D6AF1009A680D /* Advanced */ = {
isa = PBXGroup;
children = (
);
path = Advanced;
sourceTree = "<group>";
};
BEF9B60C231E58BB009A680D /* Internal */ = {
isa = PBXGroup;
children = (
BEF9B60D231E590C009A680D /* Directory.cpp */,
BEF9B611231E591B009A680D /* Directory.hpp */,
);
path = Internal;
sourceTree = "<group>";
};
BEFC32DB1CB53C3B00C8903C /* Advanced */ = {
isa = PBXGroup;
children = (
......@@ -11571,6 +11593,7 @@
BE90E18F1A24929A00CCAFDE /* File.hpp in Headers */,
BE44C05B1AA463DF0030FA26 /* Pragma.hpp in Headers */,
0A2CBE981D05B87A007262F2 /* Model.hpp in Headers */,
BEF9B612231E591B009A680D /* Directory.hpp in Headers */,
BE4ED31D1A2CBAC400DE374E /* MatrixOperations.hpp in Headers */,
BECEF92D22DF5D5E00D0DDE7 /* Now.hpp in Headers */,
BE90E1B11A24929A00CCAFDE /* Vector.hxx in Headers */,
......@@ -13023,6 +13046,7 @@
BE90E1AF1A24929A00CCAFDE /* Vector.cpp in Sources */,
BE110EA31E11514200D2D2C8 /* VectorHelper.cpp in Sources */,
BE90E1711A24926E00CCAFDE /* String.cpp in Sources */,
BEF9B60F231E590D009A680D /* Directory.cpp in Sources */,
BE35030A22F2E96700D09A4D /* Directory.cpp in Sources */,
BEDEB9281C3C073100B1C71B /* Umfpack.cpp in Sources */,
BECEF92B22DF5D5E00D0DDE7 /* Now.cpp in Sources */,
......@@ -16,6 +16,7 @@
#include "Utilities/String/String.hpp"
#include "Utilities/OutputFormat/ReadBinaryFile.hpp"
#include "Utilities/Filesystem/Internal/Directory.hpp"
#include "Core/NumberingSubset/NumberingSubset.hpp"
......@@ -228,7 +229,8 @@ namespace MoReFEM
{
decltype(auto) data_directory = GetDataDirectory();
FilesystemNS::Directory rank_data_directory = GetRankDirectory(data_directory, rank, __FILE__, __LINE__);
FilesystemNS::Directory rank_data_directory =
Internal::FilesystemNS::GetRankDirectory(data_directory, rank, __FILE__, __LINE__);
FilesystemNS::Directory mesh_dir(rank_data_directory,
"Mesh_" + std::to_string(GetMesh().GetUniqueId()),
......
......@@ -230,29 +230,6 @@ namespace MoReFEM::FilesystemNS
}
Directory GetRankDirectory(const Directory& root_directory,
unsigned int rank,
const char* invoking_file, int invoking_line)
{
assert(root_directory.GetMpi().IsRootProcessor());
assert(root_directory.IsWithRank());
// I usually don't like the '..' trick but exceptionally it is the best way to do it without complciting
// further Directory API.
Directory one_step_above(root_directory,
"..",
__FILE__, __LINE__,
std::make_unique<behaviour>(behaviour::read));
Directory ret(one_step_above,
"Rank_" + std::to_string(rank),
invoking_file, invoking_line);
return ret;
}
std::ostream& operator<<(std::ostream& out, behaviour rhs)
{
switch(rhs)
......
......@@ -270,7 +270,7 @@ namespace MoReFEM::FilesystemNS
/*!
* \brief Create a \a Directory which contains path related to \a rank - where rank is NOT necessarily the one'
* \brief Create a \a Directory which contains path related to \a rank - where rank is NOT necessarily the one
* held by mpi object.
*
* \attention Should only be used on mpi root processor!
......
//! \file
//
//
// Directory.cpp
// MoReFEM
//
// Created by sebastien on 01/08/2019.
//Copyright © 2019 Inria. All rights reserved.
//
#include <memory>
#include "Utilities/Filesystem/Internal/Directory.hpp"
namespace MoReFEM::Internal::FilesystemNS
{
namespace // anonymous
{
using Directory = ::MoReFEM::FilesystemNS::Directory;
using behaviour = ::MoReFEM::FilesystemNS::behaviour;
} // namespace anonymous
Directory GetRankDirectory(const Directory& root_directory,
unsigned int rank,
const char* invoking_file, int invoking_line)
{
assert(root_directory.GetMpi().IsRootProcessor());
assert(root_directory.IsWithRank());
// I usually don't like the '..' trick but exceptionally it is the best way to do it without complexifying
// further Directory API.
Directory one_step_above(root_directory,
"..",
__FILE__, __LINE__,
std::make_unique<behaviour>(behaviour::read));
Directory ret(one_step_above,
"Rank_" + std::to_string(rank),
invoking_file, invoking_line);
return ret;
}
} // namespace MoReFEM::Internal::FilesystemNS
//! \file
//
//
// Directory.hpp
// MoReFEM
//
// Created by sebastien on 01/08/2019.
//Copyright © 2019 Inria. All rights reserved.
//
#ifndef MOREFEM_x_UTILITIES_x_FILESYSTEM_x_INTERNAL_x_DIRECTORY_HPP_
# define MOREFEM_x_UTILITIES_x_FILESYSTEM_x_INTERNAL_x_DIRECTORY_HPP_
# include "Utilities/Filesystem/Directory.hpp"
namespace MoReFEM::Internal::FilesystemNS
{
/*!
* \brief Create a \a Directory which contains path related to \a rank - where rank is NOT necessarily the one
* held by mpi object.
*
* \attention Should only be used on mpi root processor!
*
* This is only for some specific functions and should be used with great care; behaviour is set to 'read'
* and should be changed with even greater care...
*
* \param[in] root_directory The directory matching the root rank.
* \param[in] rank Rank for which the new directory is required.
* \copydoc doxygen_hide_invoking_file_and_line
*
* \return The directory related to the chosen \a rank argument. It is created with the 'read' behaviour - and
* this one should changed with great care! (or better left unchanged).
*/
::MoReFEM::FilesystemNS::Directory GetRankDirectory(const ::MoReFEM::FilesystemNS::Directory& root_directory,
unsigned int rank,
const char* invoking_file, int invoking_line);
} // namespace MoReFEM::Internal::FilesystemNS
#endif // MOREFEM_x_UTILITIES_x_FILESYSTEM_x_INTERNAL_x_DIRECTORY_HPP_
### ===================================================================================
### This file is generated automatically by Scripts/generate_cmake_source_list.py.
### Do not edit it manually!
### Convention is that:
### - When a CMake file is manually managed, it is named canonically CMakeLists.txt.
###. - When it is generated automatically, it is named SourceList.cmake.
### ===================================================================================
target_sources(${MOREFEM_UTILITIES}
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Directory.cpp"
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Directory.hpp"
)
......@@ -21,3 +21,5 @@ target_sources(${MOREFEM_UTILITIES}
"${CMAKE_CURRENT_LIST_DIR}/Folder.hpp"
)
include(${CMAKE_CURRENT_LIST_DIR}/Advanced/SourceList.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/Internal/SourceList.cmake)
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