Line data Source code
1 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3 : !!!!
4 : !!!! MIT License
5 : !!!!
6 : !!!! ParaMonte: plain powerful parallel Monte Carlo library.
7 : !!!!
8 : !!!! Copyright (C) 2012-present, The Computational Data Science Lab
9 : !!!!
10 : !!!! This file is part of the ParaMonte library.
11 : !!!!
12 : !!!! Permission is hereby granted, free of charge, to any person obtaining a
13 : !!!! copy of this software and associated documentation files (the "Software"),
14 : !!!! to deal in the Software without restriction, including without limitation
15 : !!!! the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 : !!!! and/or sell copies of the Software, and to permit persons to whom the
17 : !!!! Software is furnished to do so, subject to the following conditions:
18 : !!!!
19 : !!!! The above copyright notice and this permission notice shall be
20 : !!!! included in all copies or substantial portions of the Software.
21 : !!!!
22 : !!!! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 : !!!! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 : !!!! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 : !!!! IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26 : !!!! DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27 : !!!! OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
28 : !!!! OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 : !!!!
30 : !!!! ACKNOWLEDGMENT
31 : !!!!
32 : !!!! ParaMonte is an honor-ware and its currency is acknowledgment and citations.
33 : !!!! As per the ParaMonte library license agreement terms, if you use any parts of
34 : !!!! this library for any purposes, kindly acknowledge the use of ParaMonte in your
35 : !!!! work (education/research/industry/development/...) by citing the ParaMonte
36 : !!!! library as described on this page:
37 : !!!!
38 : !!!! https://github.com/cdslaborg/paramonte/blob/main/ACKNOWLEDGMENT.md
39 : !!!!
40 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41 : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
42 :
43 : !> \brief
44 : !> This module contains the classes and procedures for setting up the basic attributes of ParaMonte samplers.
45 : !> For more information, see the description of this attributes in the body of the corresponding modules.
46 : !> \author Amir Shahmoradi
47 :
48 : module SpecBase_mod
49 :
50 : ! ParaMonte Spec variable types
51 : use SpecBase_SampleSize_mod , only: SampleSize_type
52 : use SpecBase_RandomSeed_mod , only: RandomSeed_type
53 : use SpecBase_Description_mod , only: Description_type
54 : use SpecBase_OutputFileName_mod , only: OutputFileName_type
55 : use SpecBase_OutputDelimiter_mod , only: OutputDelimiter_type
56 : use SpecBase_ChainFileFormat_mod , only: ChainFileFormat_type
57 : use SpecBase_VariableNameList_mod , only: VariableNameList_type
58 : use SpecBase_RestartFileFormat_mod , only: RestartFileFormat_type
59 : use SpecBase_OutputColumnWidth_mod , only: OutputColumnWidth_type
60 : use SpecBase_OverwriteRequested_mod , only: OverwriteRequested_type
61 : use SpecBase_OutputRealPrecision_mod , only: OutputRealPrecision_type
62 : use SpecBase_SilentModeRequested_mod , only: SilentModeRequested_type
63 : use SpecBase_DomainLowerLimitVec_mod , only: DomainLowerLimitVec_type
64 : use SpecBase_DomainUpperLimitVec_mod , only: DomainUpperLimitVec_type
65 : use SpecBase_ParallelizationModel_mod , only: ParallelizationModel_type
66 : use SpecBase_InputFileHasPriority_mod , only: InputFileHasPriority_type
67 : use SpecBase_ProgressReportPeriod_mod , only: ProgressReportPeriod_type
68 : use SpecBase_TargetAcceptanceRate_mod , only: TargetAcceptanceRate_type
69 : use SpecBase_MpiFinalizeRequested_mod , only: MpiFinalizeRequested_type
70 : use SpecBase_MaxNumDomainCheckToWarn_mod , only: MaxNumDomainCheckToWarn_type
71 : use SpecBase_MaxNumDomainCheckToStop_mod , only: MaxNumDomainCheckToStop_type
72 : use SpecBase_InterfaceType_mod , only: InterfaceType_type
73 : use SpecBase_SystemInfoFilePath_mod , only: SystemInfoFilePath_type
74 :
75 : ! ParaMonte namelist variables
76 :
77 : use SpecBase_SampleSize_mod , only: sampleSize
78 : use SpecBase_RandomSeed_mod , only: randomSeed
79 : use SpecBase_Description_mod , only: description
80 : use SpecBase_OutputFileName_mod , only: outputFileName
81 : use SpecBase_OutputDelimiter_mod , only: outputDelimiter
82 : use SpecBase_ChainFileFormat_mod , only: chainFileFormat
83 : use SpecBase_VariableNameList_mod , only: variableNameList
84 : use SpecBase_RestartFileFormat_mod , only: restartFileFormat
85 : use SpecBase_OutputColumnWidth_mod , only: outputColumnWidth
86 : use SpecBase_OverwriteRequested_mod , only: overwriteRequested
87 : use SpecBase_OutputRealPrecision_mod , only: outputRealPrecision
88 : use SpecBase_SilentModeRequested_mod , only: silentModeRequested
89 : use SpecBase_DomainLowerLimitVec_mod , only: domainLowerLimitVec
90 : use SpecBase_DomainUpperLimitVec_mod , only: domainUpperLimitVec
91 : use SpecBase_ParallelizationModel_mod , only: ParallelizationModel
92 : use SpecBase_InputFileHasPriority_mod , only: inputFileHasPriority
93 : use SpecBase_ProgressReportPeriod_mod , only: progressReportPeriod
94 : use SpecBase_TargetAcceptanceRate_mod , only: targetAcceptanceRate
95 : use SpecBase_MpiFinalizeRequested_mod , only: mpiFinalizeRequested
96 : use SpecBase_MaxNumDomainCheckToWarn_mod , only: maxNumDomainCheckToWarn
97 : use SpecBase_MaxNumDomainCheckToStop_mod , only: maxNumDomainCheckToStop
98 : use SpecBase_InterfaceType_mod , only: interfaceType
99 : use SpecBase_SystemInfoFilePath_mod , only: systemInfoFilePath
100 :
101 : implicit none
102 :
103 : character(*), parameter :: MODULE_NAME = "@SpecBase_mod"
104 :
105 : type :: SpecBase_type
106 : type(SampleSize_type) :: SampleSize
107 : type(RandomSeed_type) :: RandomSeed
108 : type(Description_type) :: Description
109 : type(OutputFileName_type) :: OutputFileName
110 : type(OutputDelimiter_type) :: OutputDelimiter
111 : type(ChainFileFormat_type) :: ChainFileFormat
112 : type(VariableNameList_type) :: VariableNameList
113 : type(RestartFileFormat_type) :: RestartFileFormat
114 : type(OutputColumnWidth_type) :: OutputColumnWidth
115 : type(OverwriteRequested_type) :: OverwriteRequested
116 : type(OutputRealPrecision_type) :: OutputRealPrecision
117 : type(SilentModeRequested_type) :: SilentModeRequested
118 : type(DomainLowerLimitVec_type) :: domainLowerLimitVec
119 : type(DomainUpperLimitVec_type) :: domainUpperLimitVec
120 : type(ParallelizationModel_type) :: ParallelizationModel
121 : type(InputFileHasPriority_type) :: InputFileHasPriority
122 : type(ProgressReportPeriod_type) :: ProgressReportPeriod
123 : type(TargetAcceptanceRate_type) :: TargetAcceptanceRate
124 : type(MpiFinalizeRequested_type) :: MpiFinalizeRequested
125 : type(MaxNumDomainCheckToWarn_type) :: MaxNumDomainCheckToWarn
126 : type(MaxNumDomainCheckToStop_type) :: MaxNumDomainCheckToStop
127 : type(InterfaceType_type) :: InterfaceType
128 : type(SystemInfoFilePath_type) :: SystemInfoFilePath
129 : contains
130 : procedure, pass :: nullifyNameListVar
131 : procedure, pass :: setFromInputFile
132 : procedure, pass :: setFromInputArgs
133 : procedure, pass :: checkForSanity
134 : procedure, pass :: reportValues
135 : end type SpecBase_type
136 :
137 : interface SpecBase_type
138 : module procedure :: constructSpecBase
139 : end interface SpecBase_type
140 :
141 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
142 :
143 : contains
144 :
145 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
146 :
147 1047 : function constructSpecBase(nd,methodName,imageID,imageCount) result(SpecBase)
148 : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
149 : !DEC$ ATTRIBUTES DLLEXPORT :: constructSpecBase
150 : #endif
151 : use Constants_mod, only: IK
152 : implicit none
153 : character(*), intent(in) :: methodName
154 : integer(IK), intent(in) :: nd
155 : integer(IK), intent(in) :: imageID, imageCount
156 : type(SpecBase_type) :: SpecBase
157 1047 : SpecBase%SampleSize = SampleSize_type(methodName)
158 1047 : SpecBase%RandomSeed = RandomSeed_type(methodName,imageID,imageCount)
159 1047 : SpecBase%Description = Description_type(methodName)
160 1047 : SpecBase%OutputFileName = OutputFileName_type(methodName)
161 1047 : SpecBase%OutputDelimiter = OutputDelimiter_type(methodName)
162 1047 : SpecBase%ChainFileFormat = ChainFileFormat_type(methodName)
163 1047 : SpecBase%VariableNameList = VariableNameList_type(nd,methodName)
164 1047 : SpecBase%RestartFileFormat = RestartFileFormat_type(methodName)
165 1047 : SpecBase%OutputColumnWidth = OutputColumnWidth_type(methodName)
166 1047 : SpecBase%OverwriteRequested = OverwriteRequested_type(methodName)
167 1047 : SpecBase%OutputRealPrecision = OutputRealPrecision_type(methodName)
168 1047 : SpecBase%SilentModeRequested = SilentModeRequested_type(methodName)
169 1047 : SpecBase%DomainLowerLimitVec = DomainLowerLimitVec_type(methodName)
170 1047 : SpecBase%DomainUpperLimitVec = DomainUpperLimitVec_type(methodName)
171 1047 : SpecBase%ParallelizationModel = ParallelizationModel_type(methodName)
172 1047 : SpecBase%InputFileHasPriority = InputFileHasPriority_type(methodName)
173 1047 : SpecBase%ProgressReportPeriod = ProgressReportPeriod_type()
174 1047 : SpecBase%TargetAcceptanceRate = TargetAcceptanceRate_type(methodName)
175 1047 : SpecBase%MpiFinalizeRequested = MpiFinalizeRequested_type(methodName)
176 1047 : SpecBase%MaxNumDomainCheckToWarn = MaxNumDomainCheckToWarn_type()
177 1047 : SpecBase%MaxNumDomainCheckToStop = MaxNumDomainCheckToStop_type()
178 1047 : SpecBase%InterfaceType = InterfaceType_type()
179 1047 : SpecBase%SystemInfoFilePath = SystemInfoFilePath_type()
180 1047 : end function constructSpecBase
181 :
182 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 :
184 1047 : subroutine nullifyNameListVar( SpecBase, nd )
185 : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
186 : !DEC$ ATTRIBUTES DLLEXPORT :: nullifyNameListVar
187 : #endif
188 1047 : use Constants_mod, only: IK
189 : implicit none
190 : class(SpecBase_type), intent(inout) :: SpecBase
191 : integer(IK), intent(in) :: nd
192 : ! nullify SpecBase global variables that have to be read form the input namelist file
193 1047 : call SpecBase%SampleSize %nullifyNameListVar()
194 1047 : call SpecBase%RandomSeed %nullifyNameListVar()
195 1047 : call SpecBase%Description %nullifyNameListVar()
196 1047 : call SpecBase%OutputFileName %nullifyNameListVar()
197 1047 : call SpecBase%OutputDelimiter %nullifyNameListVar()
198 1047 : call SpecBase%ChainFileFormat %nullifyNameListVar()
199 1047 : call SpecBase%VariableNameList %nullifyNameListVar(nd)
200 1047 : call SpecBase%RestartFileFormat %nullifyNameListVar()
201 1047 : call SpecBase%OutputColumnWidth %nullifyNameListVar()
202 1047 : call SpecBase%OverwriteRequested %nullifyNameListVar()
203 1047 : call SpecBase%DomainLowerLimitVec %nullifyNameListVar(nd)
204 1047 : call SpecBase%DomainUpperLimitVec %nullifyNameListVar(nd)
205 1047 : call SpecBase%OutputRealPrecision %nullifyNameListVar()
206 1047 : call SpecBase%SilentModeRequested %nullifyNameListVar()
207 1047 : call SpecBase%ProgressReportPeriod %nullifyNameListVar()
208 1047 : call SpecBase%ParallelizationModel %nullifyNameListVar()
209 1047 : call SpecBase%InputFileHasPriority %nullifyNameListVar()
210 1047 : call SpecBase%TargetAcceptanceRate %nullifyNameListVar()
211 1047 : call SpecBase%MpiFinalizeRequested %nullifyNameListVar()
212 1047 : call SpecBase%MaxNumDomainCheckToWarn %nullifyNameListVar()
213 1047 : call SpecBase%MaxNumDomainCheckToStop %nullifyNameListVar()
214 1047 : call SpecBase%InterfaceType %nullifyNameListVar()
215 1047 : call SpecBase%SystemInfoFilePath %nullifyNameListVar()
216 1047 : end subroutine nullifyNameListVar
217 :
218 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
219 :
220 1047 : subroutine setFromInputFile( SpecBase, Err )
221 : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
222 : !DEC$ ATTRIBUTES DLLEXPORT :: setFromInputFile
223 : #endif
224 :
225 1047 : use Constants_mod, only: IK, RK
226 : use Err_mod, only: Err_type
227 :
228 : implicit none
229 :
230 : class(SpecBase_type), intent(inout) :: SpecBase
231 : type(Err_type), intent(inout) :: Err
232 :
233 : character(*), parameter :: PROCEDURE_NAME = MODULE_NAME // "@setFromInputFile()"
234 :
235 1047 : call SpecBase%SampleSize %set(sampleSize)
236 1047 : call SpecBase%RandomSeed %set(randomSeed,Err)
237 1047 : call SpecBase%Description %set(description)
238 1047 : call SpecBase%OutputFileName %set(outputFileName)
239 1047 : call SpecBase%ChainFileFormat %set(chainFileFormat)
240 1047 : call SpecBase%VariableNameList %set(VariableNameList)
241 1047 : call SpecBase%RestartFileFormat %set(restartFileFormat)
242 1047 : call SpecBase%DomainLowerLimitVec %set(domainLowerLimitVec)
243 1047 : call SpecBase%DomainUpperLimitVec %set(domainUpperLimitVec)
244 :
245 : ! do not change the order with outputDelimiter
246 1047 : call SpecBase%OutputColumnWidth %set(outputColumnWidth)
247 1047 : call SpecBase%OutputDelimiter %set(SpecBase%OutputColumnWidth%val, outputDelimiter)
248 :
249 1047 : call SpecBase%OverwriteRequested %set(overwriteRequested)
250 1047 : call SpecBase%OutputRealPrecision %set(outputRealPrecision)
251 1047 : call SpecBase%SilentModeRequested %set(silentModeRequested)
252 1047 : call SpecBase%ProgressReportPeriod %set(progressReportPeriod)
253 1047 : call SpecBase%ParallelizationModel %set(parallelizationModel)
254 1047 : call SpecBase%InputFileHasPriority %set(inputFileHasPriority)
255 1047 : call SpecBase%TargetAcceptanceRate %set(TargetAcceptanceRate)
256 1047 : call SpecBase%MpiFinalizeRequested %set(mpiFinalizeRequested)
257 1047 : call SpecBase%MaxNumDomainCheckToWarn %set(maxNumDomainCheckToWarn)
258 1047 : call SpecBase%MaxNumDomainCheckToStop %set(maxNumDomainCheckToStop)
259 1047 : call SpecBase%InterfaceType %set(interfaceType)
260 1047 : call SpecBase%SystemInfoFilePath %set(systemInfoFilePath)
261 :
262 1047 : if (Err%occurred) Err%msg = PROCEDURE_NAME // Err%msg
263 :
264 1047 : end subroutine setFromInputFile
265 :
266 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
267 :
268 1041 : subroutine setFromInputArgs ( SpecBase, Err &
269 : , sampleSize &
270 : , randomSeed &
271 : , description &
272 : , outputFileName &
273 : , outputDelimiter &
274 : , chainFileFormat &
275 0 : , variableNameList &
276 1041 : , domainLowerLimitVec &
277 1041 : , domainUpperLimitVec &
278 : , restartFileFormat &
279 : , outputColumnWidth &
280 : , overwriteRequested &
281 : , outputRealPrecision &
282 : , silentModeRequested &
283 : , parallelizationModel &
284 : , progressReportPeriod &
285 : , TargetAcceptanceRate &
286 : , mpiFinalizeRequested &
287 : , maxNumDomainCheckToWarn &
288 : , maxNumDomainCheckToStop &
289 : )
290 : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
291 : !DEC$ ATTRIBUTES DLLEXPORT :: setFromInputArgs
292 : #endif
293 :
294 1047 : use Constants_mod, only: IK, RK
295 : use Err_mod, only: Err_type
296 :
297 : implicit none
298 :
299 : class(SpecBase_type), intent(inout) :: SpecBase
300 : type(Err_type), intent(inout) :: Err
301 :
302 : character(*), parameter :: PROCEDURE_NAME = MODULE_NAME // "@setFromInputArgs()"
303 :
304 : ! ParaMonte variables
305 : integer(IK) , intent(in), optional :: sampleSize
306 : integer(IK) , intent(in), optional :: randomSeed
307 : character(*), intent(in), optional :: description
308 : character(*), intent(in), optional :: outputFileName
309 : character(*), intent(in), optional :: outputDelimiter
310 : character(*), intent(in), optional :: chainFileFormat
311 : character(*), intent(in), optional :: variableNameList(:)
312 : character(*), intent(in), optional :: restartFileFormat
313 : integer(IK) , intent(in), optional :: outputColumnWidth
314 : logical , intent(in), optional :: overwriteRequested
315 : integer(IK) , intent(in), optional :: outputRealPrecision
316 : logical , intent(in), optional :: silentModeRequested
317 : real(RK) , intent(in), optional :: domainLowerLimitVec(:)
318 : real(RK) , intent(in), optional :: domainUpperLimitVec(:)
319 : character(*), intent(in), optional :: parallelizationModel
320 : integer(IK) , intent(in), optional :: progressReportPeriod
321 : real(RK) , intent(in), optional :: TargetAcceptanceRate(2)
322 : logical , intent(in), optional :: mpiFinalizeRequested
323 : integer(IK) , intent(in), optional :: maxNumDomainCheckToWarn
324 : integer(IK) , intent(in), optional :: maxNumDomainCheckToStop
325 :
326 1041 : if (present(sampleSize)) call SpecBase%SampleSize %set(sampleSize)
327 1041 : if (present(randomSeed)) call SpecBase%RandomSeed %set(randomSeed,Err)
328 1041 : if (present(description)) call SpecBase%Description %set(description)
329 1041 : if (present(outputFileName)) call SpecBase%OutputFileName %set(outputFileName)
330 1041 : if (present(chainFileFormat)) call SpecBase%ChainFileFormat %set(chainFileFormat)
331 1041 : if (present(variableNameList)) call SpecBase%VariableNameList %set(variableNameList)
332 1041 : if (present(restartFileFormat)) call SpecBase%RestartFileFormat %set(restartFileFormat)
333 1041 : if (present(domainLowerLimitVec)) call SpecBase%DomainLowerLimitVec %set(domainLowerLimitVec)
334 1041 : if (present(domainUpperLimitVec)) call SpecBase%DomainUpperLimitVec %set(domainUpperLimitVec)
335 :
336 : ! do not change the order with outputDelimiter
337 1041 : if (present(outputColumnWidth)) call SpecBase%OutputColumnWidth %set(outputColumnWidth)
338 1041 : call SpecBase%OutputDelimiter%set(SpecBase%OutputColumnWidth%val, outputDelimiter)
339 :
340 1041 : if (present(overwriteRequested)) call SpecBase%OverwriteRequested %set(overwriteRequested)
341 1041 : if (present(parallelizationModel)) call SpecBase%ParallelizationModel %set(parallelizationModel)
342 1041 : if (present(outputRealPrecision)) call SpecBase%OutputRealPrecision %set(outputRealPrecision)
343 1041 : if (present(silentModeRequested)) call SpecBase%SilentModeRequested %set(silentModeRequested)
344 1041 : if (present(progressReportPeriod)) call SpecBase%ProgressReportPeriod %set(progressReportPeriod)
345 1041 : if (present(TargetAcceptanceRate)) call SpecBase%TargetAcceptanceRate %set(TargetAcceptanceRate)
346 1041 : if (present(mpiFinalizeRequested)) call SpecBase%MpiFinalizeRequested %set(mpiFinalizeRequested)
347 1041 : if (present(maxNumDomainCheckToWarn)) call SpecBase%MaxNumDomainCheckToWarn %set(maxNumDomainCheckToWarn)
348 1041 : if (present(maxNumDomainCheckToStop)) call SpecBase%MaxNumDomainCheckToStop %set(maxNumDomainCheckToStop)
349 :
350 1041 : if (Err%occurred) Err%msg = PROCEDURE_NAME // Err%msg
351 :
352 2082 : end subroutine setFromInputArgs
353 :
354 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
355 :
356 969 : subroutine reportValues(SpecBase,prefix,outputUnit,isLeaderImage)
357 : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
358 : !DEC$ ATTRIBUTES DLLEXPORT :: reportValues
359 : #endif
360 1041 : use Decoration_mod, only: GENERIC_OUTPUT_FORMAT
361 : use Decoration_mod, only: GENERIC_TABBED_FORMAT
362 : use Decoration_mod, only: TAB
363 : use Constants_mod, only: IK, UNDEFINED
364 : use Err_mod, only: note, informUser
365 : implicit none
366 : class(SpecBase_type), intent(in) :: SpecBase
367 : character(*), intent(in) :: prefix
368 : integer(IK) , intent(in) :: outputUnit
369 : logical , intent(in) :: isLeaderImage
370 : integer(IK) :: i, ndim
371 969 : character(:), allocatable :: msg
372 :
373 969 : if (isLeaderImage) then
374 :
375 359 : ndim = size(SpecBase%DomainLowerLimitVec%Val(:))
376 : msg = "ndim is a 32-bit positive integer, representing the number of dimensions of the domain of the objective function. &
377 : &It is the only simulation specification variable that the user must always provide along with the objective function, &
378 : &separately from the rest of the simulation specifications. The variable ndim must be always provided directly to the ParaMonte &
379 : &routines, along with the objective function. If specified within an input file, its value will be ignored and not used. &
380 359 : &The variable ndim has no default value as it is the only mandatory piece of information that must be provided by the user."
381 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
382 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "ndim"
383 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
384 359 : write(outputUnit,GENERIC_TABBED_FORMAT) ndim
385 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = msg )
386 :
387 :
388 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
389 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "description"
390 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
391 359 : call informUser( outputUnit = outputUnit, newline = "\n", wrapWidth = 125_IK, prefix = TAB//TAB, marginTop = 0_IK, marginBot = 0_IK, msg = SpecBase%Description%val )
392 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%Description%desc )
393 :
394 :
395 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
396 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "inputFileHasPriority"
397 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
398 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%InputFileHasPriority%val
399 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%InputFileHasPriority%desc )
400 :
401 :
402 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
403 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "silentModeRequested"
404 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
405 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%SilentModeRequested%val
406 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%SilentModeRequested%desc )
407 :
408 :
409 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
410 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "domainLowerLimitVec"
411 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
412 871 : do i = 1, ndim
413 871 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%DomainLowerLimitVec%Val(i)
414 : end do
415 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%DomainLowerLimitVec%desc )
416 :
417 :
418 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
419 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "domainUpperLimitVec"
420 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
421 871 : do i = 1, ndim
422 871 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%DomainUpperLimitVec%Val(i)
423 : end do
424 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%DomainUpperLimitVec%desc )
425 :
426 :
427 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
428 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "variableNameList"
429 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
430 871 : do i = 1, ndim
431 871 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%VariableNameList%Val(i)
432 : end do
433 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%VariableNameList%desc )
434 :
435 :
436 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
437 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "parallelizationModel"
438 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
439 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%ParallelizationModel%val
440 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%ParallelizationModel%desc )
441 :
442 :
443 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
444 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "mpiFinalizeRequested"
445 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
446 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%MpiFinalizeRequested%val
447 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%MpiFinalizeRequested%desc )
448 :
449 :
450 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
451 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "outputFileName"
452 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
453 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%OutputFileName%modified
454 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%OutputFileName%desc )
455 :
456 :
457 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
458 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "overwriteRequested"
459 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
460 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%OverwriteRequested%val
461 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%OverwriteRequested%desc )
462 :
463 :
464 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
465 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "targetAcceptanceRate"
466 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
467 359 : if ( SpecBase%TargetAcceptanceRate%scalingRequested ) then
468 28 : if ( SpecBase%TargetAcceptanceRate%Val(1)==SpecBase%TargetAcceptanceRate%Val(2) ) then
469 8 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%TargetAcceptanceRate%Val(1)
470 : else
471 20 : write(outputUnit,GENERIC_TABBED_FORMAT) "[", SpecBase%TargetAcceptanceRate%Val(1), ",", SpecBase%TargetAcceptanceRate%Val(2), "]"
472 : end if
473 : else
474 331 : write(outputUnit,GENERIC_TABBED_FORMAT) UNDEFINED
475 : end if
476 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%TargetAcceptanceRate%desc )
477 :
478 :
479 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
480 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "sampleSize"
481 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
482 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%SampleSize%val
483 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%SampleSize%desc )
484 :
485 :
486 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
487 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "randomSeed"
488 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
489 359 : if ( SpecBase%RandomSeed%userSeed == SpecBase%RandomSeed%nullSeed ) then
490 311 : write(outputUnit,GENERIC_TABBED_FORMAT) UNDEFINED
491 : else
492 48 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%RandomSeed%userSeed
493 : end if
494 :
495 :
496 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
497 359 : write(outputUnit,GENERIC_TABBED_FORMAT) "ThisProcessID", "RandomSeedVectorSize", "RandomSeedVectorValues"
498 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%RandomSeed%imageID, SpecBase%RandomSeed%sizeSeed, SpecBase%RandomSeed%Seed(:,SpecBase%RandomSeed%imageID)
499 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
500 359 : write(outputUnit,GENERIC_TABBED_FORMAT) "OtherProcessID", "RandomSeedVectorSize", "RandomSeedVectorValues"
501 359 : if (SpecBase%RandomSeed%imageCount==1) then
502 0 : write(outputUnit,GENERIC_TABBED_FORMAT) "No other processor exists."
503 : #if defined CAF_ENABLED || defined MPI_ENABLED
504 : else
505 1436 : do i = 1, SpecBase%RandomSeed%imageCount
506 1436 : if (i/=SpecBase%RandomSeed%imageID) write(outputUnit,GENERIC_TABBED_FORMAT) i, SpecBase%RandomSeed%sizeSeed, SpecBase%RandomSeed%Seed(:,i)
507 : end do
508 : #endif
509 : end if
510 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%RandomSeed%desc )
511 :
512 :
513 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
514 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "outputColumnWidth"
515 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
516 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%OutputColumnWidth%val
517 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%OutputColumnWidth%desc )
518 :
519 :
520 : !block
521 : !use Constants_mod, only: TAB
522 : !character(:), allocatable :: delimiter
523 : !delimiter = SpecBase%OutputDelimiter%val
524 : !if (SpecBase%OutputDelimiter%val==TAB) delimiter = "\t"
525 : !if (SpecBase%OutputDelimiter%val=="\t") delimiter = "\\t"
526 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
527 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "outputDelimiter"
528 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
529 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%OutputDelimiter%val
530 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%OutputDelimiter%desc )
531 : !end block
532 :
533 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
534 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "outputRealPrecision"
535 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
536 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%OutputRealPrecision%val
537 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%OutputRealPrecision%desc )
538 :
539 :
540 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
541 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "chainFileFormat"
542 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
543 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%ChainFileFormat%val
544 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%ChainFileFormat%desc )
545 :
546 :
547 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
548 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "restartFileFormat"
549 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
550 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%RestartFileFormat%val
551 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%RestartFileFormat%desc )
552 :
553 :
554 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
555 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "progressReportPeriod"
556 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
557 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%ProgressReportPeriod%val
558 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%ProgressReportPeriod%desc )
559 :
560 :
561 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
562 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "maxNumDomainCheckToWarn"
563 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
564 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%MaxNumDomainCheckToWarn%val
565 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%MaxNumDomainCheckToWarn%desc )
566 :
567 :
568 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
569 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT) "maxNumDomainCheckToStop"
570 359 : write(outputUnit,GENERIC_OUTPUT_FORMAT)
571 359 : write(outputUnit,GENERIC_TABBED_FORMAT) SpecBase%MaxNumDomainCheckToStop%val
572 359 : if (SpecBase%SilentModeRequested%isFalse) call note( prefix = prefix, outputUnit = outputUnit, newline = "\n", msg = SpecBase%MaxNumDomainCheckToStop%desc )
573 :
574 :
575 : end if
576 :
577 :
578 969 : end subroutine reportValues
579 :
580 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581 :
582 1035 : subroutine checkForSanity(SpecBase,Err,methodName)
583 : #if INTEL_COMPILER_ENABLED && defined DLL_ENABLED && (OS_IS_WINDOWS || defined OS_IS_DARWIN)
584 : !DEC$ ATTRIBUTES DLLEXPORT :: checkForSanity
585 : #endif
586 969 : use Err_mod, only: Err_type
587 : implicit none
588 : class(SpecBase_type), intent(in) :: SpecBase
589 : type(Err_type), intent(inout) :: Err
590 : character(*), intent(in) :: methodName
591 1035 : call SpecBase%ChainFileFormat %checkForSanity(Err,methodName)
592 1035 : call SpecBase%OutputDelimiter %checkForSanity(Err,methodName)
593 1035 : call SpecBase%DomainLowerLimitVec %checkForSanity(Err)
594 1035 : call SpecBase%DomainUpperLimitVec %checkForSanity(Err,SpecBase%DomainLowerLimitVec%Val)
595 1035 : call SpecBase%RestartFileFormat %checkForSanity(Err,methodName)
596 1035 : call SpecBase%OutputColumnWidth %checkForSanity(Err,methodName, SpecBase%OutputRealPrecision%val)
597 1035 : call SpecBase%OutputRealPrecision %checkForSanity(Err,methodName)
598 1035 : call SpecBase%ParallelizationModel %checkForSanity(Err,methodName)
599 1035 : call SpecBase%ProgressReportPeriod %checkForSanity(Err,methodName)
600 1035 : call SpecBase%TargetAcceptanceRate %checkForSanity(Err)
601 1035 : call SpecBase%MaxNumDomainCheckToWarn %checkForSanity(Err,methodName)
602 1035 : call SpecBase%MaxNumDomainCheckToStop %checkForSanity(Err,methodName)
603 2070 : end subroutine checkForSanity
604 :
605 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
606 :
607 : end module SpecBase_mod ! LCOV_EXCL_LINE
|